简体   繁体   中英

Linking issue with g++ and glibmm

I'm trying to compile gobby , and compilation stops with these errors:

/usr/lib64/gcc/x86_64-slackware-linux/4.9.3/../../../../lib64/libglibmm-2.4.so: undefined reference to `std::out_of_range::out_of_range(char const*)@GLIBCXX_3.4.21'
/usr/lib64/gcc/x86_64-slackware-linux/4.9.3/../../../../lib64/libglibmm-2.4.so: undefined reference to `std::underflow_error::underflow_error(char const*)@GLIBCXX_3.4.21'
/usr/lib64/gcc/x86_64-slackware-linux/4.9.3/../../../../lib64/libglibmm-2.4.so: undefined reference to `std::overflow_error::overflow_error(char const*)@GLIBCXX_3.4.21'

First reaction was checking the link command. It ends like this:

... -lgsasl -lgnutls -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 **-lglibmm-2.4** -lcairomm-1.0 -lsigc-2.0 -lgtksourceview-3.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -linfgtk-0.7 -linftextgtk-0.7 -linftext-0.7 -linfinity-0.7 -lxml2 -lgnutls -lgsasl -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

(I marked the -lglibmm-2.4 library with ** . I suspect that's where the identifiers should be defined. To be sure I ran:

$ objdump -TC libglibmm-2.4.so.1.3.0 | grep out_of_range
0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4.21 std::out_of_range::out_of_range(char const*)
0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::out_of_range::~out_of_range()
0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4.20 std::__throw_out_of_range_fmt(char const*, ...)
0000000000000000      DO *UND*  0000000000000000  GLIBCXX_3.4 typeinfo for std::out_of_range

$ objdump -TC libglibmm-2.4.so.1.3.0 | grep overflow_error
0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4.21 std::overflow_error::overflow_error(char const*)
0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 std::overflow_error::~overflow_error()
0000000000000000      DO *UND*  0000000000000000  GLIBCXX_3.4 typeinfo for std::overflow_error

So, they seem to be undefined in the .so file. Where should they be defined then?

Well, I solved the compilation issue, but this creates another issue:

     19 Aug 23 21:39 libstdc++.so        -> libstdc++.so.6.0.20
     18 Sep  3  2016 libstdc++.so.5      -> libstdc++.so.5.0.7
4515618 Jun  5  2013 libstdc++.so.5.0.7
     19 Sep  3  2016 libstdc++.so.6      -> libstdc++.so.6.0.21
 966848 Jul 30  2012 libstdc++.so.6.0.17
1003520 Aug 19  2015 libstdc++.so.6.0.20
1533144 Mar  7  2016 libstdc++.so.6.0.21

After I updatedl libstdc++ a short while ago, the version increased from 6.0.20 to 6.0.21 , Even after manually calling ldconfig , libstdc++.so still pointed to the 6.0.20 version. Changing this link manually to 6.0.21 solved the problem.

I was under the impression that ldconfig should have taken care of this. Neither the man page nor a search revealed the exact algorithm ldconfig follows... Am I wrong here?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM