Ask Your Question

Revision history [back]

How to enable old transitive DSO link behaviour?

Looking at 'Understannding DSO Link Change' I understand that (by default) the linker (ld) does not transitively resolves shared library dependencies.

For example for a simple program that calls a function from boost_filesystem and you link like this:

$ g++ boost_remove.cc -lboost_filesystem

Then you get something like:

/usr/bin/ld: /tmp/ccxkAkLn.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/bin/ld: note: '_ZN5boost6system15system_categoryEv' is defined in DSO /lib64/libboost_system.so.1.53.0 so try adding it to the linker command line
/lib64/libboost_system.so.1.53.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Sure enough this works:

$ g++ boost_remove.cc -lboost_system -lboost_filesystem

Is there a way to get the old behaviour on Fedora?

(the old behaviour where the linker automatically (i.e. transitively) resolves all shared library dependencies such that just specifying -lboost_filesystem is perfectly fine)

example source:

#include <boost/filesystem.hpp>
#include <string>
using namespace std;
int main(int argc, char **argv)
{
  string filename(argv[1]);
  boost::filesystem::remove(filename);
  return 0;
}

References

fedoraproject org / wiki/UnderstandingDSOLinkChange

How to enable old transitive DSO link behaviour?

Looking at 'Understannding Understannding DSO Link Change' Change I understand that (by default) the linker (ld) does not transitively resolves shared library dependencies.

For example for a simple program that calls a function from boost_filesystem and you link like this:

$ g++ boost_remove.cc -lboost_filesystem

Then you get something like:

/usr/bin/ld: /tmp/ccxkAkLn.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/bin/ld: note: '_ZN5boost6system15system_categoryEv' is defined in DSO /lib64/libboost_system.so.1.53.0 so try adding it to the linker command line
/lib64/libboost_system.so.1.53.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Sure enough this works:

$ g++ boost_remove.cc -lboost_system -lboost_filesystem

Is there a way to get the old behaviour on Fedora?

(the old behaviour where the linker automatically (i.e. transitively) resolves all shared library dependencies such that just specifying -lboost_filesystem is perfectly fine)

example source:

#include <boost/filesystem.hpp>
#include <string>
using namespace std;
int main(int argc, char **argv)
{
  string filename(argv[1]);
  boost::filesystem::remove(filename);
  return 0;
}

References

fedoraproject org / wiki/UnderstandingDSOLinkChange