Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 36502 - mjpegtools-1.6.1.90-r1 doesn't compile with -fPIC flag.
Summary: mjpegtools-1.6.1.90-r1 doesn't compile with -fPIC flag.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
: 37080 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-12-25 20:17 UTC by Jonathan Karras
Modified: 2004-01-16 09:21 UTC (History)
3 users (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 Jonathan Karras 2003-12-25 20:17:22 UTC
When I compile with the -fPIC flag it errors on compiling the cpu_accel.c file. The output is below. When I compile with-out the -fPIC flag it compiled fine. 


Reproducible: Always
Steps to Reproduce:
1. Put -fPIC in cflags and compile
2. Compile fails
3. Change ebuild to filter -fPIC recompile
4. Compile works

Actual Results:  
source='yuv4mpeg.c' object='yuv4mpeg.o' libtool=no \
depfile='.deps/yuv4mpeg.Po' tmpdepfile='.deps/yuv4mpeg.TPo' \
depmode=gcc3 /bin/sh ../depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..    -mcpu=i586 -march=i586 -mcpu=k6-2 -O2
-pipe -fomit-frame-pointer -fPIC -m3dnow -mmmx -mno-sse2 -Wall -Wunused -c `test
-f 'yuv4mpeg.c' || echo './'`yuv4mpeg.c
cpu_accel.c: In function `x86_accel':
cpu_accel.c:87: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:104: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:110: 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'
cpu_accel.c:136: can't find a register in class `BREG' while reloading `asm'
make[3]: *** [cpu_accel.o] Error 1


Expected Results:  
Expected no errors in the build.

Portage 2.0.49-r15 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.20-gentoo-r9)
=================================================================
System uname: 2.4.20-gentoo-r9 i686 VIA Samuel 2
Gentoo Base System version 1.4.3.10
distcc 2.11.1 i586-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [enabled]
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=i586 -O2 -pipe -fomit-frame-pointer -m3dnow -mmmx -fPIC"
CHOST="i586-pc-linux-gnu"
COMPILER="gcc3"
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"
CXXFLAGS="-march=i586 -O2 -pipe -fomit-frame-pointer -m3dnow -mmmx -fPIC"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs -sandbox ccache distcc prelink"
GENTOO_MIRRORS="ftp://mirror.iawnet.sandia.gov/pub/gentoo/
http://gentoo.mirrors.pair.com/ http://gentoo.oregonstate.edu
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="apm encode foomaticdb gtk2 imlib libg++ libwww mad mikmod motif ncurses nls
pdflib spell truetype xml2 xmms gdbm berkdb slang readline gpm tcpd ssl perl
python opengl X -gtk -gnome -cups qt alsa oss mysql jpeg mpeg png gif xv kde
zlib x86 pam oggvorbis dvd css quicktime aalib directfb svga sdl fbcon crypt
arts 3dnow avi prelink PIC mythtv mmx dv tiff"
Comment 1 SpanKY gentoo-dev 2003-12-25 20:24:57 UTC
technically you're not supposed to have -fPIC in your CFLAGS

ebuilds take care of that for you
Comment 2 Jonathan Karras 2003-12-25 21:12:07 UTC
That makes sense now that I dig more. I have removed fPIC from my cflags and added the "pic" use flag to my USE variable.

But should the -fPIC flag be filtered so that this doesn't happen to other unsuppecting gentooers?
Comment 3 SpanKY gentoo-dev 2003-12-25 21:15:14 UTC
i'll leave it to the video peeps to decide ...

honestly if it happens to other people they shouldnt have -fPIC in theif CFLAGS either :)
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2004-01-03 00:20:34 UTC
Happened to me too on 1.6.1.91 but I don't have -fPIC.
NOT applying the -fPIC patch fixed the problem.

