android - 在 Mac 上编译 x264 : "No working C compiler found" and "arm-linux-androideabi-gcc: command not found"

标签 android gcc android-ndk x264 libx264

我正在尝试为 Android 编译 x264 库,遵循 post .

我已经克隆了 x264 项目 git clone git://git.videolan.org/x264.git 并尝试使用以下配置进行编译:

NDK=~/development/android-ndk-r10c    
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64
PLATFORM=$NDK/platforms/android-21/arch-arm

./configure \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--sysroot=$PLATFORM \
--host=arm-linux \
--enable-pic \
--enable-static \
--disable-cli

问题是我得到一个 No working C compiler found. 错误。

conftest.log 输出:

$ cat conftest.log 
./configure: line 153: arm-linux-androideabi-gcc: command not found

但是 arm-linux-androideabi-gcc 是工具链的 bin 文件夹!!

看这个其他question看起来出于某种原因,即使该文件存在,因为它是 64 位 Mac,它不会执行 arm-linux-androideabi-gcc 文件并将返回这个奇怪的错误和日志。


我使用的是 Mac OS X 10.10,我已经安装了 XCode 命令行工具:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

海湾合作委员会版本:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

谁能告诉我如何解决这个问题?

最佳答案

你不应该设置 --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi-,你应该首先将该目录添加到你的路径,使用 export PATH= $TOOLCHAIN/bin:$PATH,并且仅指定 --cross-prefix=arm-linux-androideabi-(就像您链接到的帖子中一样)。

关于android - 在 Mac 上编译 x264 : "No working C compiler found" and "arm-linux-androideabi-gcc: command not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27198166/

相关文章:

java - 通过 AndroidfromJNI 另一个包加载静态 void C 函数

java - 广播接收器从深度 sleep 中醒来。 (就像,嘿,设备刚刚醒来,这是广播!)

android - AlarmManager 在每个测试设备上的工作方式不同

android.os.FileUriExposeException : file:///storage/emulated/0/test. txt 通过 Intent.getData() 暴露在应用程序之外

代码块不在 linux lite 中编译空 c 文件

c++ - 如何避免cpp给宏参数加空格

Android - MEDIA ERROR UNKNOWN -1 通常意味着什么

android - 如何强制子 PreferenceScreen 包含在 Fragment 布局中 (Android)

Ubuntu 9.10 karmic 中的 gccgo 链接错误?

c++ - 将 libpng 链接到 android 原生项目