简体   繁体   English

为Android 64位架构编译Speex和SpeexDSP会导致“错误:'asm'中的不可能约束”

[英]Compiling Speex and SpeexDSP for Android 64bit architectures results in “error: impossible constraint in 'asm'”

Google recently announced policy requiring support libraries be recompiled for 64bit support so I'm hoping someone else has also been down this road recently. Google最近宣布了一项政策,要求重新编译支持库以获得64位支持,因此我希望其他人最近也走这条路。

I'm trying to compile Speex 1.2 for Android 64bit ARM. 我正在尝试为Android 64位ARM编译Speex 1.2。 I was able to build speex but speexdsp fails. 我能够构建speex,但speexdsp失败。

Here are the steps I took, followed by the failure: 这是我采取的步骤,其次是失败:

  1. Created a standalone toolchain: 创建了一个独立的工具链:

     ~/android-ndk-r17/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=~/speex-toolchain --arch=arm64 
  2. Set my PATH to look first in the toolchain's bin directory 将我的PATH设置为在工具链的bin目录中优先显示

     export PATH=~/speex-toolchain/bin:$PATH 
  3. Set the CC and RANLIB env vars (maybe not necessary?) 设置CCRANLIB env vars(也许不需要?)

     export CC=aarch64-linux-android-gcc export RANLIB=aarch64-linux-android-ranlib 
  4. ./configure --host=arm
  5. make

Make fails with: 制作失败,原因:

make  all-recursive
make[1]: Entering directory `/Users/spartygw/Downloads/speexdsp-1.2rc3'
Making all in libspeexdsp
make[2]: Entering directory `/Users/spartygw/Downloads/speexdsp-1.2rc3/libspeexdsp'
  CC       preprocess.lo
  CC       jitter.lo
  CC       mdf.lo
  CC       fftwrap.lo
  CC       filterbank.lo
  CC       resample.lo
In file included from resample.c:104:0:
resample.c: In function 'resampler_basic_direct_single':
resample_neon.h:148:5: error: impossible constraint in 'asm'
     asm volatile ("  cmp %[len], #0\n"
     ^
make[2]: *** [resample.lo] Error 1
make[2]: Leaving directory `/Users/spartygw/Downloads/speexdsp-1.2rc3/libspeexdsp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/Users/spartygw/Downloads/speexdsp-1.2rc3'
make: *** [all] Error 2

Instead of steps 3 and 4, I would suggest just doing ./configure --host=aarch64-linux-android , which takes care of picking up the right tools, and which gets the target architecture right. 除了建议执行第3步和第4步之外,我建议仅执行./configure --host=aarch64-linux-android ,它负责选择正确的工具,并且可以使目标体系结构正确。

As for the main issue, the compilation error, the issue seems to be that speexdsp does support NEON (ARM's SIMD instruction set), but it detects it in configure in one way (by testing if #include <arm_neon.h> works and if NEON compiler intrinsics work, which work the same for both ARM and AArch64). 对于主要问题,即编译错误,问题似乎是speexdsp确实支持NEON(ARM的SIMD指令集),但是它以一种方式(通过测试#include <arm_neon.h>有效以及是否通过配置)对其进行检测。 NEON编译器内部函数起作用,这对于ARM和AArch64都起作用。 Once it concluded that NEON is supported, it goes on to use it via inline assembly (which is different for ARM and AArch64). 一旦确定支持NEON,便可以通过内联汇编继续使用它(ARM和AArch64有所不同)。

So the conclusion is that speexdsp only supports NEON on ARM (32 bit), not on 64 bit, but speexdsp's configure script enables it incorrectly for AArch64 as well. 因此得出的结论是,speexdsp仅在ARM(32位)上支持NEON,而不在64位上支持,但speexdsp的configure脚本也将其错误地用于AArch64。 Add --disable-neon to the configure call, and compilation should succeed. --disable-neon添加到configure调用中,编译应该会成功。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM