[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

static linking of C++ apps



I'm trying to compile a C++ app statically, to give a binary to someone
who wants to use it on a cutdown system without all of the libraries
(the Linux Router Project). The app links against libcrypt and libpthread.
When I add -static to the link command, I just get lots of unresolved
symbol errors; it links and runs fine without -static.

Here's the error. Can anyone help?

thanks,
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
aprsd.o: In function `dequeueTNC(void)':
aprsd.o(.text+0x120c): undefined reference to `pthread_create'
aprsd.o(.text+0x1250): undefined reference to `pthread_detach'
aprsd.o: In function `TCPServerThread(void *)':
aprsd.o(.text+0x4ff8): undefined reference to `pthread_create'
aprsd.o(.text+0x5016): undefined reference to `pthread_create'
aprsd.o(.text+0x50a8): undefined reference to `pthread_detach'
aprsd.o: In function `main':
aprsd.o(.text+0xc18b): undefined reference to `pthread_create'
aprsd.o(.text+0xc1db): undefined reference to `pthread_create'
aprsd.o(.text+0xc22b): undefined reference to `pthread_create'
aprsd.o(.text+0xc27b): undefined reference to `pthread_create'
aprsd.o(.text+0xc2cb): undefined reference to `pthread_create'
aprsd.o(.text+0xc31b): more undefined references to `pthread_create' follow
aprsd.o: In function `main':
aprsd.o(.text+0xc7b1): undefined reference to `pthread_detach'
aprsd.o(.text+0xc847): undefined reference to `pthread_create'
aprsd.o(.text+0xc87b): undefined reference to `pthread_detach'
utils.o: In function `checkpass(char const *, char const *, char const *)':
utils.o(.text+0x652): undefined reference to `crypt'
rf.o: In function `rfOpen(char *)':
rf.o(.text+0xfa): undefined reference to `pthread_create'
validate.o: In function `checkSystemPass(char const *, char const *, char const *)':
validate.o(.text+0x2bc): undefined reference to `crypt'
validate.o(.text+0x4b9): undefined reference to `crypt'
/usr/lib/gcc-lib/i386-linux/2.95.2/libgcc.a(_eh.o)(.data+0x0): undefined reference to `pthread_create'
/usr/lib/gcc-lib/i386-linux/2.95.2/libgcc.a(frame.o)(.data+0x0): undefined reference to `pthread_create'
collect2: ld returned 1 exit status
make: *** [aprsd] Error 1
-- 
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>



Reply to: