Subject: should gcc's LIB_SPEC include -lc when linking shared libraries?
To: None <>
From: J.T. Conklin <>
List: tech-userlevel
Date: 03/09/2006 17:38:32
I work on an application which uses dlopen()-ed shared libraries for
strategied behavior.  Recently, we ran into a problem loading a *.so
that turned out to be caused by the fact that it hadn't been linked
against all it's requisite libraries.

To avoid this problem in the future, I tried passing -Wl,-z,defs to
the compiler when linking the *.so.  This complained about unresolved
references that would be satisfied by  With current versions
of the linker, -lc could be wrapped by --as-needed / -no-as-needed so
the ELF DT_NEEDED tag wouldn't be added unless something from libc is
really used.

While I could explicitly pass -lc, it appears that other systems like
Linux pass -lc to the linker when -shared is used. 

Should NetBSD do the same?


J.T. Conklin