I think I'm missing something very simple but this is the setup I have:
I'm using conan to install zstandard:
[requires]
...
zstd/1.5.1
with following config:
[settings]
os=Linux
arch=x86_64
build_type=Release
compiler=clang
compiler.version=12
compiler.libcxx=libstdc++
[env]
CC=/usr/bin/clang-12
CXX=/usr/bin/clang++-12
My CMakeLists.txt
is as follows:
set(LIBRARY_ZSTDSTREAM_SOURCES
zstdstream.cpp
)
set(LIBRARY_ZSTDSTREAM_HEADERS
circularbuffer.h
zstdstream.h
)
add_library(${LIBRARY_ZSTDSTREAM_NAME} STATIC
${LIBRARY_ZSTDSTREAM_SOURCES}
${LIBRARY_ZSTDSTREAM_HEADERS})
target_link_libraries(${LIBRARY_ZSTDSTREAM_NAME} PUBLIC
${CONAN_ZSTD}
${LIBRARY_FORMAT_NAME}
)
target_include_directories(${LIBRARY_ZSTDSTREAM_NAME} PUBLIC
"./"
"${CMAKE_BINARY_DIR}/configured_files/include"
)
The error message I get is the following:
zstdstream.cpp:(.text+0x3b): undefined reference to `ZSTD_getErrorName'
/usr/bin/ld: ../../lib/libzstdstream.a(zstdstream.cpp.o): in function `common::zstdstream::cstream::cstream()':
zstdstream.cpp:(.text+0xc5): undefined reference to `ZSTD_createCStream'
/usr/bin/ld: ../../lib/libzstdstream.a(zstdstream.cpp.o): in function `common::zstdstream::cstream::~cstream()':
zstdstream.cpp:(.text+0xd8): undefined reference to `ZSTD_freeCStream'
/usr/bin/ld: zstdstream.cpp:(.text+0xe3): undefined reference to `ZSTD_isError'
/usr/bin/ld: ../../lib/libzstdstream.a(zstdstream.cpp.o): in function `common::zstdstream::cstream::init(int)':
zstdstream.cpp:(.text+0x148): undefined reference to `ZSTD_initCStream'
/usr/bin/ld: zstdstream.cpp:(.text+0x153): undefined reference to `ZSTD_isError'
I checked the linker by setting VERBOSE=1
running makefile:
-Wl,-rpath,/home/worker/.conan/data/zstd/1.5.1/_/_/package/4d1e52cb9a38d07b5e682edec92bb71d7afcd534/lib:
-L/home/worker/.conan/data/zstd/1.5.1/_/_/package/4d1e52cb9a38d07b5e682edec92bb71d7afcd534/lib
so zstd library is there and linked properly.
I am so confused to what is going on..