Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 98494 - Prelink does not work with media-libs/libdts-0.0.2-r1 - missing -fPIC in CFLAGS
Summary: Prelink does not work with media-libs/libdts-0.0.2-r1 - missing -fPIC in CFLAGS
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: PPC Linux
: High normal
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-09 13:40 UTC by Martin Qvist
Modified: 2006-01-31 20:14 UTC (History)
2 users (show)

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


Attachments
libdts-0.0.2-r1 build on PPC (libdts-0.0.2-r1.log,28.24 KB, text/plain)
2005-08-01 06:33 UTC, Joe Jezak (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Qvist 2005-07-09 13:40:50 UTC
The -fPIC is not set while building media-libs/libdts-0.0.2-r1. This causes
problems when running with prelink on PPC. 

Reproducible: Always
Steps to Reproduce:
1. emerge prelink
2. emerge libdts-0.0.2-r1
3. prelink -amR

Actual Results:  
You get the standard "Cannot prelink against non-PIC shared library" as
mentioned in the Gentoo Linux Prelink Guide.

Expected Results:  
Set -fPIC in CFLAGS. In fact you can do this manually in /etc/make.conf to
temporarily circumvent the problem.
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-07-15 06:28:18 UTC
Hmm it seems to be fixed in -r1. On AMD64 it builds shared libraries so it 
must be using -fPIC. 
PPC team? 
Comment 2 Ivan Yosifov 2005-07-19 05:09:23 UTC
I am too seeing this with libdts-0.0.2-r1 on x86.
Comment 3 Joe Jezak (RETIRED) gentoo-dev 2005-07-20 19:42:45 UTC
It doesn't use -fPIC at all on PPC, so I think it would be better to restore the
old behaviour of forcing -fPIC on for the whole package.  Diego, what do you think?
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-07-21 03:00:41 UTC
There are two apps, don't think adding it to all flags is good. 
I'll prepare a patch fixing this. 
 
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-07-21 03:17:59 UTC
Try with 0.0.2-r2 and report if it works now. 
 
Comment 6 Ivan Yosifov 2005-07-21 08:25:10 UTC
Works here :)
Comment 7 Jeremy Huddleston (RETIRED) gentoo-dev 2005-07-27 02:31:52 UTC
Ack... no, you're breaking things =(.  Now you're having libdts.a compiled with
-fPIC which is very bad.

media-libs/libdts-0.0.2-r1 is building properly for me on x86 and amd64 (-fPIC
for shared libs and no -fPIC for static and binaries).   Forcing -fPIC on
unconditionally like that is never the right way to do it.

Also, NEVER EVER EVER put -fPIC in CFLAGS in /etc/make.conf!!! If you do that,
you will get NO support from gentoo devs as it will break things.


See... It's doing it right (notice -fPIC -DPIC -o .libs/bitstream.o for the
shared lib and no -fPIC for bitstream.o for the static lib):
<snip>
if /bin/sh ../libtool --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.
-I. -I.. -I../include -I../include   -Wall  -pipe -fomit-frame-pointer
-ffast-math -march=athlon64 -O3 -fomit-frame-pointer   -MT bitstream.lo -MD -MP
-MF ".deps/bitstream.Tpo" \
  -c -o bitstream.lo `test -f 'bitstream.c' || echo './'`bitstream.c; \
then mv -f ".deps/bitstream.Tpo" ".deps/bitstream.Plo"; \
else rm -f ".deps/bitstream.Tpo"; exit 1; \
fi
mkdir .libs
 x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include
