Re: Fortran trouble
On Thu, Oct 06, 2005 at 12:39:04PM -0400, Adam C Powell IV wrote:
> In an effort to finally complete the mpich transition, last night I
> built and uploaded libf2c2 for arm (why it didn't autobuild is beyond
> me), then tried to build scalapack. The build failed when trying to
> link a binary:
> gcc -o /home/hazelsct/scalapack-1.7/TESTING/xigemr pigemrdrv.o
> -L /home/hazelsct/scalapack-1.7 -lscalapack-lam -lblacsCinit-lam
> -lblacs-lam -lblacsCinit-lam -lmpi -llapack -lblas -lf2c -lm
> /usr/lib/gcc/arm-linux-gnu/4.0.2/../../../libf2c.so: undefined reference
> to `MAIN__'
> collect2: ld returned 1 exit status
> make: *** [/home/hazelsct/scalapack-1.7/TESTING/xigemr] Error 1
> make: Leaving directory `/home/hazelsct/scalapack-1.7/REDIST/TESTING'
> make: *** [redistexe] Error 2
> make: Leaving directory `/home/hazelsct/scalapack-1.7'
> make: *** [build-stamp-lam] Error 2
> PPC died in the same step with a different error, see
> Since this works on eight architectures, I suspect problems in the arm
> and PPC toolchains. Any ideas?
It seems gcc 4.x is much different in treatment of functions which are
only called from assembly code. It seems to figure that if it sees
nothing using the function (and it doesn't look in the inline assembly)
then it can optimize it away. Then the linker of course whines about
the function called from assembly doesn't exist anywhere.
This hit mozilla and nvu on arm, among others. It is probably similar
in this case.
In mozilla's case it was fixed by adding a flag telling the compiler
that the function is in fact used even if it appears not to be.