The same library defines different symbols under 16.04 and under 14.04

149 views Asked by At

I'm using vagrant to build the same code under multiple versions of Ubuntu (12.04, 14.04 and 16.04).

Under 16.04, I have a missing symbol:

undefined reference to TiXmlElement::TiXmlElement(std::string const&)

The linkage is done with the same version of libtinyxml (see below), but when I look at the symbols inside the libraries, there's a small difference:

Ubuntu 14.04:

$ ldd libcustomlib.so
libtinyxml.so.2.6.2 => /usr/lib/x86_64-linux-gnu/libtinyxml.so.2.6.2 (0x00007fe6c9789000)
$ objdump -TC /usr/lib/x86_64-linux-gnu/libtinyxml.so.2.6.2 | grep "TiXmlElement::TiXmlElement(std"
000000000000a0f0 g  DF .text  0000000000000072  Base  TiXmlElement::TiXmlElement(std::string const&)
000000000000a0f0 g  DF .text  0000000000000072  Base  TiXmlElement::TiXmlElement(std::string const&)

Ubuntu 16.04:

$ ldd libcustomlib.so
libtinyxml.so.2.6.2 => /usr/lib/x86_64-linux-gnu/libtinyxml.so.2.6.2 (0x00007f08eb3c0000)
$ objdump -TC /usr/lib/x86_64-linux-gnu/libtinyxml.so.2.6.2 | grep "TiXmlElement::TiXmlElement(std"
000000000000aad0 g  DF .text  0000000000000072  Base  TiXmlElement::TiXmlElement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
000000000000aad0 g  DF .text  0000000000000072  Base  TiXmlElement::TiXmlElement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

As you can see, under 16.04, the library seems to have been built with c++11 while not under 14.04.

How is that since the version number is the same? And what can I do to make my code compile?

1

There are 1 answers

0
Jav On

The problem was related to a different gcc version.

The best thing is to use under each Ubuntu, the gcc that is in the default repositories.