Re: static linking of C++ apps
>>>>> On Sun, 19 Aug 2001 18:21:15 +1000, Hamish Moffatt <firstname.lastname@example.org> said:
Hamish> I'm trying to compile a C++ app statically, to give a binary to someone
Hamish> who wants to use it on a cutdown system without all of the libraries
Hamish> (the Linux Router Project). The app links against libcrypt and libpthread.
Hamish> When I add -static to the link command, I just get lots of unresolved
Hamish> symbol errors; it links and runs fine without -static.
Hamish> Here's the error. Can anyone help?
Hamish> g++ -static -lcrypt -lpthread aprsd.o utils.o history.o rf.o serial.o cpqueue.o aprsString.o mic_e.o queryResp.o dupCheck.o crc32.o validate.o -o aprsd
First your objects should _be_ follow by the libraries.
If it does not help, second: try to exchange -lcrypt and -lpthread, or pass
"/usr/lib/libpthread.a /usr/lib/libcrypt.a" (or visa versa :)) instead
of "-static -lcrypt -lpthread".
The order of compiler arguments metters, when you link
staticly. Actually I'd appreciate if somebody could tell me what this
order should be.