libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I keep -lstdc++ out of $postdeps?


From: Jack Bates
Subject: How can I keep -lstdc++ out of $postdeps?
Date: Wed, 22 Feb 2017 10:32:04 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

How can I avoid dynamically linking with libstdc++?
or, how can I keep -lstdc++ out of $postdeps?

When I run "./configure CXXFLAGS=-static-libstdc++",
_LT_SYS_HIDDEN_LIBDEPS (in libtool.m4) runs the following command:


$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"


Which expands to:


c++ -shared -static-libstdc++ -std=c++11 -v conftest.o 2>&1 | /bin/grep -v ^Configured with: | /bin/grep -L


When I run that command myself, the output is:


/usr/lib/gcc/x86_64-linux-gnu/6/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/6/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper -plugin-opt=-fresolution=/tmp/cc4DFGDe.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -shared /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/6/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/6 -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/6/../../.. conftest.o -Bstatic -lstdc++ -Bdynamic -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/6/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/crtn.o


So the output contains "-Bstatic -lstdc++",
but $postdeps in the generated ./libtool is:


  postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"


So although conftest.o respects -static-libstdc++ and is not dynamically linked with libstdc++,
the rest of my project, when eventually built, *is* :-(

Now, if I edit ./libtool and set postdeps="", my project builds just fine (as far as I can tell ...). The compiler/linker already adds/doesn't add those dynamic links as appropriate. So is that an option? Is there a recommended way to disable _LT_SYS_HIDDEN_LIBDEPS?

Alternatively, should _LT_SYS_HIDDEN_LIBDEPS respect the -B option -- either adding it to $postdeps or ignoring other options between -Bstatic and -Bdynamic?

Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]