I built boost 1.57.0 in QNX 6.5.0. There is no build error. But some libraries are linked to libboost_system.so specifying relative path. I saved compilation logs. Here is linkage step for boost_thread:
"QCC_gpp" -o "bin.v2/libs/thread/build/qcc/release/threading-multi/libboost_thread.so.1.57.0" -shared "bin.v2/libs/thread/build/qcc/release/threading-multi/pthread/thread.o" "bin.v2/libs/thread/build/qcc/release/threading-multi/pthread/once.o" "bin.v2/libs/thread/build/qcc/release/threading-multi/future.o" "bin.v2/libs/system/build/qcc/release/threading-multi/libboost_system.so.1.57.0" -lm
So, When I run ldd libboost_thread.so
, it can't find libboost_system. I think libboost_thread should be linked with -lboost_system
option. But I don't know how to do this.
Thanks.
Edit: I cannot build any program linking with boost_thread. Because, boost_thread searches boost_system in bin.v2/libs/system/build/qcc/release/threading-multi
folder. However both boost_thread and boost_system are in a library search folder. (defined with LD_LIBRARY_PATH
)
If you run objdump -p libboost_thread.so
, you'll find that the NEEDED entry for libboost_system.so contains a (relative) path. According to the ELF specification, the NEEDED entry should contain only the name of the needed library, so there seems to be a bug in the linker or in QCC.
Because if this, the system won't be able to find the file at run-time unless the current directory is the same as it was when linking took place.
The simplest work-around is to link statically to libboost_thread.a.
Another work-around that I've used myself is to create a wrapper around QCC that transforms the command line so that dependencies are given as -Wl,-L <path> -Wl,-l <name>
instead of <path>/lib<name>.so
This also requires a change to the Boost build system so that it doesn't append the version number to the end of library file names.