Skip to content

Unable to properly link kfr_dft #202

Closed
@Zaraka

Description

@Zaraka

While evaluating this library I ran into an odd issue.
I have compiled the kfr library with DFT, tests, and examples enabled. All Tests and examples work great. I then proceed to install the kfr library as normal, resulting in kfr_dft.a and kfr_io.a in my local/lib folder.

But If I try to copy/paste dft example into my separate qmake/cmake project and then linking the library as normal like this

target_link_libraries(apptestKFR
    PRIVATE Qt6::Quick
    kfr_dft
)

It does not compile and crash on the error

/usr/bin/ld: CMakeFiles/apptestKFR.dir/main.cpp.o: in function `kfr::dft_plan<double>::dft_plan(kfr::cpu_t, unsigned long, kfr::dft_order)':
/usr/local/include/kfr/dft/fft.hpp:166: undefined reference to `void kfr::sse2::dft_initialize<double>(kfr::dft_plan<double>&)'
collect2: error: ld returned 1 exit status

While digging in the fft.htpp I noticed KFR_DFT_MULTI macro which was not defined anywhere. So I just try to define it before including

#define KFR_DFT_MULTI
#include <kfr/base.hpp>
#include <kfr/dft.hpp>
#include <kfr/dsp.hpp>
#include <kfr/io.hpp>

and the binary started successfully linking against kfr_dft but dft example still does not work, because dft_plan is not properly initialized and it crashes on execute. Backtrace here

I seriously do not understand whether I compiled or installed kfr incorrectly. Would appreciate any help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions