<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>16238</bug_id>
          
          <creation_ts>2003-02-23 13:30 0000</creation_ts>
          <short_desc>CFLAGS optimizations b0rk mjpegtools ebuild</short_desc>
          <delta_ts>2003-04-29 17:09:03 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>1.4_rc2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P1</priority>
          <bug_severity>critical</bug_severity>
          <target_milestone>1.4</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>sekurb@yahoo.com</reporter>
          <assigned_to>mholzer@gentoo.org</assigned_to>
          <cc>habbend@svcc.edu</cc>

      

      
          <long_desc isprivate="0">
            <who>sekurb@yahoo.com</who>
            <bug_when>2003-02-23 13:30:50 0000</bug_when>
            <thetext>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:
&quot;-fprefetch-loop-arrays is invalid for specified architecture&quot;.
The ebuild needs to filter these out or something.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>sekurb@yahoo.com</who>
            <bug_when>2003-02-23 13:33:36 0000</bug_when>
            <thetext>mjpegtools 1.6.0-r7
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>seemant@gentoo.org</who>
            <bug_when>2003-02-23 17:51:29 0000</bug_when>
            <thetext>can you paste/attach the entire log and also emerge info?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>sekurb@yahoo.com</who>
            <bug_when>2003-02-24 05:42:12 0000</bug_when>
            <thetext>it&apos;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&apos;ll try to recreate this for you and paste some additional info.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>fisi.tilman.klar@gmx.de</who>
            <bug_when>2003-04-06 05:13:08 0000</bug_when>
            <thetext>That would come in handy - i dont have a p4 box lying around.

Sounds &apos;filter-flags -fprefetch-loop-arrays&apos; reasonable to you?

-phoen][x-</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mholzer@gentoo.org</who>
            <bug_when>2003-04-06 07:08:30 0000</bug_when>
            <thetext>but i have

let&apos;s see if it fails for me too</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>sekurb@yahoo.com</who>
            <bug_when>2003-04-07 11:46:02 0000</bug_when>
            <thetext>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) ...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mholzer@gentoo.org</who>
            <bug_when>2003-04-07 14:07:01 0000</bug_when>
            <thetext>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=&quot;http://localhost/gentoo&quot;
CONFIG_PROTECT=&quot;/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&quot;
CONFIG_PROTECT_MASK=&quot;/etc/gconf /etc/env.d&quot;
PORTDIR=&quot;/usr/portage&quot;
DISTDIR=&quot;/usr/portage/distfiles&quot;
PKGDIR=&quot;/usr/portage/packages&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR_OVERLAY=&quot;&quot;
USE=&quot;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&quot;
COMPILER=&quot;gcc3&quot;
CHOST=&quot;i686-pc-linux-gnu&quot;
CFLAGS=&quot;-march=pentium4 -O3 -pipe -ffast-math -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr&quot;
CXXFLAGS=&quot;-march=pentium4 -O3 -pipe -ffast-math -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr&quot;
ACCEPT_KEYWORDS=&quot;x86&quot;
MAKEOPTS=&quot;-j2&quot;
AUTOCLEAN=&quot;yes&quot;
SYNC=&quot;rsync://localhost/gentoo-portage&quot;
FEATURES=&quot;sandbox buildpkg ccache&quot;
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kikawala@sbcglobal.net</who>
            <bug_when>2003-04-08 20:11:19 0000</bug_when>
            <thetext>-fPIC in CFLAGS also borks the compile </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mholzer@gentoo.org</who>
            <bug_when>2003-04-09 13:44:28 0000</bug_when>
            <thetext>comment #8 is invalid

this could only be a USE flag, not a CFLAGS</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>habbend@svcc.edu</who>
            <bug_when>2003-04-25 21:38:54 0000</bug_when>
            <thetext>I can confirm that -fPIC breaks the compile for mjpegtools-1.6.0-r7

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

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 &apos;./&apos;`cpu_accel.c
cpu_accel.c: In function `x86_accel&apos;:
cpu_accel.c:83: can&apos;t find a register in class `BREG&apos; while reloading `asm&apos;
cpu_accel.c:100: can&apos;t find a register in class `BREG&apos; while reloading `asm&apos;
cpu_accel.c:106: can&apos;t find a register in class `BREG&apos; while reloading `asm&apos;
cpu_accel.c:128: can&apos;t find a register in class `BREG&apos; while reloading `asm&apos;
cpu_accel.c:132: can&apos;t find a register in class `BREG&apos; while reloading `asm&apos;
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&apos;
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/mjpegtools-1.6.0-r7/work/mjpegtools-1.6.0&apos;
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=&quot;-march=athlon-xp -O3 -pipe -fomit-frame-pointer&quot;

this ebuild builds successfully</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mholzer@gentoo.org</who>
            <bug_when>2003-04-29 17:09:03 0000</bug_when>
            <thetext>added   filter-flags &quot;-fprefetch-loop-arrays&quot;
</thetext>
          </long_desc>
      
    </bug>

</bugzilla>