kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.62k stars 248 forks source link

Build failed on arm64 with -DKFR_ENABLE_CAPI_BUILD=ON in capi/CMakeFiles/kfr_capi.dir/capi.cpp.o #199

Closed dubrsl closed 5 months ago

dubrsl commented 8 months ago

Hi. Trying build krf-5.1.0 on arm64. Build failed with error:

#7 400.8 + cmake -Wno-dev -GNinja -DKFR_ENABLE_CAPI_BUILD=ON -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release ..
#7 402.4 -- The CXX compiler identification is Clang 15.0.7
#7 402.5 -- Detecting CXX compiler ABI info
#7 404.1 -- Detecting CXX compiler ABI info - done
#7 404.1 -- Check for working CXX compiler: /usr/bin/clang++ - skipped
#7 404.1 -- Detecting CXX compile features
#7 404.1 -- Detecting CXX compile features - done
#7 404.1 -- Default CPU architecture for KFR is detect (set by cmake variable)
#7 404.2 -- Configuring done
#7 404.5 -- Generating done
#7 404.6 -- Build files have been written to: /tmp/tmp.h0abk2FB2x/build
#7 404.6 + ninja
#7 546.5 [1/80] Building CXX object CMakeFiles/kfr_io.dir/include/kfr/io/impl/audiofile-impl.cpp.o
#7 548.1 [2/80] Linking CXX static library libkfr_io.a
==== skip ====
#7 1782.6 [48/80] Building CXX object capi/CMakeFiles/kfr_capi.dir/capi.cpp.o
#7 1782.6 FAILED: capi/CMakeFiles/kfr_capi.dir/capi.cpp.o
#7 1782.6 /usr/bin/clang++ -DCMT_MULTI=1 -DCMT_MULTI_ENABLED_AVX2=1 -DCMT_MULTI_ENABLED_AVX512=1 -DCMT_MULTI_ENABLED_AVX=1 -DCMT_MULTI_ENABLED_SSE2=1 -DCMT_MULTI_ENABLED_SSE41=1 -DKFR_BUILDING_DLL=1 -DKFR_DFT_MULTI=1 -Dkfr_capi_EXPORTS -I../include -O3 -DNDEBUG -fPIC -fvisibility=default -fdiagnostics-absolute-paths -mstackrealign -Wno-c++1z-extensions -Wno-psabi -std=gnu++17 -MD -MT capi/CMakeFiles/kfr_capi.dir/capi.cpp.o -MF capi/CMakeFiles/kfr_capi.dir/capi.cpp.o.d -o capi/CMakeFiles/kfr_capi.dir/capi.cpp.o -c ../capi/capi.cpp
#7 1782.6 In file included from ../capi/capi.cpp:29:
#7 1782.6 In file included from ../include/kfr/dft.hpp:27:
#7 1782.6 In file included from ../include/kfr/dft/convolution.hpp:35:
#7 1782.6 In file included from ../include/kfr/dft/cache.hpp:28:
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:148:21: error: no member named 'avx512' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::avx512:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:150:21: error: no member named 'avx2' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::avx2:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:152:21: error: no member named 'avx' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::avx:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:154:21: error: no member named 'sse42' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::sse42:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:155:21: error: no member named 'sse41' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::sse41:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:157:21: error: no member named 'ssse3' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::ssse3:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:159:21: error: no member named 'sse3' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::sse3:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:319:21: error: no member named 'avx512' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::avx512:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:321:21: error: no member named 'avx2' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::avx2:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:323:21: error: no member named 'avx' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::avx:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:325:21: error: no member named 'sse42' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::sse42:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:326:21: error: no member named 'sse41' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::sse41:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:328:21: error: no member named 'ssse3' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::ssse3:
#7 1782.6              ~~~~~~~^
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/fft.hpp:330:21: error: no member named 'sse3' in 'kfr::cpu_t'
#7 1782.6         case cpu_t::sse3:
#7 1782.6              ~~~~~~~^
#7 1782.6 In file included from ../capi/capi.cpp:29:
#7 1782.6 In file included from ../include/kfr/dft.hpp:27:
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/convolution.hpp:159:5: error: no member named 'avx512' in 'kfr::cpu_t'
#7 1782.6     CMT_MULTI_PROTO_GATE(make_convolve_filter<T>(taps, block_size))
#7 1782.6     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/cident.h:799:17: note: expanded from macro 'CMT_MULTI_PROTO_GATE'
#7 1782.6     case cpu_t::avx512:                                                                                      \
#7 1782.6          ~~~~~~~^
#7 1782.6 In file included from ../capi/capi.cpp:29:
#7 1782.6 In file included from ../include/kfr/dft.hpp:27:
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/convolution.hpp:159:5: error: no member named 'avx2' in 'kfr::cpu_t'
#7 1782.6     CMT_MULTI_PROTO_GATE(make_convolve_filter<T>(taps, block_size))
#7 1782.6     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/cident.h:801:17: note: expanded from macro 'CMT_MULTI_PROTO_GATE'
#7 1782.6     case cpu_t::avx2:                                                                                        \
#7 1782.6          ~~~~~~~^
#7 1782.6 In file included from ../capi/capi.cpp:29:
#7 1782.6 In file included from ../include/kfr/dft.hpp:27:
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/convolution.hpp:159:5: error: no member named 'avx' in 'kfr::cpu_t'
#7 1782.6     CMT_MULTI_PROTO_GATE(make_convolve_filter<T>(taps, block_size))
#7 1782.6     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/cident.h:803:17: note: expanded from macro 'CMT_MULTI_PROTO_GATE'
#7 1782.6     case cpu_t::avx:                                                                                         \
#7 1782.6          ~~~~~~~^
#7 1782.6 In file included from ../capi/capi.cpp:29:
#7 1782.6 In file included from ../include/kfr/dft.hpp:27:
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/convolution.hpp:159:5: error: no member named 'sse41' in 'kfr::cpu_t'
#7 1782.6     CMT_MULTI_PROTO_GATE(make_convolve_filter<T>(taps, block_size))
#7 1782.6     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/cident.h:805:17: note: expanded from macro 'CMT_MULTI_PROTO_GATE'
#7 1782.6     case cpu_t::sse41:                                                                                       \
#7 1782.6          ~~~~~~~^
#7 1782.6 In file included from ../capi/capi.cpp:29:
#7 1782.6 In file included from ../include/kfr/dft.hpp:27:
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/dft/convolution.hpp:159:5: error: no member named 'ssse3' in 'kfr::cpu_t'
#7 1782.6     CMT_MULTI_PROTO_GATE(make_convolve_filter<T>(taps, block_size))
#7 1782.6     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#7 1782.6 /tmp/tmp.h0abk2FB2x/include/kfr/cident.h:807:17: note: expanded from macro 'CMT_MULTI_PROTO_GATE'
#7 1782.6     case cpu_t::ssse3:                                                                                       \
#7 1782.6          ~~~~~~~^
#7 1782.6 fatal error: too many errors emitted, stopping now [-ferror-limit=]
#7 1782.6 20 errors generated.
dancazarin commented 8 months ago

