Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 166521 - [fPIC] sci-mathematics/scilab-4.1 won't compile (linking error)
Summary: [fPIC] sci-mathematics/scilab-4.1 won't compile (linking error)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: AMD64 Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-12 16:32 UTC by Sylvain Raybaud
Modified: 2007-03-24 09:57 UTC (History)
4 users (show)

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


Attachments
compile log (sci-mathematics:scilab-4.1:20070212-152803.log,116.61 KB, text/plain)
2007-02-12 22:02 UTC, Sylvain Raybaud
Details
another log (sci-mathematics:scilab-4.1:20070214-200458.log,122.65 KB, text/plain)
2007-02-14 20:24 UTC, Scott Short
Details
patch to fix screwed up scilab makefile (scilab-4.1-java-pic.patch,1.57 KB, text/plain)
2007-03-11 18:38 UTC, Markus Dittrich (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Raybaud 2007-02-12 16:32:43 UTC
upgrade from 4.0 to 4.1 failed during linking :

Creation of ../../bin/libjavasci.so
linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: ../../routines/default/FTables.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../routines/default/FTables.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [../../bin/libjavasci.so] Error 1

USE="gtk java ocaml -Xaw3d -debug -tk"

Reproducible: Always

Steps to Reproduce:
emerge -auv scilab




I have been told by emerge to include the following information :

GENTOO_VM=sun-jdk-1.6  CLASSPATH="" JAVA_HOME="/opt/sun-jdk-1.6.0"
JAVACFLAGS="-source 1.4 -target 1.4" COMPILER=""

sylvain@wonderland ~/system $ emerge --info
Portage 2.1.2-r9 (!/usr/portage/profiles/default-linux/amd64/2006.1/desktop/, gcc-4.1.1, glibc-2.5-r0, 2.6.18-gentoo-r3 x86_64)
=================================================================
System uname: 2.6.18-gentoo-r3 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
Gentoo Base System release 1.12.9
Timestamp of tree: Sun, 11 Feb 2007 22:20:01 +0000
dev-java/java-config: 1.3.7, 2.0.31-r3
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.13-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.20
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-march=athlon64 -O2 -pipe"
DISTDIR="/var/portage/distfiles"
FEATURES="autoconfig ccache confcache distlocks metadat-transfer metadata-transfer parallel-fetch sandbox sfperms strict userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://gentoo.imj.fr/pub/gentoo http://cudlug.cudenver.edu/gentoo http://gentoo.modulix.net/gentoo http://ftp.club-internet.fr/pub/mirrors/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LINGUAS="en fr en_GB"
MAKEOPTS="-j3"
PKGDIR="/var/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/dev/shm/portage"
PORTDIR="/var/portage"
PORTDIR_OVERLAY="/var/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac aalib alsa amd64 arts bash-completion berkdb bitmap-fonts bzip2 cairo cddb cdr cli cracklib crypt dbus dlloader dri dvd dvdr dvdread eds emboss encode esd fam firefox flac fortran gdbm gif gpm gstreamer gtk gtk2 hal iconv ieee1394 ipv6 isdnlog java jpeg kde kdeenablefinal ldap libcaca libg++ lm_sensors mad mikmod mp3 mpeg ncurses nls nptl nptlonly nvidia ogg opengl oss pam pcre pdf perl png ppds pppd python qt3 qt4 quicktime readline reflection samba sdl session socks5 spell spl ssl svg tcpd tetex theora truetype truetype-fonts type1-fonts udev unicode vorbis xml xorg xscreensaver xv zlib" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LINGUAS="en fr en_GB" USERLAND="GNU" VIDEO_CARDS="nvidia nv"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS

It's the first time I fill a bugrepport so please tell me if I made something wrong or if I didn't provide enough pieces of information.
Comment 1 Simon Stelling (RETIRED) gentoo-dev 2007-02-12 19:29:54 UTC
> sylvain@wonderland ~/system $ emerge --info
> Portage 2.1.2-r9 (!/usr/portage/profiles/default-linux/amd64/2006.1/desktop/,

Please reset your profile link. It should point to a directory within PORTDIR, i.e. /var/portage/profiles/default-linux/amd64/2006.1/desktop in your case.
Comment 2 James Brown 2007-02-12 20:12:39 UTC
Same build error here. I'm pretty sure this is a hardened gcc-related error. Isn't gcc hardened by default on amd64?

(I will post my emerge --info if you want it, but I don't think it's relevant)
Comment 3 Simon Stelling (RETIRED) gentoo-dev 2007-02-12 21:11:21 UTC
(In reply to comment #2)
> Same build error here. I'm pretty sure this is a hardened gcc-related error.
> Isn't gcc hardened by default on amd64?

Nope, hardened is not standard. But I can't reproduce the problem here (using a normal toolchain), even though I'm using the same USE flags. But it doesn't look like a typical hardened problem to me. 

@hardened: could you give it a try and see whether it works/fails for you?
Comment 4 Sylvain Raybaud 2007-02-12 21:52:26 UTC
(In reply to comment #1)
> > sylvain@wonderland ~/system $ emerge --info
> > Portage 2.1.2-r9 (!/usr/portage/profiles/default-linux/amd64/2006.1/desktop/,
> 
> Please reset your profile link. It should point to a directory within PORTDIR,
> i.e. /var/portage/profiles/default-linux/amd64/2006.1/desktop in your case.
> 

done, but scilab still fails to compile, with the exact same problem.
thanks for the tip anyway.
Comment 5 Kevin F. Quinn (RETIRED) gentoo-dev 2007-02-12 21:54:54 UTC
(In reply to comment #0)
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
> ../../routines/default/FTables.o: relocation R_X86_64_32 against `a local
> symbol' can not be used when making a shared object; recompile with -fPIC
> ../../routines/default/FTables.o: could not read symbols: Bad value

My amd64 box is down at the moment, so can't try - but since the compiler in use by the reporter is 4.1.1, then it's unlikely to be hardened (I haven't put it in the tree yet!).

The error message is complaining about non-PIC code in shared libraries - x86-64 simply does not support non-PIC code in shared libraries; it doesn't do TEXTRELs.  Doesn't need to - you have rip-relative addressing which really goes a long way to removing one of the biggest limitations of x86.

Check the compilation line for FTables.o - if it doesn't contain '-fPIC' then clearly it's a makefile issue.  Attaching a complete build log would be useful.

One other possibility I've come across recently, is local-exec TLS; if the code is using thread data with the default TLS model (i.e. local-exec), it'll cause this sort of error message.  Had a quick look at the code though, and couldn't see anything like this.
Comment 6 Sylvain Raybaud 2007-02-12 22:02:36 UTC
Created attachment 110003 [details]
compile log

this is the log file generated by portage
Comment 7 Sylvain Raybaud 2007-02-12 22:05:27 UTC
(In reply to comment #5)
> (In reply to comment #0)
> > /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
> > ../../routines/default/FTables.o: relocation R_X86_64_32 against `a local
> > symbol' can not be used when making a shared object; recompile with -fPIC
> > ../../routines/default/FTables.o: could not read symbols: Bad value
> 
> My amd64 box is down at the moment, so can't try - but since the compiler in
> use by the reporter is 4.1.1, then it's unlikely to be hardened (I haven't put
> it in the tree yet!).

indeed it's not.

> Check the compilation line for FTables.o - if it doesn't contain '-fPIC' then
> clearly it's a makefile issue.  Attaching a complete build log would be useful.

you mean something like that ? (full log attached)

sylvain@wonderland ~ $ grep FTables system/sci-mathematics\:scilab-4.1\:20070212-152803.log
gcc -march=athlon64 -O2 -pipe `pkg-config gtk+-2.0 --cflags`   -c -o FTables.o FTables.c

I indeed see no fPIC here...


> 
> One other possibility I've come across recently, is local-exec TLS; if the code
> is using thread data with the default TLS model (i.e. local-exec), it'll cause
> this sort of error message.  Had a quick look at the code though, and couldn't
> see anything like this.
> 

do you know of a way to test this hypothesis ?
Comment 8 solar (RETIRED) gentoo-dev 2007-02-12 22:33:33 UTC
This does not appear to be limited to hardened. 
Removing hardened from the CC: list.
Comment 9 Kevin F. Quinn (RETIRED) gentoo-dev 2007-02-12 23:46:46 UTC
ok; as you say, the log clearly shows the object wasn't compiled -fPIC, yet it tried linking it into a shared library.  blubb - how does your log compare?

FWIW I get the same when building on x86 (didn't let it complete because I didn't want to install all the dependencies - but the object is not compiled -fPIC so will likely generate TEXTRELS when linked into the shared library).
Comment 10 Scott Short 2007-02-14 20:20:59 UTC
Just trying to help with some more info - slightly different system:

 Creation of ../../bin/libjavasci.so
linking
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld: ../../routines/default/FTables.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../routines/default/FTables.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [../../bin/libjavasci.so] Error 1
make[1]: Leaving directory `/var/tmp/portage/sci-mathematics/scilab-4.1/work/scilab-4.1/routines/Javasci'
make: *** [scilex-lib] Error 2

!!! ERROR: sci-mathematics/scilab-4.1 failed.
Call stack:
  ebuild.sh, line 1614:   Called dyn_compile
  ebuild.sh, line 971:   Called qa_call 'src_compile'
  environment, line 5123:   Called src_compile
  scilab-4.1.ebuild, line 108:   Called die

!!! emake failed
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at '/var/log/portage/sci-mathematics:scilab-4.1:20070214-200458.log'.

!!! When you file a bug report, please include the following information:
GENTOO_VM=blackdown-jdk-1.4.2  CLASSPATH="" JAVA_HOME="/opt/blackdown-jdk-1.4.2.03"
JAVACFLAGS="-source 1.4 -target 1.4" COMPILER=""
and of course, the output of emerge --info

Portage 2.1.2-r9 (default-linux/amd64/2006.1, gcc-4.1.2, glibc-2.5-r0, 2.6.20-gentoo x86_64)
=================================================================
System uname: 2.6.20-gentoo x86_64 AMD Turion(tm) 64 Mobile Technology ML-34
Gentoo Base System version 1.12.9
Timestamp of tree: Wed, 14 Feb 2007 16:28:01 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.31-r3
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r6
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.20
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -msse3 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=k8 -O2 -msse3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks fixpackages metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://node0.gensho http://www.gtlib.gatech.edu/pub/gentoo"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://node0.gensho/gentoo-portage"
USE="X acpi aiglx alsa amd64 berkdb bitmap-fonts bzip2 cairo cli cracklib crypt cups curl dbus divx dlloader dri dvd dvdr dvdread fortran gdbm gif glitz gmedia gnutls gpm gtk gtkhtml iconv ipv6 isdnlog java jpeg libg++ logrotate mailwrapper mbox midi mikmod moznoirc moznomail mp3 ncurses nls nptl nptlonly nsplugin objc objc++ offensive opengl oss pam pcre pdf perl png ppds pppd python quicktime readline realmedia reflection ruby session spell spl ssl tcpd tiff truetype truetype-fonts type1-fonts unicode usb wmp xorg zlib" ALSA_CARDS="atiixp" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="radeon fglrx"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

Comment 11 Scott Short 2007-02-14 20:24:27 UTC
Created attachment 110203 [details]
another log
Comment 12 emanuele 2007-03-08 17:08:25 UTC
same issue here.. any news?
thanks
Comment 13 Markus Dittrich (RETIRED) gentoo-dev 2007-03-11 18:38:10 UTC
Created attachment 112986 [details]
patch to fix screwed up scilab makefile

This whole mess is likely due to a screwed up scilab makefile.
The object file FTables.o is not supposed to be linked into
libjavasci.so or any other *.so for that matter (since it is non PIC code).
I've attached a patch that might fix this. Please REPLACE the existing
scilab-4.0-java-pic.patch with it and give it a spin. Unfortunately, I don't
have an amd64 box to test it myself.

BTW: If you guys are compiling fortran code (such as scilab) you will have
to explicitly set FFLAGS otherwise no compiler flags are being passed
to gfortran. If you generally use gfortran, as opposed to, e.g., ifc/ifort, the easiest
solution would be to just put  

FFLAGS="${CFLAGS}"

into your make.conf.

Thanks,
Markus
Comment 14 emanuele 2007-03-19 14:14:55 UTC
Patch work fine for me.
thanks

(In reply to comment #13)
> Created an attachment (id=112986) [edit]
> patch to fix screwed up scilab makefile
> 
> This whole mess is likely due to a screwed up scilab makefile.
> The object file FTables.o is not supposed to be linked into
> libjavasci.so or any other *.so for that matter (since it is non PIC code).
> I've attached a patch that might fix this. Please REPLACE the existing
> scilab-4.0-java-pic.patch with it and give it a spin. Unfortunately, I don't
> have an amd64 box to test it myself.
> 
> BTW: If you guys are compiling fortran code (such as scilab) you will have
> to explicitly set FFLAGS otherwise no compiler flags are being passed
> to gfortran. If you generally use gfortran, as opposed to, e.g., ifc/ifort, the
> easiest
> solution would be to just put  
> 
> FFLAGS="${CFLAGS}"
> 
> into your make.conf.
> 
> Thanks,
> Markus
> 

Comment 15 Markus Dittrich (RETIRED) gentoo-dev 2007-03-20 13:13:37 UTC
Thanks for testing!

@amd64: I've just committed this patch to cvs and from my point
                of view this bug can be closed.

Thanks,
Markus
Comment 16 Simon Stelling (RETIRED) gentoo-dev 2007-03-24 09:57:27 UTC
cool, thanks