static linking with musl libc

Didier Kryn kryn@in2p3.fr
Tue Feb 10 13:58:00 GMT 2015


     Hello.

     I have built sysrooted gcc (4.7 and 4.8) understanding Ada, C, C++, 
etc, statically linked with musl libc and with musl in the sysroot. It 
is for x86_64 architecture. It is convenient to be able to copy it to 
any Linux distro and run it right away, even on machines on which I have 
not the root priviledge.

     My problem is that, when passing the -static argument to gnatmake 
(which is also the default, I think), the resulting file is still 
dynamically linked with the libc. I understand that this feature has 
been introduced because the Gnu libc has an incomplete static version -- 
at least part of the networking is missing. But this restriction does 
not exist in musl.  It should be possible to turn this feature off when 
using musl, but I can't find which place of the source of gnatmake I 
need to patch. Would you be kind enough to point me to the right place?

     Thanks.

Didier Kryn
Laboratoire APC, Universite Paris-Diderot
http://www.apc.univ-paris7.fr/

PS.    It is currently possible to achieve full static linking from 
gnatlink, but not from gnatmake.



More information about the Gcc-help mailing list