kfr icon indicating copy to clipboard operation
kfr copied to clipboard

Linker error in v6.0.2 vs v5.2.0

Open njungels opened this issue 1 year ago • 2 comments

Version 5.2.0: Compiler is clang 14.0.6 on Debian bookworm. KFR reports during cmake configuration: [cmake] -- Default CPU architecture for KFR is avx512 (set KFR_ARCH to override) The application compiles and links successfully.

Version 6.0.2: Compiler is clang 14.0.6 on Debian bookworm KFR reports during cmake configuration:

[cmake] -- Default CPU architecture for KFR is sse2 (set KFR_ARCH to override)
[cmake] -- Runtime dispatch is enabled for architectures: sse2;sse41;avx;avx2;avx512 (set KFR_ARCHS to change, set KFR_ENABLE_MULTIARCH=OFF to disable)

I see several warnings pop-up akin to:

[build] /opt/udp_test/build/_deps/kfr-src/include/kfr/base/../simd/shuffle.hpp:97:9: warning: AVX vector return of type 'simd<double, 4UL + 4UL + 0UL>' (vector of 8 'unwrap_bit<double>' values) without 'avx512f' enabled changes the ABI [-Wpsabi]
[build]         intrinsics::simd_concat<typename vec<T, 1>::scalar_type, vec<T, Ns>::scalar_size()...>(vs.v...));
[build]         ^

And the linker fails:

[build] : && /usr/bin/clang++ -O3 -DNDEBUG -Xlinker --push-state -Xlinker --whole-archive -Xlinker /opt/udp_test/build/_deps/kfr-build/lib/libkfr_dft_sse2.a -Xlinker --pop-state mytests/CMakeFiles/filter_test.dir/filter_test.cpp.o -o mytests/filter_test  utilities/libutilities.a  _deps/spdlog-build/libspdlog.a  signal_processing/libsignal_processing.a  _deps/kfr-build/lib/libkfr_dft_sse2.a  _deps/kfr-build/lib/libkfr_dft_sse41.a  _deps/kfr-build/lib/libkfr_dft_avx.a  _deps/kfr-build/lib/libkfr_dft_avx2.a  _deps/kfr-build/lib/libkfr_dft_avx512.a  -lstdc++  -lpthread  -lm  utilities/libutilities.a  _deps/tracy-build/libTracyClient.a  -ldl  _deps/spdlog-build/libspdlog.a && :
[build] /usr/bin/ld: mytests/CMakeFiles/filter_test.dir/filter_test.cpp.o:(.data.rel.ro._ZTVN3kfr10fir_filterIffEE[_ZTVN3kfr10fir_filterIffEE]+0x28): undefined reference to `kfr::fir_filter<float, float>::process_buffer(float*, float const*, unsigned long)'
[build] /usr/bin/ld: mytests/CMakeFiles/filter_test.dir/filter_test.cpp.o:(.data.rel.ro._ZTVN3kfr10fir_filterIffEE[_ZTVN3kfr10fir_filterIffEE]+0x30): undefined reference to `kfr::fir_filter<float, float>::process_expression(float*, kfr::expression_handle<float, 1ul> const&, unsigned long)'
[build] clang: error: linker command failed with exit code 1 (use -v to see invocation)

Adding the compile time flag '-mavx512f' resolves the warnings, but the linker still fails.

njungels avatar Aug 27 '24 14:08 njungels

Hi, Filters are contained in KFR DSP library that isn't included in your linker steps. You're already linking to kfr_dft, just add kfr_dsp to the list.

Wpsabi warnings are safe to ignore.

dancasarin avatar Aug 27 '24 18:08 dancasarin

That worked perfectly! Thanks. Sorry I couldn't catch this myself.

njungels avatar Aug 27 '24 20:08 njungels