My test.c program uses printf function. I want to statically link library I need. I use arm-linux-gnueabi-gcc cross compiler.
When I compile my code like this
arm-linux-gnueabi-gcc test.c -o test
it passes, but I think he still uses dynamic linking by looking at dissasembly of test.
So,what option should I add in order to statically link libc.a library?
Try
arm-linux-gnueabi-gcc test.c -o test -Xlinker -static /path/to/libc.a
This worked for me. Also, it might complain that you don't have static libgcc_s. Then try this:
arm-linux-gnueabi-gcc test.c -o test -Xlinker -static /path/to/libc.a -static-libgcc
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With