-Wall -pipe -fomit-frame-pointer -ffast-math -march=athlon64 -O3
-fomit-frame-pointer -MT bitstream.lo -MD -MP -MF .deps/bitstream.Tpo -c
bitstream.c  -fPIC -DPIC -o .libs/bitstream.o
bitstream.c: In function `bitstream_fill_current':
bitstream.c:58: warning: dereferencing type-punned pointer will break
strict-aliasing rules
bitstream.c:58: warning: dereferencing type-punned pointer will break
strict-aliasing rules
 x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include
-Wall -pipe -fomit-frame-pointer -ffast-math -march=athlon64 -O3
-fomit-frame-pointer -MT bitstream.lo -MD -MP -MF .deps/bitstream.Tpo -c
bitstream.c -o bitstream.o >/dev/null 2>&1
<snip>
Comment 8 Joe Jezak (RETIRED) gentoo-dev 2005-08-01 06:33:40 UTC
Created attachment 64865 [details]
libdts-0.0.2-r1 build on PPC

The problem is that it doesn't turn on fPIC on ppc like on x86 and amd64.  It
does detect fPIC properly during the configure but doesn't actually use it. 
I'm not really sure where to look into fixing this, but if you let me know what
you need I'll take a look.  I've included the output of the build to start
with.
Comment 9 Jeremy Huddleston (RETIRED) gentoo-dev 2005-08-01 10:14:00 UTC
what if we use automake 1.9 (update WANT_AUTOMAKE in the ebuild), aucoconf-2.59,
and the latest libtool?  There might be some ppc related rules in that were
broken.  The configure script properly finds that you CAN use -fPIC, but for
some reason, it decides not to do it... which lends me to suspect libtool
breakage since it proceeds to find -fprefer-no-pic  I'll look through
configure.in as well to see if there's something funny going on to which amd64
was just an exception.
Comment 10 Joe Jezak (RETIRED) gentoo-dev 2005-08-03 19:59:07 UTC
I've got the latest libtool installed and I tried automake-1.9 and autoconf
2.59, but there was no change in the behaviour.
Comment 11 Jeremy Huddleston (RETIRED) gentoo-dev 2005-08-04 01:03:18 UTC
Then could you please trace the problem.  Are other libtool libs not being built
properly on your system?
Comment 12 Joe Jezak (RETIRED) gentoo-dev 2005-08-04 07:00:47 UTC
I checked, and it builds libmad correctly.  I checked the Makefile and it does
not hardcode -fPIC and yet correctly uses it.  Do you have a suggestion for
another package to test?
Comment 13 Jeremy Huddleston (RETIRED) gentoo-dev 2005-08-04 10:41:56 UTC
Ok, then can you get me access to a ppc box with a chroot already setup for me
to play around in to investigate this fix for you?
Comment 14 Jeremy Huddleston (RETIRED) gentoo-dev 2005-08-26 12:11:11 UTC
ok... well I'm gonna use the correct patch for everyone and leave it broken for
ppc... if you guys are interested in fixing this, please get me access.
Comment 15 Neil Darlow 2005-09-11 10:03:24 UTC
This is an issue on x86 too for libdts-0.0.2-r3. I don't think it's just
PPC-specific.

Regards,
Neil Darlow
Comment 16 Jochen Trumpf 2005-10-12 19:38:19 UTC
I can confirm comment #15: -fPIC does not get turned on. Here is a (compressed) 
excerpt from the emerge output: -fPIC support gets detected correctly, but then 
apparently overwritten by -prefer-no-pic. 
 
checking for i686-pc-linux-gnu-gcc option to produce PIC... -fPIC 
checking if i686-pc-linux-gnu-gcc PIC flag -fPIC works... yes 
checking for i686-pc-linux-gnu-g++ option to produce PIC... -fPIC 
checking if i686-pc-linux-gnu-g++ PIC flag -fPIC works... yes 
checking for i686-pc-linux-gnu-g77 option to produce PIC... -fPIC 
checking if i686-pc-linux-gnu-g77 PIC flag -fPIC works... yes 
checking if libtool supports -prefer-non-pic flag... yes 
if /bin/sh ../libtool --mode=compile i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. 
-I. -I.. -I../include -I../include   -Wall  -march=pentium4 -funroll-loops 
-pipe -O3 -fomit-frame-pointer -mcpu=pentiumpro -prefer-non-pic  -MT 
bitstream.lo -MD -MP -MF ".deps/bitstream.Tpo" \ 
if /bin/sh ../libtool --mode=compile i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. 
-I. -I.. -I../include -I../include   -Wall  -march=pentium4 -funroll-loops 
-pipe -O3 -fomit-frame-pointer -mcpu=pentiumpro -prefer-non-pic  -MT parse.lo 
-MD -MP -MF ".deps/parse.Tpo" \ 
if /bin/sh ../libtool --mode=compile i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. 
-I. -I.. -I../include -I../include   -Wall  -march=pentium4 -funroll-loops 
-pipe -O3 -fomit-frame-pointer -mcpu=pentiumpro -prefer-non-pic  -MT downmix.lo 
-MD -MP -MF ".deps/downmix.Tpo" \ 
/bin/sh ../libtool --mode=link i686-pc-linux-gnu-gcc -Wall  -march=pentium4 
-funroll-loops -pipe -O3 -fomit-frame-pointer -mcpu=pentiumpro -prefer-non-pic   
-Wl,-O1 -o libdts.la -rpath /usr/lib -no-undefined bitstream.lo parse.lo 
downmix.lo -lm 
 
output of emerge info: 
Portage 2.0.51.22-r2 (default-linux/x86/2005.0, gcc-3.3.6, glibc-2.3.5-r1, 
2.6.12-suspend2-r6 i686) 
================================================================= 
System uname: 2.6.12-suspend2-r6 i686 Intel(R) Pentium(R) M processor 1700MHz 
Gentoo Base System version 1.6.13 
dev-lang/python:     2.3.5-r2 
sys-apps/sandbox:    1.2.12 
sys-devel/autoconf:  2.13, 2.59-r6 
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.15.92.0.2-r10 
sys-devel/libtool:   1.5.18-r1 
virtual/os-headers:  2.6.11-r2 
ACCEPT_KEYWORDS="x86" 
AUTOCLEAN="yes" 
CBUILD="i686-pc-linux-gnu" 
CFLAGS="-O3 -march=pentium4 -funroll-loops -pipe" 
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 /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-O3 -march=pentium4 -funroll-loops -pipe" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoconfig distlocks sandbox sfperms strict" 
GENTOO_MIRRORS="http://mirror.pacific.net.au/linux/Gentoo" 
LDFLAGS="-Wl,-O1" 
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 a52 aac acl acpi activefilter alsa arts artswrappersuid atlas 
audiofile avi berkdb bitmap-fonts bzip2 cddb cdparanoia cdr crypt cups curl dga 
dhcp divx4linux doc dts dv dvd dvdr dvdread emacs encode fam fame ffmpeg flac 
foomaticdb fortran fpx gcj gd gdbm gif gimp gimpprint gphoto2 gpm graphviz 
gstreamer ieee1394 imagemagick imlib immqt ipv6 java javascript jbig jpeg 
jpeg2k kde kdeenablefinal kerberos latex lcms ldap libg++ libwww live lzo 
lzw-tiff mad mikmod mmx mmxext mng motif mozilla mozsvg mp3 mpeg mysql ncurses 
network nls nodrm nptl nptlonly nsplugin nvidia objc odbc ogg oggvorbis openexr 
opengl pam pcre pdflib perl pic png ppds python qt quicktime readline real rtc 
sasl scanner sdk slang slp sndfile speex spell sse sse2 ssl svg tcltk tcpd 
tetex theora threads tiff truetype truetype-fonts type1-fonts ucs2 unicode usb 
vorbis wifi win32codecs wmf xanim xine xml xml2 xprint xv xvid xvmc zlib 
userland_GNU kernel_linux elibc_glibc" 
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LINGUAS 
 
Comment 17 Stephan Sokolow 2005-10-22 19:38:39 UTC
I can confirm that libdts-0.0.2-r3 produces non-PIC shared libs on my x86 box.
Comment 18 Joe Jezak (RETIRED) gentoo-dev 2006-01-31 18:23:20 UTC
It's currently working again here on ppc.  I'm not sure what changed, but I'm reassigning this bug to the sound herd instead of ppc.
Comment 19 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-01-31 20:14:37 UTC
Well that was fixed some time ago.