Re: Creating a statically linked executable for a LuaJIT+C program

  • From: Florian Weimer <fw@xxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 28 Oct 2012 21:49:26 +0100

* John Spencer:

>> I don't think musl supports NSS, so your application will not play
>> well with LDAP, mDNS etc.
>
> as long as the application that wants to be linked statically depends
> on these features (very unlikely) this doesn't matter a bit.

This isn't something the application can control.  With NSS,
getaddrinfo can get data from mDNS, and getpwnam can get user
information from LDAP, as configured by the system administrator.
Both scenarios are actually quite common.  If your application links
against a different libc, it will not support NSS, and it will not
have the behavior expected by users.

>> and generally behave different than the rest of the system.
>
> *if* glibc follows the POSIX/C specs, they will behave identically.

The specification doesn't cover how getpwnam etc. get their data.
Different libcs have different behavior there.

>> You can link libc dynamically and the rest statically.
>
> this sounds like A Bad Idea. if you dynamically link one component,
> you can as well just dynamically link everything, because you'll
> lose the advantages of static linking.

The libc ABI is extremely stable, much more so than other libraries.

Other related posts: