GNOME Bugzilla – Bug 410710
Link error with symbols visibility control enabled
Last modified: 2020-03-10 11:55:50 UTC
Whenever I try to compile nemiver - from fresh sources or after a "make distclean" - I get this error : g++ -shared -nostdlib /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.1.2/crtbeginS.o .libs/nmv-source-editor.o .libs/nmv-dialog.o .libs/nmv-run-program-dialog.o .libs/nmv-locate-file-dialog.o .libs/nmv-load-core-dialog.o .libs/nmv-saved-sessions-dialog.o .libs/nmv-preferences-dialog.o .libs/nmv-proc-list-dialog.o .libs/nmv-var-inspector-dialog.o .libs/nmv-find-text-dialog.o .libs/nmv-sess-mgr.o .libs/nmv-call-stack.o .libs/nmv-variables-utils.o .libs/nmv-local-vars-inspector.o .libs/nmv-var-inspector.o .libs/nmv-breakpoints-view.o .libs/nmv-thread-list.o .libs/nmv-file-list.o .libs/nmv-open-file-dialog.o .libs/nmv-dbg-perspective.o -Wl,--whole-archive ../../../src/uicommon/.libs/libnemiveruicommon.a -Wl,--no-whole-archive -Wl,--rpath -Wl,/home/bdusauso/prog/gnome/nemiver/src/common/.libs -Wl,--rpath -Wl,/usr/local/lib -lgtksourceviewmm-1.0 -lgtksourceview-1.0 -lgnomeprint-2-2 /usr/lib/libart_lgpl_2.so /usr/lib/libgnomevfs-2.so /usr/lib/libgconf-2.so /usr/lib/libORBit-2.so ../../../src/common/.libs/libnemivercommon.so /usr/lib/libgthread-2.0.so -lpthread -lgtop-2.0 /usr/lib/libglademm-2.4.so /usr/lib/libgtkmm-2.4.so /usr/lib/libglade-2.0.so /usr/lib/libgdkmm-2.4.so /usr/lib/libatkmm-1.6.so /usr/lib/libpangomm-1.4.so -lSM -lICE /usr/lib/libcairomm-1.0.so /usr/lib/libglibmm-2.4.so -lrt /usr/lib/libsigc-2.0.so /usr/lib/libxml2.so -lvte -lncurses -lXft /usr/lib/libgtk-x11-2.0.so /usr/lib/libpangoxft-1.0.so /usr/lib/libpangox-1.0.so /usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libpangocairo-1.0.so -lXext -lXinerama -lXi -lXrandr -lXcursor -lXfixes /usr/lib/libcairo.so /usr/lib/libfreetype.so -lz -lfontconfig -lpng12 -lXrender -lX11 /usr/lib/libpangoft2-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libgobject-2.0.so /usr/lib/libgmodule-2.0.so -ldl /usr/lib/libglib-2.0.so -L/usr/lib/gcc/i486-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i486-linux-gnu/4.1.2/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crtn.o -Wl,--export-dynamic -pthread -Wl,--export-dynamic -pthread -Wl,-soname -Wl,libdbgperspectiveplugin.so -o .libs/libdbgperspectiveplugin.so .libs/nmv-dbg-perspective.o: In function `nemiver::DBGPerspective::append_breakpoint(int, nemiver::IDebugger::BreakPoint const&)': /home/bdusauso/prog/gnome/nemiver/src/persp/dbgperspective/nmv-dbg-perspective.cc:3637: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' /home/bdusauso/prog/gnome/nemiver/src/persp/dbgperspective/nmv-dbg-perspective.cc:3652: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' /home/bdusauso/prog/gnome/nemiver/src/persp/dbgperspective/nmv-dbg-perspective.cc:3637: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' /home/bdusauso/prog/gnome/nemiver/src/persp/dbgperspective/nmv-dbg-perspective.cc:3652: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' /usr/bin/ld: .libs/libdbgperspectiveplugin.so: hidden symbol `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' isn't defined /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status make[5]: *** [libdbgperspectiveplugin.la] Error 1 make[5]: Leaving directory `/home/bdusauso/prog/gnome/nemiver/src/persp/dbgperspective' make[4]: *** [all-recursive] Error 1 make[4]: Leaving directory `/home/bdusauso/prog/gnome/nemiver/src/persp/dbgperspective' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/bdusauso/prog/gnome/nemiver/src/persp' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/bdusauso/prog/gnome/nemiver/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/bdusauso/prog/gnome/nemiver' make: *** [all] Error 2 I'm under Ubuntu Feisty. $ g++ -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu2) I'm also using ccache. $ ccache -V ccache version 2.4
Just tried without ccache and still have the same problem, so it's not ccache's fault.
The problem has to do with these CXXFLAGS : -fvisibility=hidden -fvisibility-inlines-hidden When disabling them, it compiles fine.
Out of curiosity, do you get the same error with only one of those flags? I.e. if you remove -fvisibility=hidden (or vice versa), does the link still fail?
After trying it seems to be sufficient to remove only one of the flags. Tried to compile with "CXXFLAGS = -g -O2 -fuse-cxa-atexit -fvisibility-inlines-hidden" and with "CXXFLAGS = -g -O2 -fuse-cxa-atexit -fvisibility=hidden".
Okay, so compiling with ./autogen.sh --enable-symbolsvisibilitycontrol=no seems to fix the problem. Something is wrong with the gcc in feisty. We should detect that we are on feisty and disable symbol visibility.
I've duplicated this problem on Debian testing/unstable with the nemiver-0.3.0 tarball. g++ --version produces: g++ (GCC) 4.1.3 20070429 (prerelease) (Debian 4.1.2-6) ld --version produces: GNU ld (GNU Binutils for Debian) 2.17.50.20070426 binutils package is 2.17cvs20070426-5 from unstable, gcc is g++-4.1 v. 4.1.2-6 from unstable.
Okay, so looking at the problem a bit more - yeah I use debian sid I am seeing it now, so I cannot play dead anymore ;-) - it seems it is a gcc bug. Well, a bug in some g++ headers. So basically what happens is that I use the -fvisibiliy=hidden option of gcc. Everybody should use that option :-). If you don't believe me, read http://gcc.gnu.org/wiki/Visibility. What it does it that by default, is *NOT* to export the symbols defined in a given compilation unit. Now when a given compilation unit includes stdc++ headers like <string> - remember, the string header contains not only declarations, but also definitions - symbols defined in the string headers are not exported either. When those definitions are actually templates, they are not implicitely instanciated either. I believe this is why nemiver linking fails. So the real fix is that distros apply at least the same patch as the one applied by mandriva at http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/gcc/current/SOURCES/gcc41-visibility1.patch?revision=2665&view=markup . In the meantime, I will disable the visibility option at compile time in nemiver for now ;-) Now let's go report the bug in our beloved distros.
For the record, I have submitted a bug in debian at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=423547 . Cheers,
This bug should have been closed by gcc 4.2.1 (at least it is in Debian).
I just tried re-enabling this on my ubuntu intrepid desktop (g++ 4.3.2) and it seems to work for me now. I don't know if we should re-enable this by default or not, but it seems that we should close this bug somehow.
Closing all open Nemiver tasks as this project does not seem to be maintained anymore. Please see https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/235#note_732192 for further information. Thanks!