Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 16238 - CFLAGS optimizations b0rk mjpegtools ebuild
Summary: CFLAGS optimizations b0rk mjpegtools ebuild
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: Highest critical (vote)
Assignee: Martin Holzer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-23 13:30 UTC by Bart Sekura
Modified: 2003-04-29 17:09 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bart Sekura 2003-02-23 13:30:50 UTC
When a user has CFLAGS optimizations for a specific architecture (e.g.
-fprefetch-loop-arrays) the mjpegtools ebuild still uses them in spite of the
fact that the build itself forces -march=i686. As a result, cc1 dies with error:
"-fprefetch-loop-arrays is invalid for specified architecture".
The ebuild needs to filter these out or something.
Comment 1 Bart Sekura 2003-02-23 13:33:36 UTC
mjpegtools 1.6.0-r7
Comment 2 Seemant Kulleen (RETIRED) gentoo-dev 2003-02-23 17:51:29 UTC
can you paste/attach the entire log and also emerge info?
Comment 3 Bart Sekura 2003-02-24 05:42:12 UTC
it's very easy to recreate: if you have a p4 box handy, add -march=pentium4 -fpretech-loop-arrays to your CFLAGS (or any other p4 specific optimization flag) and try emerging mjpegtools; Since mjpegtools replaces -march=pentium4 with -march=i686 the compiler dies coz -fprefetch-loop-arrays is invalid with -march=i686; my workaround was to temporarily remove flags that cause trouble from CFLAGs just to emerge mjpegtools successfuly, then revert back to normal;

I'll try to recreate this for you and paste some additional info.
Comment 4 phoen][x 2003-04-06 05:13:08 UTC
That would come in handy - i dont have a p4 box lying around.

Sounds 'filter-flags -fprefetch-loop-arrays' reasonable to you?

-phoen][x-
Comment 5 Martin Holzer (RETIRED) gentoo-dev 2003-04-06 07:08:30 UTC
but i have

let's see if it fails for me too
Comment 6 Bart Sekura 2003-04-07 11:46:02 UTC
just recently I did emerge gnome and mjpegtools failed as well, with -fprefetch-loop-arrays included in my CFLAGS; filtering these out will do the trick (or not forcing i686) ...
Comment 7 Martin Holzer (RETIRED) gentoo-dev 2003-04-07 14:07:01 UTC
prints out a lot of warning messages 
cc1: warning: -fprefetch-loop-arrays not supported for this target (try -march switches)

fails here too

Portage 2.0.47-r10 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r4)
=================================================================
System uname: 2.4.20-gentoo-r2 i686
GENTOO_MIRRORS="http://localhost/gentoo"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY=""
USE="x86 oss 3dnow apm arts avi crypt cups encode gif java jpeg kde gnome libg++ libwww mikmod mmx motif mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib gdbm berkdb slang readline svga X sdl gpm tcpd pam ssl perl python esd imlib oggvorbis gtk qt opengl"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O3 -pipe -ffast-math -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr"
CXXFLAGS="-march=pentium4 -O3 -pipe -ffast-math -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr"
ACCEPT_KEYWORDS="x86"
MAKEOPTS="-j2"
AUTOCLEAN="yes"
SYNC="rsync://localhost/gentoo-portage"
FEATURES="sandbox buildpkg ccache"
Comment 8 Hemal Kikawala 2003-04-08 20:11:19 UTC
-fPIC in CFLAGS also borks the compile 
Comment 9 Martin Holzer (RETIRED) gentoo-dev 2003-04-09 13:44:28 UTC
comment #8 is invalid

this could only be a USE flag, not a CFLAGS
Comment 10 Dave Habben 2003-04-25 21:38:54 UTC
I can confirm that -fPIC breaks the compile for mjpegtools-1.6.0-r7

With the following settings it errors out:
CFLAGS="-mcpu=athlon-xp -O3 -pipe -fomit-frame-pointer -fPIC"

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -mcpu=i686 -march=i686 -mcpu=athlon-xp -O3 -pipe -fomit-frame-pointer -fPIC -Wall -Wunused -c `test -f cpu_accel.c || echo './'`cpu_accel.c
cpu_accel.c: In function `x86_accel':
cpu_accel.c:83: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:100: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:106: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:128: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:132: can't find a register in class `BREG' while reloading `asm'
make[2]: *** [cpu_accel.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/var/tmp/portage/mjpegtools-1.6.0-r7/work/mjpegtools-1.6.0/utils'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/mjpegtools-1.6.0-r7/work/mjpegtools-1.6.0'
make: *** [all] Error 2
 
!!! ERROR: media-video/mjpegtools-1.6.0-r7 failed.
!!! Function src_compile, Line 105, Exitcode 2

When I change it to:
CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"

this ebuild builds successfully
Comment 11 Martin Holzer (RETIRED) gentoo-dev 2003-04-29 17:09:03 UTC
added   filter-flags "-fprefetch-loop-arrays"