One of the functions makes use of the mm0 and mm1 registers, which are MMX registers. GCC-4 does not like to let you do this unless you have -mmmx specified. Attached is patch to the one Makefile.am to add -mmmx to CFLAGS if needed. (You'll need to run automake after applying this patch) Also, this package ignores user cflags, but to do otherwise is probably going to take a lot of work, and/or a lot of filtering since this application makes heavy use of inline asm.
Created attachment 68485 [details, diff] gcc-4 patch
verifying. the attached patch allows liboil to compile on my system. Portage 2.0.52-r1 (default-linux/x86/2005.1, gcc-4.0.2-pre20050913, glibc-2.3.5.20050722-r0, 2.6.13-ck3 i686) ================================================================= System uname: 2.6.13-ck3 i686 Mobile Intel(R) Pentium(R) 4 CPU 3.06GHz Gentoo Base System version 1.12.0_pre8 ccache version 2.4 [enabled] dev-lang/python: 2.4.1-r1 sys-apps/sandbox: 1.2.13 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 sys-devel/binutils: 2.16.1, 2.16.91.0.3 sys-devel/libtool: 1.5.20 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=prescott -fomit-frame-pointer -pipe -mfpmath=sse -fno-ident" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=prescott -fomit-frame-pointer -pipe -mfpmath=sse -fno-ident -fvisibility-inlines-hidden" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks sandbox sfperms" GENTOO_MIRRORS="http://gentoo.chem.wisc.edu/gentoo/" LDFLAGS="-Wl,-O1" MAKEOPTS="-j3"
don't hit me, I'm a bug reporting noob :) it seems that the patch is also needed with gcc 3.4.4. At least it didn't compile with 3.4.4 for me. (It worked trying # CFLAGS="-march=k8 -O3 -pipe -mmmx" emerge liboil you wouldn't think I could apply this patch, would you ;) --------------------------------------------------------------------------- 3.4.4 error: i686-pc-linux-gnu-gcc -g -o .libs/build_marshal build_marshal-build_marshal.o ../liboil/.libs/liboil-0.3.so creating build_marshal ./build_prototypes_doc >liboilfuncs-doc.h /bin/sh: line 1: 26738 Segmentation fault ./build_prototypes_doc >liboilfuncs-doc.h make[3]: *** [liboilfuncs-doc.h] Error 139 make[3]: Leaving directory `/var/tmp/portage/liboil-0.3.2/work/liboil-0.3.2/liboil' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/var/tmp/portage/liboil-0.3.2/work/liboil-0.3.2/liboil' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/portage/liboil-0.3.2/work/liboil-0.3.2' make: *** [all] Error 2 !!! ERROR: dev-libs/liboil-0.3.2 failed. !!! Function src_compile, Line 21, Exitcode 2 !!! emake failed --------------------------------------------------------------------------- emerge info: Portage 2.0.52-r1 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r1, 2.6.13-gentoo-r1 i686) ================================================================= System uname: 2.6.13-gentoo-r1 i686 AMD Athlon(tm) 64 Processor 3000+ Gentoo Base System version 1.12.0_pre8 ccache version 2.4 [enabled] dev-lang/python: 2.3.5, 2.4.1-r1 sys-apps/sandbox: 1.2.13 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 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.20 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -mcpu=i686 -pipe" 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/lib/X11/xkb /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/texmf/web2c /etc/env.d" CXXFLAGS="" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks sandbox sfperms strict" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" LINGUAS="de" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 7zip X aac aalib acpi alsa apm arts asterisk avi bash-completion berkdb bitmap-fonts bzlib cdparanoia cdr crypt cups curl dba divx4linux drm dts dvd dvdr dvdread eds emboss encode exif fam flac flash foomaticdb fortran ftp gd gdbm gif gnome gpm gstreamer gtk gtk2 gtkhtml ieee1394 imagemagick imapimlib imlib ipv6 jabber jack java jpeg kde kdexdeltas ldap libg++ libwww lirc lm_sensors logitech-mouse mad mikmod mime mng motif mp3 mpeg musicbrainz ncurses nls ogg oggvorbis opengl oss pam pdflib perl php pic png python qt quicktime readline samba sdl speex spell ssl svg tcpd tetex theora tidy tiff truetype truetype-fonts type1-fonts unicode usb videos vorbis win32codecs wxwindows xine xml2 xmms xpm xv xvid zlib linguas_de userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY ---------------------------------------------------------------------------
The patch works fine for me.
Same here
This patch did _not_ solve the problem in my case. I tried with both of the following: CFLAGS="-march=i686 -O2" CFLAGS="-march=i686 -O2 -mmmx" Red Hat are my usual source for gcc-4 fixes and this proved to be no exception. I'm attaching the patch from https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=114801 which fixed it for me.
Created attachment 69123 [details, diff] liboil-0.3.0-gcc4.patch (Red Hat bug #158641) Lifted from https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=158641
Incidentally, I'm using gcc-4.0.1. Could someone test with any prior major releases of gcc just to ensure that there are no gotchas?
(In reply to comment #8) > Incidentally, I'm using gcc-4.0.1. Could someone test with any prior major > releases of gcc just to ensure that there are no gotchas? I stated in my original post why I am against a patch like this one. With your patch, I can't compile liboil now because my cflags cause a bunch of failures. It allows user CFLAGS now, and does almost the same exact thing mine does. Are you sure you ran automake after applying the patch? If you did, I can not see any possible way that it would still fail.
Ah, in that case I apologise - my assessment of the bug was admittedly hasty. I'll have another go at it shortly.
Maybe a very stupid question, but how do I patch liboil ? Because before it starts emerging, all the files are still inside a .tgz or something alike. Do I have to edit the ebuild or something ? If so, what line in the ebuild should I add and where ?
- make sure you have an overlay set up in make.conf eg. PORTDIR_OVERLAY="/usr/local/portage" - make a directory for liboil # mkdir -p /usr/local/portage/dev-libs/liboil/files - copy the current ebuild over # cp /usr/portage/dev-libs/liboil/liboil.0.3.2.ebuild /usr/local/portage/dev-libs/liboil/ - save the patch and put it in the files dir # mv ~/liboil-0.3.2-gcc4.patch /usr/local/portage/dev-libs/liboil/files/ - edit the ebuild and add this src_unpack() function before src_compile() src_unpack() { unpack "${A}" cd "${S}" epatch "${FILESDIR}/liboil-0.3.2-gcc4.patch" automake } - rebuild the digest # ebuild /usr/local/portage/dev-libs/liboil/liboil-0.3.2.ebuild digest - emerge
Sorry Mark, your fix worked fine right after I assessed the matter properly and realised I wasn't calling automake within the ebuild in my overlay. Thanks :)
I thought I followed the above instructions (three times) for patching my box, but I'm still getting the message below. Can anyone help me figure out what I missed? Thanks for any help. Dave creating build_marshal ./build_prototypes_doc >liboilfuncs-doc.h /bin/sh: line 1: 26158 Segmentation fault ./build_prototypes_doc >liboilfuncs-doc.h make[3]: *** [liboilfuncs-doc.h] Error 139 make[3]: Leaving directory `/var/tmp/portage/liboil-0.3.2/work/liboil-0.3.2/liboil' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/var/tmp/portage/liboil-0.3.2/work/liboil-0.3.2/liboil' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/portage/liboil-0.3.2/work/liboil-0.3.2' make: *** [all] Error 2 !!! ERROR: dev-libs/liboil-0.3.2 failed. !!! Function src_compile, Line 29, Exitcode 2 !!! emake failed !!! If you need support, post the topmost build error, NOT this status message.
Well that patch (Marks) did not fix my issue. i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../.. -Wall -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L -I../.. -O2 -g -MT libconv_la-conv_3dnow.lo -MD -MP -MF .deps/libconv_la-conv_3dnow.Tpo -c conv_3dnow.c -fPIC -DPIC -o .libs/libconv_la-conv_3dnow.o conv_3dnow.c: In function 'conv_f32_s16_3dnow': conv_3dnow.c:43: error: unknown register name 'mm0' in 'asm' conv_3dnow.c: In function 'conv_s32_f32_3dnow': conv_3dnow.c:68: error: unknown register name 'mm0' in 'asm' make[3]: *** [libconv_la-conv_3dnow.lo] Error 1 make[3]: Leaving directory `/var/tmp/portage/liboil-0.3.2/work/liboil-0.3.2/liboil/conv' Gentoo Base System version 1.12.0_pre8 Portage 2.0.53_rc4 (default-linux/x86/2005.1, gcc-4.0.2, glibc-2.3.5-r1, 2.6.13-gentoo-r3 i686) ================================================================= System uname: 2.6.13-gentoo-r3 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz dev-lang/python: 2.4.2 sys-apps/sandbox: 1.2.13 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-r1 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.20 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=pentium4 -pipe -O2 -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d" CXXFLAGS="-march=pentium4 -pipe -O2 -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks sandbox sfperms strict" GENTOO_MIRRORS="http://mirror.uni-c.dk/pub/gentoo/ http://ds.thn.htu.se/linux/gentoo http://ftp.du.se/pub/os/gentoo" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/overlays/portage /usr/local/overlays/gentopia" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X aac acpi alsa avi bash bash-completion berkdb bitmap-fonts bmp browserplugin bzip2 cairo cdr crypt cups curl dbus dri dvd dvdr eds emboss encode esd evo firefox flac fortran gcj gd gdbm gif gimpprint glitz gmp gnome gpm gstreamer gtk gtk2 gtkhtml gxl hal imlib java jikes joystick jpeg libg++ libwww lm_sensors mad matroska mikmod mmx mmx2 mmxext mono moznocompose moznoirc moznomail mp3 mpeg ncurses network nls nptl nptlonly ntp nvidia offensive ogg oggvorbis opengl pam pdflib perl pic png ppds python quicktime readline real rtc sdl smp sox spell sqlite sse sse2 ssl svg symlink tcltk tcpd test theora threads tiff truetype truetype-fonts type1-fonts unicode userlocales utf8 vorbis win32codecs wxwindows xinetd xml2 xosd xprint xscreensaver xv xvid zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Oh, sry. I did miss that thing about automake. Works nice now.
liboil-0.3.3 is in the tree now, which doesn't ignore user cflags, so this issue should be resolved now.