bcgsc / btllib

Bioinformatics Technology Lab common code library
Other
21 stars 5 forks source link

Build fails: undefined symbol: btllib::KmerBloomFilter::KmerBloomFilter #98

Closed yurivict closed 1 year ago

yurivict commented 1 year ago
c++  -o recipes/indexlr recipes/indexlr.p/_usr_ports_biology_btllib_work_btllib-1.6.0_recipes_indexlr.cpp.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,--start-group -ldl -lstdc++ -lm -fstack-protector-strong -O2 -pipe -fstack-protector-strong -fno-strict-aliasing subprojects/sdsl-lite/libsdsl.a libbtllib.a -Wl,--end-group -pthread -fopenmp -fopenmp
ld: error: undefined symbol: btllib::KmerBloomFilter::KmerBloomFilter(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)
>>> referenced by indexlr.cpp
>>>               recipes/indexlr.p/_usr_ports_biology_btllib_work_btllib-1.6.0_recipes_indexlr.cpp.o:(main)
>>> referenced by indexlr.cpp
>>>               recipes/indexlr.p/_usr_ports_biology_btllib_work_btllib-1.6.0_recipes_indexlr.cpp.o:(main)

Version: 1.6.0 clang-15 FreeBSD 13.2

vlad0x00 commented 1 year ago

Hi! How was btllib compiled? Using the compile script or manually using ninja commands?

yurivict commented 1 year ago

It is configured using meson, and then compiled using ninja. All in the FreeBSD ports framework.

vlad0x00 commented 1 year ago

There was a similar problem on Arch Linux recently: https://github.com/bcgsc/abyss/issues/467 Try compiling btllib using the compile script at the root of the repo. Also look into whether your package build process has a way of disabling stripping symbols from the binaries, as that was the issue on Arch.

yurivict commented 1 year ago

The immediate reason of failure is because you don't check for errors after the commands. Particularly here the python3 executable doesn't exist but this script succeeds nevertheless.

You need to either check the exit status after every command, or use the STRICT mode for the shell scripts.

vlad0x00 commented 1 year ago

Thank you for providing the information behind the error. We'll address it as soon as we can.

vlad0x00 commented 1 year ago

The immediate reason of failure is because you don't check for errors after the commands. Particularly here the python3 executable doesn't exist but this script succeeds nevertheless.

You need to either check the exit status after every command, or use the STRICT mode for the shell scripts.

Hi @yurivict . We've merged a PR to address this: https://github.com/bcgsc/btllib/pull/103

I don't think this will address the problem raised in this issue, though. My guess is that the symbols are missing because they're stripped after install. btllib is a static library, and looking into FreeBSD docs (https://people.freebsd.org/~olivierd/porters-handbook/install.html), I found the following:

_"Do not use INSTALL_LIB to install static libraries, because stripping them renders them useless. Use INSTALLDATA instead."

If you're using INSTALL_LIB, that could be the cause of the issue. Alternatively, I think setting STRIP_CMD to an empty string might disable stripping.

yurivict commented 1 year ago

This was due to a missing python executable. btllib builds now.

Thanks for your help.