Opened 11 years ago
Closed 11 years ago
#2659 closed defect (worksforme)
Compiling for i386 on 64bit OSX is hard
Reported by: | Hendrik Schreiber | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | build system |
Version: | git-master | Keywords: | i386 OSX |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When building on OS X 10.7.5 (64bit), it is hard to build a small or shared 32bit version.
How to reproduce:
Specifying --arch=i386
has no effect, as configure
differentiates between 32 and 64 bit by compiling some code.
Forcing 32bit via --cc="clang -m32"
works, but then the flag --enable-small
leads to a compilation error:
CC libavcodec/h264_cabac.o In file included from libavcodec/h264_cabac.c:43: libavcodec/x86/h264_i386.h:137:9: error: ran out of registers during register allocation "mov %1, %6 \n\t"
Since the failing code is assembler, specifying --disable-asm
avoids the failure.
What if we use gcc instead of clang? Well, that works partially. I.e. it does not work with shared libs enabled:
--enable-small --enable-shared --disable-static --arch=i386 --cc="gcc -m32"
again leads to
CC libavcodec/h264_cabac.o cc1: error in backend: Ran out of registers during register allocation! make: *** [libavcodec/h264_cabac.o] Error 1
$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
$ clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
Change History (5)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Do I understand correctly that only building with --enable-small
is "hard", --enable-shared
(alone) works fine?
comment:3 by , 11 years ago
Sorry for being unclear.
The answer is: No. It depends on the used compiler.
./configure --enable-shared --disable-static --arch=i386 --cc="gcc -m32"
also leads to
CC libavcodec/h264_cabac.o cc1: error in backend: Ran out of registers during register allocation! make: *** [libavcodec/h264_cabac.o] Error 1
./configure --enable-shared --disable-static --arch=i386 --cc="clang -m32"
works.
But
./configure --enable-shared --disable-static --arch=i386 --cc="clang -m32" --enable-small
leads to
CC libavcodec/h264_cabac.o In file included from libavcodec/h264_cabac.c:43: libavcodec/x86/h264_i386.h:137:9: error: ran out of registers during register allocation "mov %1, %6 \n\t" ^
But in any case, whoever attempts to build ffmpeg for i386 on OSX has to know, that --arch=i386
is ignored. AFAIK, this is not documented anywhere that's easily accessible. And probably it shouldn't be ignored to begin with.
One apparently has to specify --cc
somehow to get this to build for i386 at all.
And when you do, some things still don't work. That's what makes it hard, as in: it takes a few hours to achieve a working result.
Thank you for looking into this.
comment:4 by , 11 years ago
Is this still reproduceable ? (there was a change in the cabac asm code since then)
if it still happens maybe another function has to be added under #if BROKEN_COMPILER
comment:5 by , 11 years ago
Keywords: | Darwin removed |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
I tested the following configure lines successfully:
$ ./configure --enable-small --cc='cc -m32' $ ./configure --enable-shared --disable-static --cc='cc -m32' $ ./configure --enable-shared --disable-static --enable-small --cc='cc -m32'
The used compiler was:
$ cc -v Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn) Target: x86_64-apple-darwin12.5.0 Thread model: posix
It looks like the issue has been discussed before in https://lists.ffmpeg.org/pipermail/ffmpeg-user/2012-June/006886.html - but, given that the discussion is old, the issue has not been fixed, yet.