Closed alt-graph closed 8 months ago
In #62, we had to start linking our unit tests statically. The reason (as far as we understand it) is the following:
threads
std::thread
This is actually reproducible: When linking against libgul_dep instead of libgul_static_dep, we get this:
libgul_dep
libgul_static_dep
g++ -o tests/libgul-test tests/libgul-test.p/test_backports.cc.o tests/libgul-test.p/test_bit_manip.cc.o tests/libgul-test.p/test_case_ascii.cc.o tests/libgul-test.p/test_cat.cc.o tests/libgul-test.p/test_escape.cc.o tests/libgul-test.p/test_expected.cc.o tests/libgul-test.p/test_finalizer.cc.o tests/libgul-test.p/test_gcd_lcm.cc.o tests/libgul-test.p/test_hexdump.cc.o tests/libgul-test.p/test_join_split.cc.o tests/libgul-test.p/test_main.cc.o tests/libgul-test.p/test_num_util.cc.o tests/libgul-test.p/test_optional.cc.o tests/libgul-test.p/test_replace.cc.o tests/libgul-test.p/test_SlidingBuffer.cc.o tests/libgul-test.p/test_SmallVector.cc.o tests/libgul-test.p/test_statistics.cc.o tests/libgul-test.p/test_string_util.cc.o tests/libgul-test.p/test_substring_checks.cc.o tests/libgul-test.p/test_ThreadPool.cc.o tests/libgul-test.p/test_time_util.cc.o tests/libgul-test.p/test_to_number.cc.o tests/libgul-test.p/test_tokenize.cc.o tests/libgul-test.p/test_Trigger.cc.o tests/libgul-test.p/test_trim.cc.o tests/libgul-test.p/test_type_name.cc.o tests/libgul-test.p/test_variant.cc.o -fsanitize=address -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/../src' -Wl,-rpath-link,/home/lfroehli/doocs/library/common/gul14/builddir/src -Wl,--start-group src/libgul14.so.2.10.0 -Wl,--end-group -pthread /usr/bin/ld: tests/libgul-test.p/test_ThreadPool.cc.o: in function `gul14::ThreadPoolEngine::add_task<____C_A_T_C_H____T_E_S_T____17()::{lambda(gul14::ThreadPoolEngine&)#1}>(____C_A_T_C_H____T_E_S_T____17()::{lambda(gul14::ThreadPoolEngine&)#1}, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda()#1}::operator()() const': /home/lfroehli/doocs/library/common/gul14/builddir/../include/gul14/ThreadPool.h:226:(.text+0x31013): undefined reference to `gul14::ThreadPoolEngine::is_full_i() const' (etc)
It is not clear what is actually going on here. But somehow adding the threads dependency modifies the linker command line in a way that the linker picks up the wrong GUL14 .so.
.so
In #62, we had to start linking our unit tests statically. The reason (as far as we understand it) is the following:
threads
as a dependency because the main library can now actually spawnstd::thread
s.This is actually reproducible: When linking against
libgul_dep
instead oflibgul_static_dep
, we get this:It is not clear what is actually going on here. But somehow adding the
threads
dependency modifies the linker command line in a way that the linker picks up the wrong GUL14.so
.