| olego |
05-06-2012 07:28 AM |
statical linking
Dear all!
I have to build a big software project on my x86 debian machine to run on MIPS (actually mipsel) hardware. I can build dynamical app, but the problem that my embedded platfom has uClibc and my development platform has a normal libc. I can't build uClibc for mipsel because I get a ton of errors in kernel headers. Right now I have no time to fig into uClinc and spend time trying to build it. I can build a "Hello world!" app statically linked and it runs flawlessly. If I build my project dynamically I have no problems. But when I build statically I have many errors that functions not found.
Code:
mipsel-linux-gnu-gcc -static -L /usr/mipsel-linux-gnu/lib -lm -lpthread -L ../Lib/ -o ../Cmds//ETCP Rels//detc0cru.o Rels//detc0m2f.o Rels//detc0mai.o Rels//detc0soc.o Rels//detc0vru.o ../Lib//IsaNwl.o ../Lib//IsaSys.o ../Lib//ISysSoc.o
../Lib//ISysSoc.o: In function `dsysSocGetHostIp':
(.text+0x68): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
../Lib//IsaSys.o: In function `dsysThrExit':
(.text+0x611c): undefined reference to `pthread_join'
../Lib//IsaSys.o: In function `dsysThrCreate':
(.text+0x6198): undefined reference to `pthread_attr_init'
../Lib//IsaSys.o: In function `dsysThrCreate':
(.text+0x61b0): undefined reference to `pthread_attr_setstacksize'
../Lib//IsaSys.o: In function `dsysThrCreate':
(.text+0x61cc): undefined reference to `pthread_create'
../Lib//IsaSys.o: In function `dsysThrCreate':
(.text+0x620c): undefined reference to `pthread_attr_destroy'
collect2: ld returned 1 exit status
make: *** [../Cmds//ETCP] Error 1
The same errors I get for "sinf", "cosf" and other funcs from libm.
I have libc.a, libm.a and libpthread.a. So my question - how can I avoid these errors? Why I get these errors? Why does libc.a is found but libm.a and libpthread.a don't? IsaSys.o it's a library actually but with an .o extension. My be I have to turn it to a normal library with .a extension? But it works with dynamic linking without problems. Any help will be highly appreciated.
|