Hi, As of now C API is not officially supported on arm. But there are plans to make it fully work on all supported platforms in KFR 6 that will be released soon.

dubrsl commented 8 months ago

Hi, As of now C API is not officially supported on arm. But there are plans to make it fully work on all supported platforms in KFR 6 that will be released soon.

Thank you for clarification. I was misled by this phrase in the changelog: "Allow C API to be built on non-x86 systems".

I'm really looking forward to this opportunity.

XzuluX commented 6 months ago

@dancazarin Is there already a specific schedule for when KFR 6 will be released? I would also like to use the C API on aarch64.

dancazarin commented 6 months ago

KFR 6 prerelease is planned for release in late December/early January. There is a possibility that this feature will be backported to KFR 5.x, then it will be released in coming days.

XzuluX commented 6 months ago

Thank you for the quick response, that sounds promising, and it would be nice if the C API could be compiled on ARM soon.

dancazarin commented 5 months ago

@XzuluX @dubrsl KFR6 preview has been pushed to a separate branch v6. See more https://github.com/kfrlib/kfr/issues/196#issuecomment-1908206393

XzuluX commented 5 months ago

@dancazarin Great, thank's for for the notification!

dancazarin commented 5 months ago

Note: on linux/macOS KFR C API requires passing -DCMAKE_POSITION_INDEPENDENT_CODE=ON to cmake.

dancazarin commented 5 months ago

KFR6 features are now available in main branch. ARM64 support for C API is added too. See documentation for more details.