Hello, It seems there need some work on asm-based packages for ABI=x32. Reproducible: Always
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'
I don't think x264 currently supports building with x32 ABI -- most likely this is due to some inline assembly.
(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.
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 :).
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
(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.
is this still valid with x264-0.0.20160712?
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),
Created attachment 466324 [details, diff] Fix x32 build with asm
(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.