Excerpt of emerge info:
Gentoo Base System version 1.4.3.12
Portage 2.0.49-r20 (default-x86-1.4, gcc-3.3.2, glibc-2.3.3_pre20031222-r0, 2.4.22-gentoo-r2)
=================================================================
System uname: 2.4.22-gentoo-r2 i686 mobile AMD Athlon(tm) XP 1800+
ACCEPT_KEYWORDS="x86 ~x86"
CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-liux-gnu"
MAKEOPTS="-j2"
USE="x86 3dnow X alsa arts berkdb canna cdr cjk dvd encode freewnn gif gtk imlib java jpeg kde mmx motif mpeg ncurses nls oggvorbis opengl pam png qt readline sasl spell sse ssl tcpd truetype unicode usb xinerama xv"
Comment 5 SpanKY gentoo-dev 2004-01-03 08:55:59 UTC
*** Bug 37080 has been marked as a duplicate of this bug. ***
Comment 6 Brian Bilbrey 2004-01-03 11:28:48 UTC
Another positive result for commenting this:

 epatch ${FILESDIR}/${P}-fPIC.patch

out of mjpegtools-1.6.1.91.ebuild. emerge failed on my dual Athlon system until I commented the above line out of the ebuild.

Comment 7 Bryan Whitehead 2004-01-04 11:37:50 UTC
I get the error. I have no -fPIC in my CFLAGS but the build addes it in... then fails.

if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../utils    -mcpu=i686 -march=i686 -O3 -fomit-frame-pointer -pipe -march=athlon -ffast-math -fno-strength-reduce -mno-sse2 -Wall -Wunused -fPIC -MT cpu_accel.o -MD -MP -MF ".deps/cpu_accel.Tpo" \  -c -o cpu_accel.o `test -f 'cpu_accel.c' || echo './'`cpu_accel.c; \
then mv -f ".deps/cpu_accel.Tpo" ".deps/cpu_accel.Po"; \
else rm -f ".deps/cpu_accel.Tpo"; exit 1; \
fi
cpu_accel.c: In function `x86_accel':
cpu_accel.c:87: error: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:104: error: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:110: error: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:132: error: can't find a register in class `BREG' while reloading `asm'
cpu_accel.c:136: error: can't find a register in class `BREG' while reloading `asm'


CFLAGS="-O3 -fomit-frame-pointer -pipe -march=athlon -ffast-math -fno-strength-reduce"

oddly, this package also forces -mcpu=i686 -march=i686 then addes my -march=athlon

Should this be fixes as well?
Comment 8 nma 2004-01-04 23:20:06 UTC
I agree that that patch should be removed from portage.  The reason is that cpu_accel.c uses the ebx register which PIC uses. Thus, the -fPIC CFLAG causes the above compile errors.  
Comment 9 Stephan Kapfinger 2004-01-09 06:33:43 UTC
mjpegtools-1.6.1.90-r1 failed on my athlox xp system, too. Removing the fPIC.patch solved the problem.
Comment 10 Stephan Kapfinger 2004-01-09 06:43:31 UTC
Whoops, I wanted to say mjpegtools-1.6.1.91, not 90.
The new ebuild reintroduced the PIC patch which was removed from mjpegtools-1.6.1.90 :(
Comment 11 Owen Gunden 2004-01-10 10:05:25 UTC
Yet another test result:

mjpegtools-1.6.1.91 fails to build as-is, with the PIC patch.
commenting out the PIC patch line, it works.
Comment 12 Tal Peer (RETIRED) gentoo-dev 2004-01-11 07:06:49 UTC
Same here.
AFAICT the patch should only be applied on non-x86 archs.
Comment 13 Sumit Khanna 2004-01-15 07:23:44 UTC
I am running a Dual Athlon-XP system and commenting out the fPIC patch in the ebuild fixed my compile process as well.
Comment 14 Tro 2004-01-15 14:51:22 UTC
Ditto.

Running AthlonXP, no -fPIC flag in USE. Doesn't compile unless the epatch ${FILESDIR}/${P}-fPIC.patch line is commented out in the ebuild.
Comment 15 Wout Mertens (RETIRED) gentoo-dev 2004-01-16 09:21:30 UTC
Made it optional on ARCH in the 1.92 version. Works for me, please test and reopen if problems.