[CMake] Undefined reference

Michael Hertling mhertling at online.de
Thu Nov 3 19:16:11 EDT 2011


On 11/03/2011 10:18 PM, Dan Kegel wrote:
> On Thu, Nov 3, 2011 at 7:51 AM, Mauricio Klein
> <mauricio.klein.msk at gmail.com> wrote:
>> One last question: i've tried to compile my code using static linkage, once
>> i need my daemon runs in many Linux releases.
> 
> Static linking of glibc is not really supported; IIRC glibc's
> DNS and localization support use shared libraries under
> the hood, even when you ask for static linking... and
> since these are internal interfaces, they have changed
> in incompatible ways in the past.  So beware!
> While it may be ok to link statically to most libraries,
> glibc should always be linked dynamically.

If you will ever meet with a little accident while updating glibc
without a package manager, a common procedure is to use statically
linked utilities, i.e. utilities capable to run without the ruined
glibc, at least in order to repair symlinks, e.g. Another occasion
for the use of statically linked executables without any reference
to glibc and friends is an initramfs that often doesn't have a lib
directory at all. So, what do you mean when saying static linking
against glibc is not really supported? Do you refer to particular
systems or special setups? Could you provide an example?

> If you are still having problems after going back to
> dynamically linking with glibc, please post source code
> for a tiny test program that exhibits the problem, along
> with how you built and tested it, and the log showing the
> failure.

Yep, message after failed invocation, ldd, linker command etc.

Regards,

Michael


More information about the CMake mailing list