5

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?

Community
  • 1
  • 1
Xavi Gil
  • 11,460
  • 4
  • 56
  • 71

1 Answers1

5

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).

mstorsjo
  • 12,983
  • 2
  • 39
  • 62
  • I have tried what you suggest, but it doesn't make any difference. – Xavi Gil Nov 29 '14 at 21:13
  • Ah, because you're setting the toolchain path containing `linux-x86_64` while you're on OS X. Check that the path you're setting in $TOOLCHAIN actually exists - in your case you probably should replace `linux-x86_64` with `darwin-x86_64`. – mstorsjo Nov 29 '14 at 21:16
  • This helped me. I had to check the architecture and platform being referenced by the build script actually existed in the location being referenced. Some small tweaks and the build completed successfully. – speedynomads Aug 19 '15 at 16:03