Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 26765 - Bestcrypt fails to compile with -fPIC
Summary: Bestcrypt fails to compile with -fPIC
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-16 18:44 UTC by Brandy Westcott (RETIRED)
Modified: 2003-08-18 07:03 UTC (History)
0 users

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 Brandy Westcott (RETIRED) gentoo-dev 2003-08-16 18:44:17 UTC
If -fPIC is enabled in CFLAGS, both bestcrypt-1.2_p2 and bestcrypt-1.2_p5 fail to 
compile: 
 
gcc -c -D__KERNEL__ -DMODULE 
-I/var/tmp/portage/bestcrypt-1.2_p2/work/bcrypt/mod/../include/ 
-I/lib/modules/2.4.20-gentoo-r5/build/include/ -fPIC -Wall -fno-strength-reduce    -c 
-o bc_dev.o bc_dev.c 
In file included from /lib/modules/2.4.20-gentoo-r5/build/include/asm/pgtable.h:17, 
                 from /lib/modules/2.4.20-gentoo-r5/build/include/linux/mm.h:44, 
                 from /lib/modules/2.4.20-gentoo-r5/build/include/linux/slab.h:14, 
                 from /lib/modules/2.4.20-gentoo-r5/build/include/linux/proc_fs.h:5, 
                 from bc_dev24.c:42, 
                 from bc_dev.c:31: 
/lib/modules/2.4.20-gentoo-r5/build/include/asm/fixmap.h: In function `virt_to_fix': 
/lib/modules/2.4.20-gentoo-r5/build/include/asm/fixmap.h:134: warning: asm operand 
1 probably doesn't match constraints 
In file included from bc_dev.c:31: 
bc_dev24.c: In function `bc_make_request': 
bc_dev24.c:404: warning: asm operand 1 probably doesn't match constraints 
bc_dev24.c:404: inconsistent operand constraints in an `asm' 
make[1]: *** [bc_dev.o] Error 1 
make[1]: Leaving directory `/var/tmp/portage/bestcrypt-1.2_p2/work/bcrypt/mod' 
make: *** [subdirs] Error 2 
 
!!! ERROR: app-crypt/bestcrypt-1.2_p2 failed. 
!!! Function einstall, Line 343, Exitcode 2 
!!! einstall failed 
 
Without the -fPIC flag it compiles just fine. filter-flags -fPIC should be included in the 
ebuilds. 

Reproducible: Always
Steps to Reproduce:
1. include -fPIC in CFLAGS 
2. emerge bestcrypt 
3. 
Actual Results:  
compile failed 

Expected Results:  
emerge successfully 

Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) 
================================================================= 
System uname: 2.4.20-gentoo-r5 i686 Intel(R) Pentium(R) 4 CPU 2.00GHz 
GENTOO_MIRRORS="ftp://ftp.citylink.co.nz/gentoo http://gentoo.oregonstate.edu/ 
http://www.ibiblio.org/pub/Linux/distributions/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 apm avi crypt cups encode foomaticdb gif gpm jpeg gnome libg++ 
mad mikmod mmx mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms 
xv zlib gtkhtml gdbm berkdb slang readline arts bonobo svga java X sdl tcpd pam 
libwww ssl perl python esd imlib oggvorbis gtk qt kde motif opengl 3dfx cdr doc dvd 
sse tcltk tetex -3dnow" 
COMPILER="gcc3" 
CHOST="i686-pc-linux-gnu" 
CFLAGS="-fPIC" 
CXXFLAGS="-fPIC" 
ACCEPT_KEYWORDS="x86" 
MAKEOPTS="-j2" 
AUTOCLEAN="yes" 
SYNC="rsync://rsync.gentoo.org/gentoo-portage" 
FEATURES="sandbox ccache"
Comment 1 Reporter 2003-08-16 19:44:46 UTC
Why is everyone in gentoo world so obsessed compiling everything with -fPIC?
-fPIC is only needed (and useful) when compiling shared libraries. (actually,
on linux shared libs even work without it, only drawback being that 
relocations are fixed in the actual code section rather than the GOT; i.e, 
copy-on-write kicks in and code sections aren't shared between multiple 
instances anymore)

Enabling it in CFLAGS and compiling programs with it doesn't make the least 
bit of sense and is just asking for trouble. If some makefile neglects to 
enable it (or uses -fPIC instead of -fpic because of some braindead
makefile/libtool for some architecture) when building shared libs, fix the
broken build procedure. Using it in all compilations will in the best case 
increase code size and decrease performance because of additional indirections
and GOT-section, and in the worst scenario case cause programs to act funny 
or prevent them from compiling at all.

Comment 2 Reporter 2003-08-16 20:03:27 UTC
just noticed bestcrypt is a kernel module; in that case, -fPIC is actually 
a surefire way to break it!
Comment 3 Brandy Westcott (RETIRED) gentoo-dev 2003-08-17 17:24:26 UTC
I agree totally. -fPIC is overused and when moderating the Gentoo forums I see an 
unceasing number of posts about compiles breaking all because of this flag. The 2nd 
person on IRC asking why bestcrypt wouldn't compile prompted me to report this 
"bug". Protecting newbies from themselves is sometimes invaluable. :) 
Comment 4 Martin Holzer (RETIRED) gentoo-dev 2003-08-18 07:03:03 UTC
-fPIC in CFLAGS is not supported.