PhilWong
PhilWong

Reputation: 31

How to cross compile FFTW3 for AArch64 (with NDK)?

I have followed this blog and I did succeed in cross compiling FFTW3 for ARM v7-A. However, when it came to AArch64, I always failed in C compiler check.

running CONFIG_SHELL=/bin/bash /bin/bash ./configure --disable-shared

--enable-maintainer-mode  --host=arm-eabi --enable-single --enable-neon host_alias=arm-eabi CC=arm-linux-androideabi-gcc -O2 -march=armv7-a -mfpu=neon -mfloat-abi=softfp --sysroot=$NDK_ROOT/platforms/android-L/arch-arm/ -fPIE -pie -lm --no-create --no-recursion configure: WARNING: if you wanted to set the --build type, don't use --host.

    If a cross compiler is detected then cross compile mode will be used checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes checking for

arm-eabi-strip... arm-linux-androideabi-strip checking for a

thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk

checking whether make sets $(MAKE)... yes checking whether to enable

maintainer-specific portions of Makefiles... yes checking build system

type... x86_64-unknown-linux-gnu checking host system type...

arm-unknown-eabi checking for arm-eabi-gcc...

arm-linux-androideabi-gcc -O2 -march=armv7-a -mfpu=neon

-mfloat-abi=softfp --sysroot=$NDK_ROOT/platforms/android-L/arch-arm/ -fPIE -pie -lm checking whether the C compiler works... no configure: error: in `$FFTW_ROOT': configure: error: C compiler cannot create

executables

Why did it check CC=arm-linux-androideabi-gcc instead of $CC I have set? Is it because I misunderstood --host flag in configure? I set it to --host=aarch64

Upvotes: 3

Views: 2757

Answers (1)

cJ Zougloub
cJ Zougloub

Reputation: 1494

FFTW3 bug 25 can be worked around by adding a command-line argument to the configure script call:

./configure .... NEON_CFLAGS=-D__ARM_NEON__

This is because the condition that checks for -mfpu=neon is only if NEON_CFLAGS is not empty, and then code expects __ARM_NEON__ to be set.

That said, there are other blockers down the road, because there is simply no Aarch64 SIMD support code available. So, until there is, compiling FFTW3 in aarch64 mode is futile ;)

Upvotes: 1

Related Questions