Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 490276 - =media-libs/x264-0.0.20130912 with =sys-devel/gcc-4.8.1-r1 - error: 'asm' operand has impossible constraints
Summary: =media-libs/x264-0.0.20130912 with =sys-devel/gcc-4.8.1-r1 - error: 'asm' ope...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: media-video herd
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-11-03 14:53 UTC by tka
Modified: 2020-09-08 22:46 UTC (History)
6 users (show)

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


Attachments
The complete build.log. (build.log,31.82 KB, text/plain)
2013-11-03 14:54 UTC, tka
Details
Patch register spilling mvc_max when x264_ultrahardened is defined (x264_allow_stack_check.patch,2.69 KB, patch)
2013-11-03 19:43 UTC, Francisco Blas Izquierdo Riera
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tka 2013-11-03 14:53:05 UTC
On my x86 system, trying to build x264-0.0.20130912 with gcc-4.8.1-r1 fails with "error: 'asm' operand has impossible constraints." However, gcc-4.7.3-r1 builds x264 without error.

On my amd64 system, gcc-4.8.1-r1 buils x264 without error. Thus, the problem seems to be x86 specific.

i686-pc-linux-gnu-gcc -Wshadow -O3 -ffast-math -march=native -mtune=native -O2 -fomit-frame-pointer -pipe -msse -mfpmath=sse -Wall -I. -I/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245 -std=gnu99 -mpreferred-stack-boundary=5 -fPIC -fno-tree-vectorize   -c -o encoder/me.o /var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/encoder/me.c
In file included from /var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/common.h:117:0,
                 from /var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/encoder/me.c:28:
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/encoder/me.c: In function 'x264_me_search_ref':
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/osdep.h:259:13: error: 'asm' operand has impossible constraints
 #define asm __asm__
             ^
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h:130:5: note: in expansion of macro 'asm'
     asm(
     ^
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/osdep.h:259:13: error: 'asm' operand has impossible constraints
 #define asm __asm__
             ^
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h:193:5: note: in expansion of macro 'asm'
     asm(
     ^
make: *** [encoder/me.o] Error 1
 * ERROR: media-libs/x264-0.0.20130912::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=media-libs/x264-0.0.20130912::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-libs/x264-0.0.20130912::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-libs/x264-0.0.20130912/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-libs/x264-0.0.20130912/temp/environment'.
 * Working directory: '/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245-default'
 * S: '/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245'

>>> Failed to emerge media-libs/x264-0.0.20130912, Log file:

>>>  '/var/tmp/portage/media-libs/x264-0.0.20130912/temp/build.log'


Reproducible: Always

Steps to Reproduce:
1. emerge x264

Actual Results:  
emerge fails with "error: 'asm' operand has impossible constraints."


Expected Results:  
emerge succeeds.

# emerge --info =media-libs/x264-0.0.20130912
Portage 2.2.7 (hardened/linux/x86, gcc-4.8.1, glibc-2.17, 3.11.6 i686)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.11.6-i686-Intel-R-_Pentium-R-_4_CPU_2.80GHz-with-gentoo-2.2
KiB Mem:     2039528 total,    730336 free
KiB Swap:   16777212 total,  16777212 free
Timestamp of tree: Sun, 03 Nov 2013 11:30:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.5-r4, 3.2.5-r3, 3.3.2-r2
dev-util/cmake:           2.8.12
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.14
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1, 4.8.1-r1
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.11 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo local
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -mtune=native -O2 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n --with-bdeps=y"
FCFLAGS="-march=i686 -O2 -pipe"
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=i686 -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 acl acpi alsa berkdb bzip2 cairo caps cdda cddb cdparanoia cli cracklib crypt cxx dbus dri dts dvd fam ffmpeg fftw flac fontconfig gdbm gif gimp gmp gnutls gtk hardened iconv icu idn ipv6 java jpeg lame lcms libnotify mad matroska mmap mmx modules mp3 mpeg mudflap ncurses nptl ogg opengl openmp pam pax_kernel pcre pic png policykit ppds readline sasl sdl session sse sse2 ssl startup-notification svg tcpd theora threads tiff truetype udev unicode vorbis x264 x86 xattr xcb xml xv xvid zlib" ABI_X86="32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2 python3_3" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="i915 intel" XFCE_PLUGINS="logout menu trash" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.2 3.3"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

media-libs/x264-0.0.20130912 was built with the following:
USE="interlaced pic sse threads -10bit -static-libs"
CFLAGS="-march=native -mtune=native -O2 -fomit-frame-pointer -pipe -msse -mfpmath=sse"
CXXFLAGS="-march=native -mtune=native -O2 -fomit-frame-pointer -pipe -msse -mfpmath=sse"
Comment 1 tka 2013-11-03 14:54:17 UTC
Created attachment 362488 [details]
The complete build.log.
Comment 2 Francisco Blas Izquierdo Riera gentoo-dev 2013-11-03 19:43:30 UTC
Created attachment 362502 [details, diff]
Patch register spilling mvc_max when x264_ultrahardened is defined

Try to compile with the attached patch and adding -Dx264_ultrahardened to your CFLAGS then please do test the library by encoding and deconding a video and checking no artifacts are shown. If it works we can try to send it to upstream.
Comment 3 tka 2013-11-03 23:08:03 UTC
i686-pc-linux-gnu-gcc -Wshadow -O3 -ffast-math -march=native -mtune=native -O2 -fomit-frame-pointer -pipe -Dx264_ultrahardened -msse -mfpmath=sse -Wall -I. -I/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245 -std=gnu99 -mpreferred-stack-boundary=5 -fPIC -fno-tree-vectorize   -c -o encoder/me.o /var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/encoder/me.c
In file included from /var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/common.h:1014:0,
                 from /var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/encoder/me.c:28:
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h: In function 'x264_predictor_clip_mmx2':
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h:135:50: warning: initialization makes integer from pointer without a cast [enabled by default]
     intptr_t tmp = (intptr_t)mv_limit, mvc_max = ((uint32_t *)mvc)+i_mvc, i = 0;
                                                  ^
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h: In function 'x264_predictor_roundclip_mmx2':
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h:197:50: warning: initialization makes integer from pointer without a cast [enabled by default]
     intptr_t tmp = (intptr_t)mv_limit, mvc_max = ((uint32_t *)mvc)+i_mvc, i = 0;
                                                  ^
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h: Assembler messages:
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h:141: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
/var/tmp/portage/media-libs/x264-0.0.20130912/work/x264-snapshot-20130912-2245/common/x86/util.h:203: Error: no instruction mnemonic suffix given and no register operands; can't size instruction
make: *** [encoder/me.o] Error 1
Comment 4 Hector Martin 2014-03-12 00:20:34 UTC
x264-0.0.20140308 fails with the same error on amd64 with hardened gcc x86_64-pc-linux-gnu-4.8.2:

                 from /var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/encoder/me.c:28:
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/encoder/me.c: In function ‘x264_me_search_ref’:
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/osdep.h:261:13: error: ‘asm’ operand has impossible constraints
 #define asm __asm__
             ^
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/x86/util.h:130:5: note: in expansion of macro ‘asm’
     asm(
     ^
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/osdep.h:261:13: error: ‘asm’ operand has impossible constraints
 #define asm __asm__
             ^
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/x86/util.h:193:5: note: in expansion of macro ‘asm’
     asm(

It builds fine with x86_64-pc-linux-gnu-4.8.2-vanilla, however.
Comment 5 Mark Wright gentoo-dev 2014-03-23 00:31:49 UTC
It would help if you could please run this test and report the results:
Add this line to the file /etc/portage/package.env (creating the file
if it does not exist):

media-libs/x264 Os-fomit-frame-pointer-cflags

Then create the file /etc/portage/env/Os-fomit-frame-pointer-cflags with contents:

CFLAGS="-Os -falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -freorder-blocks-and-partition -ftree-vect-loop-version -march=native -fomit-frame-pointer -fno-stack-protector -nopie -pipe"                                                     
CXXFLAGS="${CFLAGS}"
Comment 6 Hector Martin 2014-03-23 01:23:23 UTC
Yup, those CFLAGS make it build successfully.
Comment 7 Hector Martin 2014-03-23 01:25:20 UTC
It's worth noting that I have ABI_X86="32 64" for this package, so I was probably hitting the problem on the 32-bit build, not the 64-bit build (thus it would be the same report as tka).
Comment 8 tka 2014-03-23 11:15:21 UTC
> CFLAGS="-Os -falign-functions -falign-jumps -falign-loops -falign-labels
> -freorder-blocks -freorder-blocks-and-partition -ftree-vect-loop-version
> -march=native -fomit-frame-pointer -fno-stack-protector -nopie -pipe"       
> 
> CXXFLAGS="${CFLAGS}"

With these flags, gcc-4.8.2 compiles x264-0.0.20140308 without error.

The only issue is:

 * QA Notice: The following files contain runtime text relocations
 *  Text relocations force the dynamic linker to perform extra
 *  work at startup, waste system resources, and may pose a security
 *  risk.  On some architectures, the code may not even function
 *  properly, if at all.
 *  For more information, see http://hardened.gentoo.org/pic-fix-guide.xml
 *  Please include the following list of files in your report:
 * TEXTREL usr/lib/libx264.so.142
Comment 9 Magnus Granberg gentoo-dev 2014-06-01 14:03:50 UTC
On x86 Hardened the asm code should be disable.
In the build log it say it is enable.
So is the disable asm check working or not?
When building the x86 part on amd64 multilib the asm code should
be disable.
Comment 10 Magnus Granberg gentoo-dev 2014-06-01 14:36:58 UTC
Have added the pic use flag for amd64 on hardened profile.
Can some one test with newest x264 to see if works?
Comment 11 Hongjiu Zhang 2014-06-04 12:25:18 UTC
I just tested and it works.

Actually, I actually have PIC enabled manually before you set it up, but that still did not work last year when this bug is reported. Is there any other stuff you have changed? I see nothing in ChangeLog but the hardened package.use change.
Comment 12 Luke-Jr 2014-07-24 19:03:24 UTC
I also get this on x86 non-hardened...
Comment 13 Luke-Jr 2014-08-24 17:07:00 UTC
media-libs/x264-0.0.20140308 builds with (NOT LITERAL): -fomit-frame-pointer || ( -Os -O2 )
Comment 14 Victor Mataré 2015-06-24 13:30:26 UTC
Could somebody change the title of this bug so it shows that the problem is not limited to 0.0.20130912:

/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/osdep.h:261:13: error: 'asm' operand has impossible constraints
 #define asm __asm__
Comment 15 Jorge Nerin 2015-07-29 19:18:09 UTC
Also happens with gcc 4.8.4 and media-libs/x264-0.0.20140308 in amd64 with -m32 (abi_x86_32):


x86_64-pc-linux-gnu-gcc -m32 -Wshadow -O3 -ffast-math -march=native -O2 -pipe -ggdb -fno-omit-frame-pointer -msse -mfpmath=sse -Wall -I. -I/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245 -std=gnu99 -mpreferred-stack-boundary=5 -fPIC -fno-tree-vectorize   -c -o encoder/encoder.o /var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/encoder/encoder.c
In file included from /var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/common.h:117:0,
                 from /var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/encoder/me.c:28:
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/encoder/me.c: In function ‘x264_me_search_ref’:
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/osdep.h:261:13: error: ‘asm’ operand has impossible constraints
 #define asm __asm__
             ^
/var/tmp/portage/media-libs/x264-0.0.20140308/work/x264-snapshot-20140308-2245/common/x86/util.h:130:5: note: in expansion of macro ‘asm’
     asm(
     ^
Comment 16 Erik Hvatum 2015-08-06 00:08:13 UTC
I am also experiencing this issue when building media-libs/x264-0.0.20140308 for x86 (32-bit) when CFLAGS includes -fno-omit-frame-pointer.  To reiterate, x264 builds for amd64 with and without -fno-omit-frame-pointer, but building for x86 fails unless -fno-omit-frame-pointer is absent.

I am using GCC 4.9.3 with CFLAGS="-march=native -ggdb -O2 -pipe -fno-omit-frame-pointer".
Comment 17 Alexey Min 2015-10-24 18:40:20 UTC
gcc-4.9.3
=media-libs/x264-0.0.20140308::gentoo

if compile using CFLAGS="-g -ggdb -O0 -pipe" I get the same error
if CFLAGS="-O3 -pipe" it compiles fine, just few warnings.
Comment 18 Pacho Ramos gentoo-dev 2016-12-05 20:09:36 UTC
is this still valid with x264-0.0.20160712?
Comment 19 Alexey Min 2017-03-02 10:17:31 UTC
(In reply to Pacho Ramos from comment #18)
> is this still valid with x264-0.0.20160712?

Yes, the same happens for media-libs/x264-0.0.20160712 when ABI_X86 has "32": 'asm' operand has impossible constraints.

Creating special package.env as described in comment #5 helps, but I has less falgs in CFLAGS, only those:

CFLAGS="-march=native -fomit-frame-pointer -fno-stack-protector"

After that x264 compiles fine with only QA notice about runtime text relocations.
Comment 20 Alexey Min 2017-03-02 10:18:07 UTC
Add, gcc version is 4.9.4