Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails because of various C++ errors #222

Open
yurivict opened this issue Apr 12, 2024 · 4 comments
Open

Build fails because of various C++ errors #222

yurivict opened this issue Apr 12, 2024 · 4 comments

Comments

@yurivict
Copy link

/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
Copy link
Member

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
Copy link
Author

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
Copy link
Author

KFR_ARCH wasn't supplied externally.

@yurivict
Copy link
Author

yurivict commented May 1, 2024

This breakage only occurs on the i386 architecture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants