Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 420241 - media-libs/x264 doesn't support x32 ABI with asm code
Summary: media-libs/x264 doesn't support x32 ABI with asm code
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: x32
  Show dependency tree
 
Reported: 2012-06-08 13:05 UTC by Xavier Miller (RETIRED)
Modified: 2022-05-02 02:07 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix x32 build with asm (x264-x32.patch,56.01 KB, patch)
2017-03-08 13:42 UTC, Steven Newbury
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier Miller (RETIRED) gentoo-dev 2012-06-08 13:05:11 UTC
Hello,

It seems there need some work on asm-based packages for ABI=x32.

Reproducible: Always
Comment 1 Xavier Miller (RETIRED) gentoo-dev 2012-06-08 13:09:29 UTC
x86_64-gentoo-linux-gnu-gcc -o libx264.so.122  common/mc.o common/predict.o common/pixel.o common/macroblock.o common/frame.o common/dct.o common/cpu.o common/cabac.o common/common.o common/osdep.o common/rectangle.o common/set.o common/quant.o common/deblock.o common/vlc.o common/mvpred.o common/bitstream.o encoder/analyse.o encoder/me.o encoder/ratecontrol.o encoder/set.o encoder/macroblock.o encoder/cabac.o encoder/cavlc.o encoder/encoder.o encoder/lookahead.o common/threadpool.o common/x86/mc-c.o common/x86/predict-c.o common/x86/const-a.o common/x86/cabac-a.o common/x86/dct-a.o common/x86/deblock-a.o common/x86/mc-a.o common/x86/mc-a2.o common/x86/pixel-a.o common/x86/predict-a.o common/x86/quant-a.o common/x86/cpu-a.o common/x86/dct-64.o common/x86/bitstream-a.o common/x86/sad-a.o common/x86/trellis-64.o   -shared -Wl,-soname,libx264.so.122  -Wl,-Bsymbolic -Wl,-O1 -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--as-needed -lm -lpthread
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/const-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/cabac-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/dct-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/deblock-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/mc-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/mc-a2.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/pixel-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/predict-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/quant-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/cpu-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/dct-64.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/bitstream-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/sad-a.o' is incompatible with i386:x64-32 output
/usr/lib/gcc/x86_64-gentoo-linux-gnu/4.7.0/../../../../x86_64-gentoo-linux-gnu/bin/ld: i386:x86-64 architecture of input file `common/x86/trellis-64.o' is incompatible with i386:x64-32 output
collect2: error: ld returned 1 exit status
make: *** [libx264.so.122] Error 1
 * ERROR: media-libs/x264-0.0.20120327 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=media-libs/x264-0.0.20120327'`,
 * the complete build log and the output of `emerge -pqv '=media-libs/x264-0.0.20120327'`.
 * The complete build log is located at '/var/tmp/portage/media-libs/x264-0.0.20120327/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-libs/x264-0.0.20120327/temp/environment'.
 * Working directory: '/var/tmp/portage/media-libs/x264-0.0.20120327/work/x264-snapshot-20120327-2245'
 * S: '/var/tmp/portage/media-libs/x264-0.0.20120327/work/x264-snapshot-20120327-2245'
Comment 2 Sean McGovern 2012-06-08 17:53:02 UTC
I don't think x264 currently supports building with x32 ABI -- most likely this is due to some inline assembly.
Comment 3 Tim Harder gentoo-dev 2012-06-09 08:23:07 UTC
(In reply to comment #2)
> I don't think x264 currently supports building with x32 ABI -- most likely
> this is due to some inline assembly.

Also note that x264 currently hardcodes using yasm and only >=nasm-2.10 supports x32 as of now.
Comment 4 SpanKY gentoo-dev 2012-09-11 07:57:02 UTC
i don't think just adding the elfx32 [yn]asm output format to the configure script would be enough to make it work.  but someone could try :).
Comment 5 SpanKY gentoo-dev 2012-09-25 03:10:59 UTC
i've disabled asm code for x32 abi's.  this at least gets us building & running.

http://sources.gentoo.org/media-libs/x264/x264-0.0.20120707.ebuild?r1=1.2&r2=1.3
http://sources.gentoo.org/media-libs/x264/files/x264-x32.patch?rev=1.1
Comment 6 Alexis Ballier gentoo-dev 2013-08-01 17:01:09 UTC
(In reply to SpanKY from comment #5)
> i've disabled asm code for x32 abi's.  this at least gets us building &
> running.
> 
> http://sources.gentoo.org/media-libs/x264/x264-0.0.20120707.ebuild?r1=1.
> 2&r2=1.3
> http://sources.gentoo.org/media-libs/x264/files/x264-x32.patch?rev=1.1

i've modified a bit the patch, i believe it shouldnt hurt but feel free to revert to the previous behavior if its wrong

more precisely:
-            ASFLAGS="$ASFLAGS -f elf -m amd64"
+            if cpp_check "" "" "__ILP32__" ; then
+                AS="${cross_prefix}as"
+            else
+                ASFLAGS="$ASFLAGS -f elf -m amd64"
+            fi
         fi

became:
-            ASFLAGS="$ASFLAGS -f elf -m amd64"
+            if cpp_check "" "" "__ILP32__" ; then
+                ASFLAGS="$ASFLAGS -f elf -m x32"
+            else
+                ASFLAGS="$ASFLAGS -f elf -m amd64"
+            fi


i think the --disable-asm shouldn't make a difference and the latter is more correct.
Comment 7 Pacho Ramos gentoo-dev 2016-12-05 20:09:04 UTC
is this still valid with x264-0.0.20160712?
Comment 8 Dainius Masiliūnas 2016-12-25 18:03:34 UTC
Yes! libx264 is broken on x32 again, blame:
https://gitweb.gentoo.org/repo/gentoo.git/commit/media-libs/x264?id=a63fbd964af5eaa53a7e8ebf845d532e35de2cff

The reason why it breaks is because it forces -m64, and it must not force that (or force -mx32),
Comment 9 Steven Newbury 2017-03-08 13:42:12 UTC
Created attachment 466324 [details, diff]
Fix x32 build with asm
Comment 10 EoD 2017-11-10 01:52:25 UTC
(In reply to Steven Newbury from comment #9)
> Created attachment 466324 [details, diff] [details, diff]
> Fix x32 build with asm
I would recommend to call it ARCH_X32 (or similar) in order not to confuse the user. The ABI is called X32, not x86_64_32 :)

Apart from that, the patch does not work for me. I get the following error:

> yasm -I. -I../x264-snapshot-20160712-2245 -DARCH_X86_64=1 -I../x264-snapshot-20160712-2245/common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DPIC -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/const-a.o ../x264-snapshot-20160712-2245/common/x86/const-a.asm
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:55: error: undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:179: error: (DECLARE_REG_SIZE:11) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:180: error: (DECLARE_REG_SIZE:11) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:181: error: (DECLARE_REG_SIZE:11) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:182: error: (DECLARE_REG_SIZE:11) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:183: error: (DECLARE_REG_SIZE:11) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:184: error: (DECLARE_REG_SIZE:11) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:185: error: (DECLARE_REG_SIZE:11) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:211: error: undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:922: error: (INIT_XMM:5) undefined symbol `ARCH_X86_64_32' in preprocessor
> ../x264-snapshot-20160712-2245/common/x86/x86inc.asm:1526: error: undefined symbol `ARCH_X86_64_32' in preprocessor
> make: *** [Makefile:213: common/x86/const-a.o] Error 1
> make: *** Waiting for unfinished jobs....

Did you try suggesting this patch upstream? Maybe they have some more suggestions/improvements to get it upstream. Otherwise this will be a never-ending goose chase here.