Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail to build when preferring external compressors in non-system locations #210

Closed
leifwalsh opened this issue Jan 25, 2018 · 2 comments

Comments

@leifwalsh
Copy link

Since the tests link with the library name blosc_testing rather than linking with the target name blosc_shared_testing, CMake doesn't locate the other libs linked into blosc_shared_testing.

target_link_libraries(${target} blosc_testing)

This fails to find the compressor libraries when linking the tests:

...
[ 59%] Linking C executable test_shuffle_roundtrip_sse2
/path/to/ld.bfd: warning: liblz4.so.1, needed by /path/to/build/blosc/libblosc_testing.so, not found (try using -rpath or -rpath-link)
/path/to/ld.bfd: warning: libsnappy.so.1, needed by /path/to/build/blosc/libblosc_testing.so, not found (try using -rpath or -rpath-link)
/path/to/ld.bfd: warning: libz.so.1, needed by /path/to/build/blosc/libblosc_testing.so, not found (try using -rpath or -rpath-link)
/path/to/ld.bfd: warning: libzstd.so.1.3.3, needed by /path/to/build/blosc/libblosc_testing.so, not found (try using -rpath or -rpath-link)
/path/to/build/blosc/libblosc_testing.so: undefined reference to `LZ4_compress_HC'

 % ldd /path/to/build/blosc/libblosc_testing.so
        linux-vdso.so.1 =>  (0x00007f52a8132000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f52a7ce8000)
        liblz4.so.1 => /path/to/lz4/lib/liblz4.so.1 (0x00007f52a7ad1000)
        libsnappy.so.1 => /path/to/snappy/lib/libsnappy.so.1 (0x00007f52a78c7000)
        libz.so.1 => /path/to/zlib/lib/libz.so.1 (0x00007f52a76b0000)
        libzstd.so.1.3.3 => /path/to/zstd/lib/libzstd.so.1.3.3 (0x00007f52a7443000)
...
 % objdump -x /path/to/build/blosc/libblosc_testing.so | grep zstd
  NEEDED               libzstd.so.1.3.3
  RPATH                /path/to/lz4/lib:/path/to/snappy/lib:/path/to/zlib/lib:/path/to/zstd/lib

With this patch, it works:

diff -u -r c-blosc-1.13.2.old/tests/CMakeLists.txt c-blosc-1.13.2/tests/CMakeLists.txt
--- c-blosc-1.13.2.old/tests/CMakeLists.txt     2018-01-25 00:46:54.523433391 +0000
+++ c-blosc-1.13.2/tests/CMakeLists.txt 2018-01-25 00:47:09.179575378 +0000
@@ -71,7 +71,7 @@
                         "${CMAKE_CURRENT_BINARY_DIR}/libblosc_testing.dll")
     endif()
 
-    target_link_libraries(${target} blosc_testing)
+    target_link_libraries(${target} blosc_shared_testing)
     add_dependencies(${target} blosc_shared_testing)
 
     # If there's a CSV file present for this test, read it to get the list
@FrancescAlted
Copy link
Member

Ah, now that I read your subject better this should happen only when external libraries are in non-standard locations.

@leifwalsh
Copy link
Author

Awesome, thanks for the fast turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants