Opened 6 years ago

Closed 6 years ago

#4599 closed defect (needs_more_info)

failure to build with LLVM on OpenBSD / i386

Reported by: Brad Smith Owned by:
Priority: normal Component: postproc
Version: git-master Keywords:
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Trying to build FFmpeg 2.6.2 on OpenBSD / i386 with LLVM 3.5 fails like so...

cc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -O2 -pipe  -I/usr/local/include -I/usr/X11R6/include -std=c99 -fomit-frame-pointer -fPIC -pthread -I/usr/local/include -I/
usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/include -I/usr/local/include/fribidi -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/include -I/usr/X11R6/include/freetype2 -I/usr/local/include -I/usr/local/include
/fribidi -I/usr/local/include/opus -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/X11R6/include -DXTHREADS -I/usr/X11R6/include -I/usr/X11R6/include -I/usr
/X11R6/include -I/usr/X11R6/include -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototype
s -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O2 -pipe -Wno-redundant-decls -fno-math-errno -fno-signed-zeros -Qunused-arguments -Werror=implicit-function-declaration -Werror=missing-prototyp
es -Werror=return-type  -MMD -MF libpostproc/postprocess.d -MT libpostproc/postprocess.o -c -o libpostproc/postprocess.o libpostproc/postprocess.c
libpostproc/postprocess.c:173:20: warning: unused function 'prefetchnta' [-Wunused-function]
static inline void prefetchnta(const void *p)
                   ^
libpostproc/postprocess.c:180:20: warning: unused function 'prefetcht0' [-Wunused-function]
static inline void prefetcht0(const void *p)
                   ^
libpostproc/postprocess.c:187:20: warning: unused function 'prefetcht1' [-Wunused-function]
static inline void prefetcht1(const void *p)
                   ^
libpostproc/postprocess.c:194:20: warning: unused function 'prefetcht2' [-Wunused-function]
static inline void prefetcht2(const void *p)
                   ^
In file included from libpostproc/postprocess.c:575:
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
        "lea (%0, %1), %%"REG_a"                \n\t"
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:3517:17: error: inline assembly requires more registers than available
                "mov %4, %%"REG_a"              \n\t"
                ^
libpostproc/postprocess_template.c:3381:17: error: inline assembly requires more registers than available
                "mov %4, %%"REG_a"              \n\t"
                ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^
libpostproc/postprocess_template.c:3185:9: error: inline assembly requires more registers than available
        "lea (%0,%2), %%"REG_a"                 \n\t"
        ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^
libpostproc/postprocess_template.c:3185:9: error: inline assembly requires more registers than available
        "lea (%0,%2), %%"REG_a"                 \n\t"
        ^
In file included from libpostproc/postprocess.c:571:
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
        "lea (%0, %1), %%"REG_a"                \n\t"
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:3517:17: error: inline assembly requires more registers than available
                "mov %4, %%"REG_a"              \n\t"
                ^
libpostproc/postprocess_template.c:3381:17: error: inline assembly requires more registers than available
                "mov %4, %%"REG_a"              \n\t"
                ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^
libpostproc/postprocess_template.c:3185:9: error: inline assembly requires more registers than available
        "lea (%0,%2), %%"REG_a"                 \n\t"
        ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 warnings and 20 errors generated.

Change History (17)

comment:1 by Carl Eugen Hoyos, 6 years ago

Please provide your configure line and please test current FFmpeg git head.

comment:2 by Brad Smith, 6 years ago

The configure args used are..

--enable-libx265 --enable-shared  --arch=i386  --cc=clang  --disable-altivec  --disable-armv5te  --disable-armv6  --disable-armv6t2  --disable-debug  --disable-iconv  --disable-indev=jack  --disable-indev=oss  --disable-lzma  --disable-mipsdspr1  --disable-mipsdspr2  --disable-neon  --disable-outdev=oss  --disable-outdev=sdl  --disable-vfp  --enable-avresample  --enable-fontconfig  --enable-gpl  --enable-libass  --enable-libfreetype  --enable-libfribidi  --enable-libgsm  --enable-libmp3lame  --enable-libopus  --enable-libspeex  --enable-libvorbis  --enable-libvpx  --enable-libx264  --enable-libxvid  --extra-cflags="-I/usr/local/include -I/usr/X11R6/include"  --extra-libs="-L/usr/local/lib -L/usr/X11R6/lib"  --mandir=/usr/local/man  --optflags="-O2 -pipe   -Wno-redundant-decls"

A build from latest source..

$ gmake 
CC      libpostproc/postprocess.o
In file included from libpostproc/postprocess.c:544:
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
        "lea (%0, %1), %%"REG_a"                \n\t"
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
libpostproc/postprocess_template.c:3185:9: error: inline assembly requires more registers than available
        "lea (%0,%2), %%"REG_a"                 \n\t"
        ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^
libpostproc/postprocess_template.c:3185:9: error: inline assembly requires more registers than available
        "lea (%0,%2), %%"REG_a"                 \n\t"
        ^
In file included from libpostproc/postprocess.c:540:
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
        "lea (%0, %1), %%"REG_a"                \n\t"
        ^
libpostproc/postprocess_template.c:1674:9: error: inline assembly requires more registers than available
libpostproc/postprocess_template.c:3185:9: error: inline assembly requires more registers than available
        "lea (%0,%2), %%"REG_a"                 \n\t"
        ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^
libpostproc/postprocess_template.c:2169:9: error: inline assembly requires more registers than available
        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
        ^
libpostproc/postprocess_template.c:3102:9: error: inline assembly requires more registers than available
        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
        ^

comment:3 by Carl Eugen Hoyos, 6 years ago

Does the following succeed compilation (is this the only issue)?

$ ./configure --enable-gpl --cc=clang --disable-postproc && make

And please confirm (no need to post output again) that the following fails:

$ ./configure --enable-gpl --cc=clang && make libpostproc/postprocess.o

Is your problem also reproducible with version a19bcf4e?

comment:4 by Carl Eugen Hoyos, 6 years ago

Version: 2.6.3git-master

comment:5 by Carl Eugen Hoyos, 6 years ago

Possibly related to ticket #4474 - does compilation of libavfilter/x86/vf_noise.o succeed?

comment:6 by Brad Smith, 6 years ago

No, this is not the only issue. There was one or two other files that did not build.

With libpostproc disabled the build completes. With libpostproc enabled and just building that one object it fails.

It looks like a19bcf4e was commited quite some time ago and is included with 2.3 or newer so it is included with 2.6.x.

comment:7 by Brad Smith, 6 years ago

libavfilter/x86/vf_noise.o builds Ok.

comment:8 by Brad Smith, 6 years ago

Hrmm. I was wrong when I said there were other files. I was almost certain there was but checking back with my ports build I don't see any other files failing to build other than the libpostproc code.

Last edited 6 years ago by Brad Smith (previous) (diff)

comment:9 by Carl Eugen Hoyos, 6 years ago

Did you test if the issue is reproducible with a19bcf4e?

comment:10 by Brad Smith, 6 years ago

After looking at ticket #4474 I compared the detected availability of EBP / EBX with the system GCC 4.2.1 vs LLVM I see that EBX is no for GCC and yes for LLVM.

If I disable EBX after configure runs with LLVM then libpostproc builds.

comment:11 by Michael Niedermayer, 6 years ago

clang-3.5 works fine on linux building x86 32bit shared libs, with both EBX and EBP enabled

comment:12 by Michael Niedermayer, 6 years ago

Cc: Michael Niedermayer added

maybe something like this would workaround this compiler issue:
could you test and amend if it doesnt work?

diff --git a/configure b/configure
index 1cd9fd6..82cde9d 100755
--- a/configure
+++ b/configure
@@ -5597,6 +5597,7 @@ elif enabled clang; then
     check_cflags -Werror=implicit-function-declaration
     check_cflags -Werror=missing-prototypes
     check_cflags -Werror=return-type
+    enabled x86_32 && enabled shared && [ $target_os == openbsd ] && disable ebx_available
 elif enabled cparser; then
     add_cflags -Wno-missing-variable-declarations
     add_cflags -Wno-empty-statement

comment:13 by Brad Smith, 6 years ago

Comparing Clang on Linux to OpenBSD is not an apples to apples comparison. OpenBSD uses PIE (everywhere), Linux does not. So the Linux Clang is just not exposing this issue.

in reply to:  10 comment:14 by Carl Eugen Hoyos, 6 years ago

Replying to brad:

After looking at ticket #4474 I compared the detected availability of EBP / EBX with the system GCC 4.2.1 vs LLVM I see that EBX is no for GCC and yes for LLVM.

If I disable EBX after configure runs with LLVM then libpostproc builds.

Does this mean the current test for EBX availability in configure fails for LLVM on OpenBSD?

comment:15 by Brad Smith, 6 years ago

That is what it sounds like to me. With the system GCC 4.2.1 the EBX test shows no, with LLVM/Clang it shows as yes. I would be willing to test anything you want if you happen to have any ideas.

comment:16 by Michael Niedermayer, 6 years ago

comment:17 by Michael Niedermayer, 6 years ago

Resolution: needs_more_info
Status: newclosed

closing this as none of the affected people care enough to reply for 5 months, please reopen if you can test the suggested patch or have a better / different patch

Note: See TracTickets for help on using tickets.