-
Notifications
You must be signed in to change notification settings - Fork 256
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
Unable to properly link kfr_dft #202
Comments
You have compiled and installed kfr successfully but cannot link it to an external project, right? Could you try to add this include before any other includes in the source file where you use kfr functions.
Also please provide more information about your environment. KFR 6 ( #196 ) will include prebuilt binaries ready for using with Windows, linux and macOS. This will also include Clang-compiled DFT for multiple architectures (selected at runtime). |
I have tried including kfr/config.h as you requested. No changes. My config.h file contains only
Yes the installation succeded without any problems. Here is my CMakeCache.txt
This is on Fedora 39, x86_64
same result. but I'm not that versed with CMake I maybe made a mistake somewhere. |
Just to test this out, I have tried also compiling KFR with Clang and then linking it with GCC, same result. I'll wait for KFR 6 and try again. |
Linking GCC-compiled and Clang-compiled static libraries is perfectly fine as long as the both libraries have been built using the same C++ library (GCC's libstdc++ for Linux). As for linking ussue in KFR. 1. Single architectureUse -DKFR_ARCH=avx2 (or avx or sse41 or even sse2) when you run CMake to install KFR.
The same architecture should be used when building your source files:
Then linking works well and KFR will use avx2 instructions for both DFT and other functions (built in your code). Code from
2. Multiple architectures.First please update KFR using dev branch for small GCC compatibility fix. Setting
Then you can compile your code using any architecture settings but should link all KFR DFT libraries:
(Update: whole-archive flag is needed to link inline and template functions with correct architecture) KFR code will detect cpu at runtime and select appropriate code path for DFT. Code from
Notice that first mentioned architecture is sse2 (architecture used for Hope this helps and let me know you have more questions. |
@Zaraka DFT should be compiled using Clang anyway because the code that GCC generates for DFT is much slower. DFT performance comparison published for KFR was made using Clang and only with Clang we guarantee best performance. This won't affect your workflow because Clang should be used only for building static libraries. After building KFR libraries you are free to use any compiler and all should work ok. The issue you mentioned could be easily fixed by specifying correct flags right now in KFR 5. |
@Zaraka Is your problem resolved with the instructions above? If yes, I'll close the issue here. |
I'm sorry for the late answer I was very overburdened with other work. |
For Windows build instructions are similar but below are exact commands. 1. Single architecture (simpler setup)
Then, the following compile options must be added (through VS Project Properties or CMake target_compile_options)
As always 2. Multiple architectures (best performance)
|
I followed the instructions as requested and got everything in working order. Thank you very much for your help, I would strongly suggest writing this kind of information into ReadMe.md or Installation.md as I was previously unable to find this exact information anywhere in Documentation. |
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
It does not compile and crash on the error
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
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
The text was updated successfully, but these errors were encountered: