Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 128403

Summary: media-video/mplayer-1.0.20060302 compile error
Product: Gentoo Linux Reporter: Patrick McLean <chutzpah>
Component: New packagesAssignee: Gentoo Media-video project <media-video>
Status: RESOLVED DUPLICATE    
Severity: normal CC: ace, amd64, gcc-porting, matteo
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: asm contraint patch

Description Patrick McLean gentoo-dev 2006-04-01 09:58:42 UTC
media-video/mplayer-1.0.20060302 fails on amd64 with gcc-4.1 with this error:

cc -I../libvo -I../../libvo -I/usr/X11R6/include  -D__STDC_LIMIT_MACROS -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE  -DHAVE_AV_CONFIG_H -I.. -I/var/tmp/portage/mplayer-1.0.20060302/work/mplayer-1.0.20060302/libavutil -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE    -c -o i386/fdct_mmx.o i386/fdct_mmx.c
/var/tmp/portage/mplayer-1.0.20060302/temp/ccY9MeYd.s: Assembler messages:
/var/tmp/portage/mplayer-1.0.20060302/temp/ccY9MeYd.s:1681: Error: suffix or operands invalid for `pshufw'
make[1]: *** [i386/fdct_mmx.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/mplayer-1.0.20060302/work/mplayer-1.0.20060302/libavcodec'
make: *** [libavcodec/libavcodec.a] Error 2

!!! ERROR: media-video/mplayer-1.0.20060302 failed.
Call stack:
  ebuild.sh, line 1526:   Called dyn_compile
  ebuild.sh, line 923:   Called src_compile
  mplayer-1.0.20060302.ebuild, line 485:   Called die

!!! Failed to build MPlayer!
!!! If you need support, post the topmost build error, and the call stack if relevant.

Looking at the assembler output of gcc-4.1 versus gcc-3.4.6, we have

gcc-4.1:   pshufw $27, %ax, %mm5
gcc-3.4.6: pshufw $27, (%rax), %mm5

Apparently (according to KingTaco, %ax is a 16-bit register, and (%rax) is a 64-bit register, so apparently gcc 4.1 is trying use a 16-bit register with a 64-bit instruction
Portage 2.1_pre7-r3 (default-linux/amd64/2006.0, gcc-4.1.0, glibc-2.4-r1, 2.6.16-gentoo x86_64)
=================================================================
System uname: 2.6.16-gentoo x86_64 AMD Athlon(tm) 64 Processor 3400+
Gentoo Base System version 1.12.0_pre16
dev-lang/python:     2.4.2-r1
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -Os -fomit-frame-pointer -ffast-math -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-march=athlon64 -Os -fomit-frame-pointer -ffast-math -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig cvs digest distlocks metadata-transfer multilib-strict sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.mirrored.ca/ ftp://cs.ubishops.ca/pub/gentoo http://gentoo.oregonstate.edu http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/gentopia"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 X a52 aac acpi alsa ao audiofile avi bash-completion berkdb bitmap-fonts bzip2 c++ cairo caps cdparanoia cdr cli crypt cscope css ctype cups curl dba dbus dri dts dv dvd dvdr dvdread dvi edl eds emboss encode evo exif expat fastbuild fat ffmpeg fftw firefox flac foomaticdb force-cgi-redirect ftp gb gcj gd gdbm gif gimp gimpprint glibc-omitfp glitz glut gmail gmp gnome gnutls gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile gzip hal hfs idea imagemagick imap imlib imlib2 iproute2 isdnlog jabber java jfs jpeg junit lcms libgda linuxkeys live lzo lzw lzw-tiff mad matroska memlimit mikmod mmap mng mod mono mozdevelop mozilla mozsvg mp3 mpeg mplayer msn musepack mythtv native nautilus ncurses network nfs no-old-linux no_wxgtk1 noantlr nob nobcel nobeanutils nobsh nocommonsnet nojsch nomotif nonfsv4 noplugin norhino noxalan noxerces nptl nptlonly offensive ogg oggvorbis openal opengl pam pcre pda pdflib perl plugin png posix ppds pppd python quicktime radeon readline reiserfs rtc ruby samba sdl session simplexml slang sndfile soap sockets speex spell spl sqlite ssl startup-notification stream subversion svg tcltk tcpd tga theora tiff tokenizer transcode truetype truetype-fonts type1-fonts unicode usb v4l v4l2 vcd vorbis wmf wxwindows xml xml2 xpm xprint xscreensaver xsl xv xvid xvmc zlib elibc_glibc input_devices_mouse input_devices_evdev input_devices_keyboard kernel_linux userland_GNU video_cards_ati"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LANG, LC_ALL, LINGUAS
Comment 1 Matteo Spreafico 2006-04-01 10:47:21 UTC
I have a similar problem with gcc-3.4.6

cc -c -I../libvo -I../../libvo -I/usr/X11R6/include  -D__STDC_LIMIT_MACROS -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE  -I. -I.. -I../osdep  -I../libavutil -I/usr/include/freetype2 -I/usr/include/SDL -D_REENTRANT -I/usr/X11R6/include    -DMPG12PLAY  -o osd.o osd.c
/var/tmp/portage/mplayer-1.0.20060302/temp/ccjpDvG9.s: Assembler messages:
/var/tmp/portage/mplayer-1.0.20060302/temp/ccjpDvG9.s:2072: Error: can't encode register '%ch' in an instruction requiring REX prefix.
/var/tmp/portage/mplayer-1.0.20060302/temp/ccjpDvG9.s:2073: Error: can't encode register '%ah' in an instruction requiring REX prefix.
/var/tmp/portage/mplayer-1.0.20060302/temp/ccjpDvG9.s:2074: Error: can't encode register '%dh' in an instruction requiring REX prefix.
make[1]: *** [osd.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/mplayer-1.0.20060302/work/mplayer-1.0.20060302/libvo'
make: *** [libvo/libvo.a] Error 2

!!! ERROR: media-video/mplayer-1.0.20060302 failed.
Call stack:
  ebuild.sh, line 1526:   Called dyn_compile
  ebuild.sh, line 923:   Called src_compile
  mplayer-1.0.20060302.ebuild, line 485:   Called die

!!! Failed to build MPlayer!
!!! If you need support, post the topmost build error, and the call stack if relevant.


Portage 2.1_pre7-r3 (default-linux/amd64/2006.0, gcc-3.4.6, glibc-2.4-r1, 2.6.16-gentoo-r1 x86_64)
=================================================================
System uname: 2.6.16-gentoo-r1 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
Gentoo Base System version 1.12.0_pre16
ccache version 2.4 [enabled]
dev-lang/python:     2.4.2-r1
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O3 -ftracer -pipe -msse3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/grass60/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/share/X11/xkb /usr/share/config /usr/spool/PBS /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-march=athlon64 -O3 -ftracer -pipe -msse3"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache collision-protect confcache distcc distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/ http://gentoo.ngi.it/ http://distfiles.gentoo.org"
LANG="it_IT.UTF-8"
LC_ALL="it_IT.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="it"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages-p2"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="amd64 X a52 aac aalib acl acpi alsa apache2 arts audiofile avi bash-completion berkdb bitmap-fonts blas bzip2 caps cdparanoia cdr cli crypt ctype cups curl curlwrappers dba dbus dri dts dvd dvdr dvdread eds emboss encode esd exif expat fastbuild ffmpeg fftw flac flash foomaticdb force-cgi-redirect fortran ftp gcj gd gdbm gif gmp gnome gnutls gpm gstreamer gtk gtk2 gtkhtml hal idn ieee1394 imagemagick imap imlib iodbc ipv6 isdnlog java javascript jpeg jpeg2k kde kdeenablefinal lapack lcms ldap libcaca libedit libgda lm_sensors lzw lzw-tiff mad mailwrapper matroska mbox memlimit mhash ming mng motif mp3 mpeg mysql ncurses netcdf nis nls nptl nsplugin odbc offensive ogg opengl pam pcntl pcre pdf pdflib perl php png posix postgres ppds pppd prelude python qt quicktime readline samba sasl scanner sdl session simplexml slang slp smartcard sndfile snmp soap sockets socks5 speex spell spl sqlite ssl svg sysvipc szip tcltk tcpd tetex theora threads tidy tiff tokenizer truetype truetype-fonts type1-fonts unicode usb vcd vorbis wmf xine xml xml2 xmlrpc xmms xosd xpm xprint xsl xv xvid zlib elibc_glibc input_devices_keyboard input_devices_mouse kernel_linux linguas_it userland_GNU video_cards_nvidia video_cards_vesa video_cards_vga video_cards_fbdev"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS
Comment 2 Mark Loeser (RETIRED) gentoo-dev 2006-04-01 12:46:24 UTC
Created attachment 83653 [details, diff]
asm contraint patch

Here is a reduced testcase.  I fixed this by making the first contraint "m", but that breaks other parts (since this is generated by a macro call and affects a good deal more than just this part.)  I'll toy around with it and see what I can do.  I don't think this is a bug in GCC though.  We were probably just lucky that it worked up to this point.

static __attribute__ ((always_inline))
     inline void fdct_row_mmx2 (const int * in)
{
  __asm__ __volatile__ ("pshufw" " %1, %0, %%" "mm5"::"X" (*(in + 4)),
                        "X" (0x1B));
}

void
ff_fdct_mmx2 (int * block)
{
  int *block1, *out;
  const int *table;
  int i;
  for (i = 8; i > 0; i--)
    {
      fdct_row_mmx2 (block1);
    }
}
Comment 3 Leonard Khoo 2006-04-01 18:48:08 UTC
Reproduced. 

[ebuild   R   ] media-video/mplayer-1.0.20060302  USE="X aac alsa bindist bl cdparanoia cpudetection dts dvd dvdread encode ggi gif gtk i8x0 ipv6 jpeg live lzo mad matroska mmx mmxext musepack nas nls openal opengl oss png real samba sdl sse sse2 svga tga theora truetype vorbis win32codecs x264 xmms xv xvid xvmc -3dfx -3dnow -3dnowext -aalib -arts -bidi -custom-cflags -debug -dga -directfb -doc -dv -dvb -edl -esd -fbcon -jack -joystick -libcaca -lirc -livecd -matrox -nvidia -rtc -v4l -v4l2 -xanim -xinerama" 0 kB


cc -I../libvo -I../../libvo -I/usr/X11R6/include -fno-PIC  -D__STDC_LIMIT_MACROS -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE  -DHAVE_AV_CONFIG_H -I.. -I/var/tmp/portage/mplayer-1.0.20060302/work/mplayer-1.0.20060302/libavutil -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE    -c -o i386/dsputil_mmx.o i386/dsputil_mmx.c
i386/dsputil_mmx.c: In function `transpose4x4':
i386/dsputil_mmx.c:621: error: can't find a register in class `GENERAL_REGS' while reloading `asm'
In file included from i386/dsputil_mmx.c:2492:
i386/h264dsp_mmx.c:49:1: warning: "SBUTTERFLY" redefined
i386/dsputil_mmx.c:1525:1: warning: this is the location of the previous definition
i386/h264dsp_mmx.c:1147:1: warning: "PUT_OP" redefined
i386/dsputil_mmx.c:2377:1: warning: this is the location of the previous definition
make[1]: *** [i386/dsputil_mmx.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/mplayer-1.0.20060302/work/mplayer-1.0.20060302/libavcodec'
make: *** [libavcodec/libavcodec.a] Error 2

!!! ERROR: media-video/mplayer-1.0.20060302 failed.
Call stack:
  ebuild.sh, line 1526:   Called dyn_compile
  ebuild.sh, line 923:   Called src_compile
  mplayer-1.0.20060302.ebuild, line 485:   Called die

!!! Failed to build MPlayer!
!!! If you need support, post the topmost build error, and the call stack if relevant.



emerge --info

Portage 2.1_pre7-r3 (default-linux/x86/2005.1, gcc-3.4.6, glibc-2.4-r1, 2.6.16-archck2 i686)
=================================================================
System uname: 2.6.16-archck2 i686 Intel(R) Pentium(R) M processor 1.70GHz
Gentoo Base System version 1.12.0_pre16
ccache version 2.4 [disabled]
dev-lang/python:     2.3.5-r2, 2.4.2-r1
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium-m -mtune=pentium-m -pipe -fomit-frame-pointer -ftracer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium-m -mtune=pentium-m -pipe -fomit-frame-pointer -ftracer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X alsa apm avi berkdb bitmap-fonts bzip2 crypt cups dri eds emboss encode flac foomaticdb fortran gdbm gif gpm gstreamer gtk gtk2 i8x0 imlib ipv6 isdnlog jpeg kde kdeenablefinal libg++ libwww mad mikmod mmx motif mp3 mpeg ncurses nls nptl nptlonly ogg oggvorbis opengl oss pam pdflib perl png pppd python qt quicktime readline sdl spell sse sse2 ssl tcpd tiff truetype truetype-fonts type1-fonts usb vorbis xml2 xmms xv zlib elibc_glibc input_devices_keyboard input_devices_synaptics input_devices_vmmouse input_devices_mouse kernel_linux userland_GNU video_cards_i810 video_cards_vmware video_cards_vesa"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 4 Luca Barbato gentoo-dev 2006-04-02 03:46:14 UTC
looks like it isn't a gcc-4.1 bug afterall...

*** This bug has been marked as a duplicate of 128410 ***