Fails to find spdlog because wrong link flags are supplied
Issue #27
new
On FreeBSD 13 it fails to find spdlog:
-- Found SPDLOG: /usr/local/lib/libspdlog.so
-- Performing Test SPDLOG_COMPILES
-- Performing Test SPDLOG_COMPILES - Failed
-- Adding /usr/local/muq_external/include for an SPDLOG include directory.
[...]
# SPDLOG ----------------> Met with internal build -- Failed compilation test.
The log in CMakeError.log is:
: && /usr/bin/c++ -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fno-omit-frame-pointer -DSPDLOG_FMT_EXTERNAL -isystem /usr/local/include -DH5_USE_110_API -fopenmp -pthread -ldl -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fno-omit-frame-pointer -DSPDLOG_FMT_EXTERNAL -isystem /usr/local/include -DH5_USE_110_API -fopenmp -pthread -ldl -fstack-protector-strong CMakeFiles/cmTC_5f25b.dir/src.cxx.o -o cmTC_5f25b -Wl,-rpath,/usr/local/lib /usr/local/lib/libspdlog.so && :
ld: error: undefined symbol: fmt::v8::detail::assert_fail(char const*, int, char const*)
>>> referenced by src.cxx
>>> CMakeFiles/cmTC_5f25b.dir/src.cxx.o:(spdlog::pattern_formatter::format(spdlog::details::log_msg const&, fmt::v8::basic_memory_buffer<char, 250ul, std::__1::allocator<char> >&))
>>> referenced by src.cxx
>>> CMakeFiles/cmTC_5f25b.dir/src.cxx.o:(spdlog::details::full_formatter::format(spdlog::details::log_msg const&, tm const&, fmt::v8::basic_memory_buffer<char, 250ul, std::__1::allocator<char> >&))
>>> referenced by src.cxx
>>> CMakeFiles/cmTC_5f25b.dir/src.cxx.o:(void spdlog::details::fmt_helper::append_int<int>(int, fmt::v8::basic_memory_buffer<char, 250ul, std::__1::allocator<char> >&))
The reason is that link flags that pkg-config returns:
$ pkg-config --libs spdlog
-L/usr/local/lib -lspdlog -pthread -lfmt
aren’t supplied. Particularly. -lfmt is missing.
@yurivict Thanks for pointing this out. Are you suggesting that we should add
-lfmt
to the CXX_LINK_FLAGS in MUQ’s configuration?