4

I'm trying to compile and install the x264 H.264/AVC encoder. I've got gcc installed. But I get the 'No working C compiler found' error when I run:

./configure --enable-shared --enable-static

What can I do?

The config log said:

/bin/gcc conftest.c  -Wall -I. -I$(SRCPATH) -falign-loops=16 -mdynamic-no-pic -o conftest
clang: error: unknown argument: '-falign-loops=16' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
imdadable
  • 147
  • 1
  • 9
  • Did you try `gcc` at the command-line to see if your gcc is available, e.g., in your path? – Søren Debois Mar 27 '14 at 05:41
  • Yes, it's available. It's in /usr/bin/gcc. – imdadable Mar 27 '14 at 05:46
  • The config.log said : checking for -mdynamic-no-pic... no 2 Failed commandline was: 3 -------------------------------------------------- 4 /usr/bin/gcc conftest.c -Qunused-arguments -Wall -I. -I$(SRCPATH) -falign-lo ops=16 -mdynamic-no-pic -o conftest 5 clang: error: unknown argument: '-falign-loops=16' [-Wunused-command-line-ar gument-hard-error-in-future] 6 clang: note: this will be a hard error (cannot be downgraded to a warning) i n the future – imdadable Mar 27 '14 at 05:57
  • Run: `/usr/bin/gcc --version`; the chances are that it is `clang` in disguise. I get: `Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)`. I tend to use GCC 4.8.2, but I built that for myself. – Jonathan Leffler Mar 27 '14 at 06:30
  • Yes, that is the exact version, Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) that i have. Thanks a lot Jonathan Leffler, I'll follow your link to build GNU GCC. – imdadable Mar 27 '14 at 07:29

2 Answers2

3

I encountered the same error and found a simple solution here: http://www.xin.at/x264/x264-guide-macosx-en.htm

Before actually being able to start the build we will however need to remove a GCC compiler flag from the configure script, that the newer LLVM+CLANG compiler will not be able to handle. For that, please open the file configure in your favorite text editor and look for the following spot:

darwin*) SYS="MACOSX" CFLAGS="$CFLAGS -falign-loops=16"

Replace that with the following, effectively removing the -falign-loops=16 option:

darwin*) SYS="MACOSX" CFLAGS="$CFLAGS"

After doing the above, libx264 builds just fine :)

notnot
  • 31
  • 1
0

The configure script is trying to set a compiler option -falign-loops=16 that the clang compiler (masquerading as gcc) declines to accept.

Either get (compile) your own real GCC and use that (I've done the compilation and installation; it's not very hard, though neither is it trivial), or work out how to stop the configure script from failing simply because it assumes that the -falign-loops=16 option must be supported by all versions of GCC. That is the sort of thing the configure script should be checking so that you don't run into that sort of failure. Ultimately, this is a bug in the configuration for this code.

Community
  • 1
  • 1
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278