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 fails because of various C++ errors #222

Open yurivict opened 3 months ago

yurivict commented 3 months ago
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:51:31: error: cannot define or redeclare 'init' here because namespace 'impl' does not enclose namespace 'samplerate_converter'
void samplerate_converter<T>::init(sample_rate_conversion_quality quality, itype interpolation_factor,
     ~~~~~~~~~~~~~~~~~~~~~~~~~^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:54:5: error: invalid use of 'this' outside of a non-static member function
    this->kaiser_beta     = this->window_param(quality);
    ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:54:29: error: invalid use of 'this' outside of a non-static member function
    this->kaiser_beta     = this->window_param(quality);
                            ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:54:48: error: use of undeclared identifier 'quality'
    this->kaiser_beta     = this->window_param(quality);
                                               ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:55:5: error: invalid use of 'this' outside of a non-static member function
    this->depth           = static_cast<itype>(this->filter_order(quality));
    ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:55:48: error: invalid use of 'this' outside of a non-static member function
    this->depth           = static_cast<itype>(this->filter_order(quality));
                                               ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:55:67: error: use of undeclared identifier 'quality'
    this->depth           = static_cast<itype>(this->filter_order(quality));
                                                                  ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:56:5: error: invalid use of 'this' outside of a non-static member function
    this->input_position  = 0;
    ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:57:5: error: invalid use of 'this' outside of a non-static member function
    this->output_position = 0;
    ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:59:25: error: use of undeclared identifier 'interpolation_factor'
    const i64 gcf = gcd(interpolation_factor, decimation_factor);
                        ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:59:47: error: use of undeclared identifier 'decimation_factor'
    const i64 gcf = gcd(interpolation_factor, decimation_factor);
                                              ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:60:5: error: use of undeclared identifier 'interpolation_factor'
    interpolation_factor /= gcf;
    ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:61:5: error: use of undeclared identifier 'decimation_factor'
    decimation_factor /= gcf;
    ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:63:5: error: invalid use of 'this' outside of a non-static member function
    this->taps  = this->depth * interpolation_factor;
    ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:63:19: error: invalid use of 'this' outside of a non-static member function
    this->taps  = this->depth * interpolation_factor;
                  ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:63:33: error: use of undeclared identifier 'interpolation_factor'
    this->taps  = this->depth * interpolation_factor;
                                ^
/wrkdirs/usr/ports/math/kfr/work/kfr-6.0.2/src/dsp/sample_rate_conversion.cpp:64:5: error: invalid use of 'this' outside of a non-static member function
    this->order = size_t(this->depth * interpolation_factor - 1);
    ^

log

Version: 6.0.2 clang-17 FreeBSD 14.0

dancazarin commented 3 months ago

KFR mentioned in its log that KFR_ARCH cmake flag was set to neon (ARM).

-- Default CPU architecture for KFR is neon (set by KFR_ARCH)

But earlier it's mentioned:

building for: FreeBSD 140i386-default-job-01 14.0-RELEASE-p6 FreeBSD 14.0-RELEASE-p6 i386

So the reason is architecture mismatch: building for x86 while explicitly setting the architecture to neon (ARM).

Please attach the full cmake command line, it's not in the logs you attached.

You can omit KFR_ARCH flag and let KFR decide the minimal ISA for architecture (SSE2 for x86 and NEON for ARM/ARM64)

yurivict commented 3 months ago

cmake arguments are: -DCMAKE_C_COMPILER:STRING="cc" -DCMAKE_CXX_COMPILER:STRING="c++" -DCMAKE_C_FLAGS:STRING="-O2 -pipe -fno-strict-aliasing " -DCMAKE_C_FLAGS_DEBUG:STRING="-O2 -pipe -fno-strict-aliasing " -DCMAKE_C_FLAGS_RELEASE:STRING="-O2 -pipe -fno-strict-aliasing -DNDEBUG" -DCMAKE_CXX_FLAGS:STRING="-O2 -pipe -fno-strict-aliasing " -DCMAKE_CXX_FLAGS_DEBUG:STRING="-O2 -pipe -fno-strict-aliasing " -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O2 -pipe -fno-strict-aliasing -DNDEBUG" -DCMAKE_EXE_LINKER_FLAGS:STRING=" " -DCMAKE_MODULE_LINKER_FLAGS:STRING=" " -DCMAKE_SHARED_LINKER_FLAGS:STRING=" " -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" -DCMAKE_BUILD_TYPE:STRING="Release" -DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=YES -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DFETCHCONTENT_FULLY_DISCONNECTED:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -GNinja

yurivict commented 3 months ago

KFR_ARCH wasn't supplied externally.

yurivict commented 2 months ago

This breakage only occurs on the i386 architecture.