将 NDK 与其他构建系统一起使用时出现问题

Problem with using the NDK with other build systems

我正在学习Use the NDK with other build systems。试图让 Autoconf 的示例工作。看起来 ./configure --host $TARGET 正在按预期工作。但是我在执行 make:

时出错
arm/filter_neon.S  -fPIC -DPIC -o arm/.libs/filter_neon.o
arm/filter_neon.S:24:17: error: expected string in directive
.section __LLVM,__asm
                ^
make[1]: *** [Makefile:1187: arm/filter_neon.lo] Error 1

我是 Android 和 Linux 的新手。这是我在 Ubuntu 上使用的 .sh 文件:

#!/bin/bash -v
# Check out the source.
git clone https://github.com/glennrp/libpng
cd libpng
# Only choose one of these, depending on your build machine...
#export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
# Only choose one of these, depending on your device...
#export TARGET=aarch64-linux-android
export TARGET=armv7a-linux-androideabi
#export TARGET=i686-linux-android
#export TARGET=x86_64-linux-android
# Set this to your minSdkVersion.
export API=21
# Configure and build.
export AR=$TOOLCHAIN/bin/$TARGET-ar
export AS=$TOOLCHAIN/bin/$TARGET-as
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/$TARGET-ld
export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib
export STRIP=$TOOLCHAIN/bin/$TARGET-strip
./configure --host $TARGET
make

我做错了什么,为什么教程示例不起作用?提前谢谢你。

libpng 有错误。不要使用来自 github 的克隆。使用发布的版本。 githubhttps://github.com/glennrp/libpng/releases/tag/v1.6.35

上有不同的link

从官方文档更改此脚本,不要克隆 github 存储库,只需下载存档和 运行 里面的这个脚本。

对我来说一切正常。

嗯。这是我的错:)

我添加这个是为了支持使用非 Apple LLVM 启用位码的构建。它在那里有效,但在 Android 上无效。使用@Alexandr Kirilov 建议的版本是一个很好的选择,但这也应该在 libpng 的上游修复。

同样需要__APPLE__守护,见https://github.com/glennrp/libpng/pull/383

不幸的是,当我修补这个时,我只在 macOS/iOS 平台上测试了它,而不是在其他 arm 平台上:(