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

问题描述

我正在学习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克隆。使用发布的版本。 github https://github.com/glennrp/libpng/releases/tag/v1.6.35

上有不同的链接

从官方文档更改此脚本,不要克隆github repo,只需下载存档并在其中运行该脚本即可。

对我来说一切正常。

,

嗯。这是我的错:)

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

它也需要被__APPLE__守护,见https://github.com/glennrp/libpng/pull/383

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