Compiling x264 on a Mac: "No working C compiler found" and "arm-linux-androideabi-gcc: command not found"

6k views Asked by At

I am trying to compile the x264 library for Android, following this post.

I have cloned the x264 project git clone git://git.videolan.org/x264.git and tried to compile with the following configuration:

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

The problem is that I get a No working C compiler found. error.

The conftest.log output:

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

But the arm-linux-androideabi-gcc is the toolchain's bin folder!!

Looking at this other question it looks like for some reason, even though the file exists, since it is a 64bit Mac, it won't execute the arm-linux-androideabi-gcc file and will return this weird error and log.


I am in a Mac OS X 10.10 and I have installed the XCode Command Line Tools:

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

GCC version:

$ 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

Can anyone tell me how to fix this please?

1

There are 1 answers

3
mstorsjo On BEST ANSWER

You shouldn't set --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi-, you should add that directory to your path first, using export PATH=$TOOLCHAIN/bin:$PATH, and only specify --cross-prefix=arm-linux-androideabi- (just as in the post you linked to).