开发者

How do I do a static build with uclibc

开发者 https://www.devze.com 2023-04-12 13:51 出处:网络
I have a uclibc toolchain that works. I can compile a simple hello.c program statically (a开发者_开发技巧rm-linux-gcc hello.c -o hello -static -s) but source packages are automatically compiled dynami

I have a uclibc toolchain that works. I can compile a simple hello.c program statically (a开发者_开发技巧rm-linux-gcc hello.c -o hello -static -s) but source packages are automatically compiled dynamically. How can I change the default to static?


You have to edit the makefile of the source packet you are compiling (extra LDFLAG -static, just as you did for the hello.c file). Most of the time source packets are delivered with autoconf. In that case you can probably pass the --enable-static-link flag to configure. See configure --help for the set of possible arguments.

Other note: be careful when cross compiling packages which need other libraries. You do not want to link in your host machine libraries statically.

0

精彩评论

暂无评论...
验证码 换一张
取 消