Bug 22696 - gsl-1.3 linking fails to find 'gsl_isnan'
Bug#: 22696 Product:  Gentoo Linux Version: unspecified Platform: x86
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: george@gentoo.org Reported By: markhollomon@comcast.net
Component: Library
URL: 
Summary: gsl-1.3 linking fails to find 'gsl_isnan'
Keywords:  
Status Whiteboard: 
Opened: 2003-06-12 13:38 0000
Description:   Opened: 2003-06-12 13:38 0000
emerge of gsl-1.3 leads to the following link error: 
 
/bin/sh ./libtool --mode=link gcc  -march=athlon -O3 -pipe -fomit-frame-pointer 
-ffast-math -fforce-addr -falign-functions=4  -o gsl-randist  gsl-randist.o libgsl.la 
cblas/libgslcblas.la -lm  
/bin/sh ./libtool --mode=link gcc  -march=athlon -O3 -pipe -fomit-frame-pointer 
-ffast-math -fforce-addr -falign-functions=4  -o gsl-histogram  gsl-histogram.o libgsl.la 
cblas/libgslcblas.la -lm  
gcc -march=athlon -O3 -pipe -fomit-frame-pointer -ffast-math -fforce-addr 
-falign-functions=4 -o .libs/gsl-randist gsl-randist.o  ./.libs/libgsl.so 
cblas/.libs/libgslcblas.so -lm 
gcc -march=athlon -O3 -pipe -fomit-frame-pointer -ffast-math -fforce-addr 
-falign-functions=4 -o .libs/gsl-histogram gsl-histogram.o  ./.libs/libgsl.so 
cblas/.libs/libgslcblas.so -lm 
../.libs/libgsl.so: undefined reference to `gsl_isnan' 
collect2: ld returned 1 exit status 
make[2]: *** [gsl-histogram] Error 1 
make[2]: *** Waiting for unfinished jobs.... 
/.libs/libgsl.so: undefined reference to `gsl_isnan' 
collect2: ld returned 1 exit status 
make[2]: *** [gsl-randist] Error 1 
make[2]: Leaving directory `/var/tmp/portage/gsl-1.3/work/gsl-1.3' 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory `/var/tmp/portage/gsl-1.3/work/gsl-1.3' 
make: *** [all-recursive-am] Error 2 
 
 
Portage 2.0.48-r1 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) 
 
 
Changing all the occurances of 'gsl_isnan' to just 'isnan' in the following files seems to work: 
	./eigen/symm.c 
	./eigen/symmv.c 
	./eigen/herm.c 
	./eigen/hermv.c 
 

Reproducible: Always
Steps to Reproduce:
1.
2.
3.



Portage 2.0.48-r1 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) 
================================================================= 
System uname: 2.4.19-r1 i686 AMD Athlon(tm) processor 
GENTOO_MIRRORS="http://gentoo.oregonstate.edu 
http://distro.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/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/config" 
CONFIG_PROTECT_MASK="/usr/kde/3/share/config /etc/init.d /etc/X11/xkb 
/etc/sound/events /etc/env.d /etc/pam.d /etc/metalog /etc/xinetd.d 
/usr/X11R6/lib/x11/xkb /etc/gconf /etc/env.d" 
PORTDIR="/usr/portage" 
DISTDIR="/usr/portage/distfiles" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR_OVERLAY="/usr/local/portage" 
USE="x86 oss 3dnow apm encode libg++ mikmod nls pdflib quicktime spell xml2 xmms 
gtkhtml berkdb slang tetex bonobo svga tcltk guile sdl tcpd libwww esd oggvorbis mozilla 
scanner X gtk cups samba gnome opengl motif arts avi crypt cdr gdbm gif gd gtk2 gpm 
gphoto2 imlib java jpeg maildir mbox mmx mpeg ncurses pam perl pnp postgres python qt 
qtmt readline ssl tiff truetype xv png zlib kde -alsa pda" 
COMPILER="gcc3" 
CHOST="i686-pc-linux-gnu" 
CFLAGS="-march=athlon -O3 -pipe -fomit-frame-pointer -ffast-math -fforce-addr 
-falign-functions=4" 
CXXFLAGS="-march=athlon -O3 -pipe -fomit-frame-pointer -ffast-math -fforce-addr 
-falign-functions=4" 
ACCEPT_KEYWORDS="x86 ~x86" 
MAKEOPTS="-j2" 
AUTOCLEAN="yes" 
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" 
FEATURES="sandbox ccache fixpackages"

------- Comment #1 From George Shapovalov 2003-06-13 19:31:53 0000 -------
Hi Mark.

I see you are using the -ffast-math. This flag is considered generally unsafe and I just checked - it made the build fail here as well with the same error. I guess this flag makes gcc omit some "standard" definitions, such as isnan in this case.

I have modified the ebuild to filter out this flag. Thanks for a report!
The modification is committed, please test.

George

PS, 
looking through your flags I spotted few basic things you might want to consider:
1. -fomit-frame-pointer is not necessary with -O2 or -O3
2. -O3 as compared to -O2 in general increases code size but does not have a stable effect on the execution speed. The difference is some additional loop unrolling, which can cause few percent speed improvement but can also cause similarly small slow-down. Additional testing with particular code is necessary to determine the effect in general.
3. adding -fpmath=sse,387 if yor athlon has sse module.
4. searching forums for more tips.

------- Comment #2 From George Shapovalov 2003-10-14 22:18:36 0000 -------
Reclosing the bug