FFTW / fftw3

DO NOT CHECK OUT THESE FILES FROM GITHUB UNLESS YOU KNOW WHAT YOU ARE DOING. (See below.)
GNU General Public License v2.0
2.75k stars 666 forks source link

FFTW threads: ld: error: undefined symbol: fftwf_threads_set_callback #347

Open fjrdev opened 9 months ago

fjrdev commented 9 months ago

I want to use FFTW for an Android NDK project. Therefore I build with the following flags

./configure --host=aarch64-none-linux-android33 --enable-threads --enable-float sudo make sudo make install

After linking the library with: -L/path/to/fftwf/.libs/ -lfftw3f_threads -lfftw3f -lm, I get the following linking error when compiling: ld: error: undefined symbol: fftwf_threads_set_callback.

Is there anything else I have to consider when cross-compiling on MacOS for aarch64 android? I could not find anything in the documentation regarding this.

stevengj commented 9 months ago

If I recall correctly, the library isn't renamed to libfftw3f until it is installed?

Generally you should do a make install (set the --prefix to some local directory if you don't want to install systemwide) rather than trying to link into the .libs directory.

fjrdev commented 9 months ago

@stevengj Thanks for your help! I cross-compiled the library on a silicon mac for armv8a. So the library is already named libfftw3f.a when I push it onto the android device. I get the error when I link .lib inside the NDK application (in build.gradle).

The error occurs in tests/fftw-bench.c:

ld: error: undefined symbol: fftwf_threads_set_callback
>>> referenced by fftw-bench.c:101   (/path/to/fftwf_3.3.10/tests/fftw-bench.c:101)
>>>               fftwf_3.3.10/CMakeFiles/bench.dir/tests/fftw-bench.c.o:(useropt)

It seems like fftwf_threads_set_callback the first call to a thread-related function in fftw-bench.c, so I assumed it might be my build-process that resulted in this error.

rdolbeau commented 4 months ago

You may first want to check if the symbol is in the library or not (e.g. using 'nm'). If it isn't (or under the wrong prefix) it's a build problem. If it is, then it might just be a link command issue, and for static library sometimes changing the order help (i.e. put fftw3f before fftw3f_threads)