Boost logo

Boost Users :

Subject: [Boost-users] Can't dynamically load shared lib that is statically linked to boost thread
From: Greg (greg9504_at_[hidden])
Date: 2012-02-01 16:55:28


I've run into a problem since adding a dependency on boost_thread. My shared
library no longer loads (via dlopen("",RTLD_NOW), I get error:

undefined symbol: _ZTIN5boost6detail16thread_data_baseE

Any ideas on how to resolve this?

OS - CentOS 5.4, x86_64
Boost version - 1.47.0 built from source
./ --with-libraries=exception,filesystem,math,thread
./b2 install

This worked fine.

Although I built the other boost libraries, I'm only using thread at this time.

Link line for my shared library which uses boost thread:
Building target:
Invoking: GCC C++ Linker
g++ -L"/usr/local/boost_1_47_0/lib"
-L"/mnt/src/geocosm/matlab/geneticalglib/galibcmplinux_x86_64/distrib" -shared
-o"" ./tslibcpp/src/TsLibCpp.o ./tslib/src/tslibresults.o
./tslib/src/tslibsamplematch.o -lmlgalib -lpthread -lgeothreadcpp
-lgeocosmexception -lxerces-c-3.1 -lgeocosmxmllibbasecpp -lxmllib
Finished building target:

note it is relying on the auto link boost feature which seems to correctly use
the static lib version of boost_thread as "ldd" does not report a dependency on

ldd => not found => /lib64/ (0x00002aae15ec3000) => not found => not found => not found => not found => not found => /usr/lib64/ (0x00002aae160e0000) => /lib64/ (0x00002aae163e0000) => /lib64/ (0x00002aae16664000) => /lib64/ (0x00002aae16872000)
        /lib64/ (0x00000036c7a00000)

When my application attempts to load my shared library via dlopen I get the
undefined symbol error.

If I explicitly link to the shared lib version of boost_thread, ldd shows a
dependency (which it should). If I then include a copy of boost_thread .so on
the ld path my shared library loads without problems. However this is what I
wanted to avoid and instead embed lib boost_thread directly into my .so.

Thanks for any insight.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at