Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 343305 - Emerging media-video/mplayer-1.0_rc4_p20091026-r1 fails on Intel Atom (march=native->prescott) and -O2 with can't find a register in class 'GENERAL_REGS' while reloading 'asm'/error: 'asm' operand has impossible constraints
Summary: Emerging media-video/mplayer-1.0_rc4_p20091026-r1 fails on Intel Atom (march=...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-29 23:19 UTC by Heiko Rosemann
Modified: 2011-12-16 12:50 UTC (History)
1 user (show)

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


Attachments
The build.log from a failing emerge (build.log,765.17 KB, text/plain)
2010-10-29 23:21 UTC, Heiko Rosemann
Details
ebuild for having mplayer chose its own CFLAGS, ignoring system CFLAGS (mplayer-1.0_rc4_p20091026-r2.ebuild,18.64 KB, text/plain)
2010-10-29 23:23 UTC, Heiko Rosemann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Heiko Rosemann 2010-10-29 23:19:48 UTC
Hi everyone,

When changing my CFLAGS from -O3 to -O2 recently (due to some weird problems) I realized I could no longer compile mplayer. It fails during compilation with

================================================================================
cabac.h:527: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
cabac.h:527: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
cabac.h:527: error: 'asm' operand has impossible constraints
cabac.h:527: error: 'asm' operand has impossible constraints
cabac.h:641: error: 'asm' operand has impossible constraints
================================================================================
(see attached build.log for more details)

This is true for mplayer-1.0_rc4_p20091026-r1, mplayer-1.0_rc4_p20100612 and probably others - I did not test any other versions.

Since I had been using -O2 on this machine before, there must have been a working version somewhere in the tree. I'm sorry I cannot go back that far....

It works for my other machine, an Intel Core i5 (amd64).

The bug is known upstream and labeled as a gcc-bug: http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1461 - I'm not sure if I agree with that (changing -O3 to -O2 should not break anything...) but hey, that's the mplayer guys.

After some poking around, I found two possible solutions:
One: emerge mplayer with CFLAGS="$CFLAGS -O3" emerge mplayer
Two: The ebuild file I attached to this post: You will find the following lines in build.log

================================================================================
MPlayer compilation will use the CPPFLAGS/CFLAGS/LDFLAGS/YASMFLAGS set by you,
but:

    *** ***  DO NOT REPORT BUGS IF IT DOES NOT COMPILE/WORK!  *** ***

It is strongly recommended to let MPlayer choose the correct CFLAGS!
================================================================================

...which led me to creating that ebuild, which ignores the system CFLAGS but instead has mplayer chose them for itself. The ebuild works on my other machine as well.

Even if I don't think this is something Gentoo can handle, I put this bug here for reference. It took me some hours to gather that information, and if I forget it, I want to be able to reread it all in one place again ;)

Best regards,
Heiko

(On a side note: A similar problem occurs in avidemux, but that one can't be fixed with -O3 and avidemux does not offer such a simple way of defining its own CFLAGS.)

Reproducible: Always

Steps to Reproduce:
1. Set your CFLAGS to "-O2 -march=native -pipe -mstackrealign -fno-tree-vectorize" on an Intel Atom N270 (probably also happens when using "-march=prescott" on any other x86-system)
2. Try to emerge/remerge mplayer
Actual Results:  
i686-pc-linux-gnu-gcc -DHAVE_AV_CONFIG_H -I.. -I..  -Wundef -Wdisabled-optimizat
ion -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -O2 -march=native
 -pipe -mstackrealign -fno-tree-vectorize -D__STDC_LIMIT_MACROS -fomit-frame-poi
nter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Ilibdvdre
ad4 -I.  -D_REENTRANT  -I/usr/include/SDL  -D_REENTRANT -I/usr/include/freetype2
   -I/usr/include/dirac   -I/usr/include/schroedinger-1.0 -I/usr/include/liboil-
0.3     -c -o h264.o h264.c
h264.c: In function 'pred_direct_motion':
h264.c:1048: warning: assignment from incompatible pointer type
h264.c:1049: warning: assignment from incompatible pointer type
h264.c: In function 'filter_mb_dir':
h264.c:6351: warning: initialization from incompatible pointer type
h264.c:6352: warning: initialization from incompatible pointer type
h264.c: In function 'decode_cabac_mb_mvd':
cabac.h:527: error: can't find a register in class 'GENERAL_REGS' while reloadin
g 'asm'
cabac.h:527: error: can't find a register in class 'GENERAL_REGS' while reloadin
g 'asm'
cabac.h:527: error: 'asm' operand has impossible constraints
cabac.h:527: error: 'asm' operand has impossible constraints
cabac.h:641: error: 'asm' operand has impossible constraints
i686-pc-linux-gnu-gcc -DHAVE_AV_CONFIG_H -I.. -I..  -Wundef -Wdisabled-optimizat
ion -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -O2 -march=native
 -pipe -mstackrealign -fno-tree-vectorize -D__STDC_LIMIT_MACROS -fomit-frame-poi
nter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Ilibdvdre
ad4 -I.  -D_REENTRANT  -I/usr/include/SDL  -D_REENTRANT -I/usr/include/freetype2
   -I/usr/include/dirac   -I/usr/include/schroedinger-1.0 -I/usr/include/liboil-
0.3     -c -o h264idct.o h264idct.c
make[1]: *** [h264.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/var/tmp/portage/media-video/mplayer-1.0_rc4_p20091026-r1/work/mplayer-1.0_rc4_p20091026/libavcodec'
make: *** [libavcodec/libavcodec.a] Error 2
 * ERROR: media-video/mplayer-1.0_rc4_p20091026-r1 failed:
 *   Failed to build MPlayer!
 * 
 * Call stack:
 *     ebuild.sh, line  54:  Called src_compile
 *   environment, line 2874:  Called die
 * The specific snippet of code:
 *       emake || die "Failed to build MPlayer!";

Expected Results:  
mplayer should be compiled and merged :)

Portage 2.1.8.3 (default/linux/x86/10.0/desktop, gcc-4.4.4, glibc-2.11.2-r0, 2.6.33-tuxonice-r1 i686)
=================================================================
System uname: Linux-2.6.33-tuxonice-r1-i686-Intel-R-_Atom-TM-_CPU_N270_@_1.60GHz-with-gentoo-1.12.13
Timestamp of tree: Fri, 29 Oct 2010 02:15:01 +0000
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11
dev-lang/python:     2.5.4-r4, 2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.5-r1, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA Q3AEULA PUEL dlj-1.1 cadsoft AdobeFlash-10 AdobeFlash-10.1"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -mstackrealign -fno-tree-vectorize"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /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=""
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo "
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa berkdb branding bzip2 cairo cdr cli consolekit cracklib crypt cups cupsddk cxx dbus dri dts dvb dvd dvdnav dvdr emboss encode exif fam ffmpeg firefox flac fortran gdbm gif gpm gtk iconv ipv6 java javascript jpeg lcms ldap libnotify mad mbox mikmod mmx mmxext mng modules mozdevelop moznopango mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pango pcre pdf png ppds pppd python qt3support qt4 readline sasl sdl session spell sse sse2 ssl ssse3 startup-notification svg sysfs tcpd tiff truetype usb v4l v4l2 vorbis x264 x86 xanim xcb xinerama xml xorg xulrunner xv xvid xvmc zlib" 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" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" 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="synaptics keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" 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" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

(you asked for emerge --info - you get it...)
Comment 1 Heiko Rosemann 2010-10-29 23:21:06 UTC
Created attachment 252529 [details]
The build.log from a failing emerge
Comment 2 Heiko Rosemann 2010-10-29 23:23:27 UTC
Created attachment 252531 [details]
ebuild for having mplayer chose its own CFLAGS, ignoring system CFLAGS

If you place this ebuild in an overlay, you will also need to copy files/mplayer-1.0_rc4_p20091026-arm_neon.patch from your media-video/mplayer directory in your portage tree.
Comment 3 Rafał Mużyło 2010-10-30 22:17:44 UTC
This seems to be indirect dupe of bug 290741.
It seems to be a compiler bugs, but some of the parties disagree.
Comment 4 Wormo (RETIRED) gentoo-dev 2010-11-05 19:47:14 UTC
Thanks for reporting this bug, so that at least other users will know this CFLAGS combination is breaking mplayer. Assigning to mplayer maintainers, who can decide whether there is any sensible flag filtering that could be added to work around this problem.
Comment 5 Petr Zima 2011-04-02 18:33:04 UTC
If anyone cares, this bug is afaik 32bit specific and caused by -mstackrealign (-O2 or -O3 does not matter), which eats some register(s). Maybe it is worth to note it directly in the title.

Problem is that -mstackrealign is desirable with -O3 on x86 due to GCC bug 270120. However, -fno-tree-vectorize should suffice to avoid segfaults and still compile mplayer.
Comment 6 Rafał Mużyło 2011-04-03 17:22:43 UTC
As I mentioned in bug bug 290741, problem is fixed in recent (well, not that recent anymore) gcc versions.
Comment 7 Rafał Mużyło 2011-04-03 17:39:11 UTC
Correction: "As I mentioned in bug 179872, ..."
Comment 8 Alexis Ballier gentoo-dev 2011-12-16 12:50:03 UTC
should be fixed in 1.0_rc4_p20111215 as it uses system ffmpeg