PickNikRobotics / data_tamer

C++ library for Fearless Timeseries Logging
MIT License
199 stars 20 forks source link

Using as static library in ROS1 cause linking error with LZ4 #16

Closed shaoyifei96 closed 6 months ago

shaoyifei96 commented 6 months ago

Hello,

I built the library following Compiling with Conan instruction. Then I want to install so I did sudo cmake --install build/Release (Is this the correct way to install?)

Then in the CMakeList of the ros1 package I did find_package(data_tamer REQUIRED) and target_link_libraries(${TARGET} data_tamer ${catkin_LIBRARIES} ) and added the example code.

Then after calling catkin_make, I get the following error, would you please give some instruction on using this with ROS1? Should this be built as shared library?

/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::ZStdWriter::~ZStdWriter()':
mcap_sink.cpp:(.text+0x9eb): undefined reference to `ZSTD_freeCCtx'
/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::LZ4Reader::~LZ4Reader()':
mcap_sink.cpp:(.text+0xa60): undefined reference to `LZ4F_freeDecompressionContext'
/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::ZStdWriter::ZStdWriter(mcap::CompressionLevel, unsigned long)':
mcap_sink.cpp:(.text+0x1a51): undefined reference to `ZSTD_createCCtx'
/usr/bin/ld: mcap_sink.cpp:(.text+0x1a6d): undefined reference to `ZSTD_CCtx_setParameter'
/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::LZ4Reader::LZ4Reader()':
mcap_sink.cpp:(.text+0x3c84): undefined reference to `LZ4F_createDecompressionContext'
/usr/bin/ld: mcap_sink.cpp:(.text+0x3c8f): undefined reference to `LZ4F_isError'
/usr/bin/ld: mcap_sink.cpp:(.text+0x3cc4): undefined reference to `LZ4F_getErrorName'
/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::LZ4Writer::end()':
mcap_sink.cpp:(.text+0x71fb): undefined reference to `LZ4F_compressFrameBound'
/usr/bin/ld: mcap_sink.cpp:(.text+0x7229): undefined reference to `LZ4F_compressFrame'
/usr/bin/ld: mcap_sink.cpp:(.text+0x7234): undefined reference to `LZ4F_isError'
/usr/bin/ld: mcap_sink.cpp:(.text+0x72e4): undefined reference to `LZ4F_getErrorName'
/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::ZStdWriter::end()':
mcap_sink.cpp:(.text+0x732e): undefined reference to `ZSTD_compressBound'
/usr/bin/ld: mcap_sink.cpp:(.text+0x735d): undefined reference to `ZSTD_compress2'
/usr/bin/ld: mcap_sink.cpp:(.text+0x7368): undefined reference to `ZSTD_isError'
/usr/bin/ld: mcap_sink.cpp:(.text+0x737e): undefined reference to `ZSTD_CCtx_reset'
/usr/bin/ld: mcap_sink.cpp:(.text+0x73fc): undefined reference to `ZSTD_getErrorCode'
/usr/bin/ld: mcap_sink.cpp:(.text+0x7422): undefined reference to `ZSTD_getErrorName'
/usr/bin/ld: mcap_sink.cpp:(.text+0x744c): undefined reference to `ZSTD_getErrorString'
/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::ZStdReader::DecompressAll(std::byte const*, unsigned long, unsigned long, std::vector<std::byte, std::allocator<std::byte> >*)':
mcap_sink.cpp:(.text+0x7681): undefined reference to `ZSTD_decompress'
/usr/bin/ld: mcap_sink.cpp:(.text+0x76d1): undefined reference to `ZSTD_isError'
/usr/bin/ld: mcap_sink.cpp:(.text+0x76e5): undefined reference to `ZSTD_getErrorName'
/usr/bin/ld: /usr/local/lib/libdata_tamer.a(mcap_sink.cpp.o): in function `mcap::LZ4Reader::decompressAll(std::byte const*, unsigned long, unsigned long, std::vector<std::byte, std::allocator<std::byte> >*)':
mcap_sink.cpp:(.text+0x7acb): undefined reference to `LZ4F_resetDecompressionContext'
/usr/bin/ld: mcap_sink.cpp:(.text+0x7af8): undefined reference to `LZ4F_decompress'
/usr/bin/ld: mcap_sink.cpp:(.text+0x7d44): undefined reference to `LZ4F_isError'
/usr/bin/ld: mcap_sink.cpp:(.text+0x7d58): undefined reference to `LZ4F_getErrorName'
collect2: error: ld returned 1 exit status
make[2]: *** [iiwa_interactive_controller/CMakeFiles/iiwa_interactive_controller_cartesian_bringup.dir/build.make:145: /home/yifei/kuka_ws/devel/lib/iiwa_interactive_controller/iiwa_interactive_controller_cartesian_bringup] Error 1
make[1]: *** [CMakeFiles/Makefile2:6997: iiwa_interactive_controller/CMakeFiles/iiwa_interactive_controller_cartesian_bringup.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
Invoking "make -j16 -l16" failed
fcladera commented 6 months ago

Hi,

This seems to be related to the libraries that are being shipped with Ubuntu 20.04. You need a newer version of libzstd.

The following steps should work: