如何使用NDK交叉编译AArch64架构的FFTW3?

3

我遵循了这篇博客,并成功地将FFTW3交叉编译为ARM v7-A。然而,在尝试AArch64时,我总是在C编译器检查中失败。

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

为什么它要检查 CC = arm-linux-androideabi-gcc 而不是我设置的 $ CC ?这是因为我在配置时误解了 --host 标志吗?我将其设置为 --host = aarch64 。

我尝试设置 --host=aarch64-eabi。它通过了 CC 检查。然后我遇到了另一个错误。aarch64-*-gcc 不接受 -mfpu=neon 标志。我想知道在哪里删除这个标志。 - PhilWong
这是有意义的,尝试使用-mfpu=fp-armv8。您可以将其添加为./configure ... CFLAGS="-mfpu=fp-armv8" - Alex Cohn
@AlexCohn 我收到了“错误:无法识别的命令行选项'-mfpu=fp-armv8'”。 - PhilWong
但是在你的问题中,你设置了CC=arm-linux-androideabi-gcc,然而我期望的是CC=aarch64-linux-android-gcc - Alex Cohn
@AlexCohn,在第一条评论中,我尝试设置--host=aarch64-eabi。这里,CC=aarch64-linux-android-gcc。然后,我经过了CC检查,但我遇到了另一个错误:aarch64-linux-android-gcc没有认识-mfpu=neon。这问题 - PhilWong
当您运行 ./configure ... CFLAGS="-mfpu=fp-armv8" CC=aarch64-linux-android-gcc 时,出现了什么错误? - Alex Cohn
1个回答

1

FFTW3 bug 25可以通过在调用配置脚本时添加命令行参数来解决:

./configure .... NEON_CFLAGS=-D__ARM_NEON__

这是因为检查-mfpu=neon的条件只有在NEON_CFLAGS不为空时才会生效,然后代码期望设置__ARM_NEON__

话虽如此,由于根本没有可用的Aarch64 SIMD支持代码,因此在未来还会遇到其他障碍。所以,在没有支持Aarch64 SIMD的代码之前,在aarch64模式下编译FFTW3是徒劳的 ;)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接