Linking issue with 64-bit OS X Fortran code

I’m building a high-memory use version of Frealign, a program for protein crystallography. I’m building on OS X 10.5.2 with:

pgf90 7.1-5 64-bit target on Apple OS/X

The source seems to compile fine, but when it comes to linking, I get this error:

pgf90  frealign_v8.o frealign_v8.a -o ../bin/frealign_v8_osx.exe
call out of range from _MAIN_ (100001930) in frealign_v8.o to _foo_ (2E5FF1000) in frealign_v8.o
ld: rel32 out of range in _MAIN_ from frealign_v8.o
make: *** [frealign_v8] Error 2

With the program parameters I’m using, this program will allocate about 11.9 GB of static arrays on start up. On Linux, I can successfully compile this application using mcmodel=medium, but I haven’t had any luck yet with OS X.

Any help troubleshooting this would be much appreciated.

I just don’t think OSX is quite there yet wrt 64-bit support. One thing is to verify using the -v option that we are sending ld the -arch x86_64 flag.
It definitely looks like a 32 bit relocation error, where foo’s address
0x2E5FF1000 is > 2GB.

When I try some simple tests here that have static arrays > 2GB they link okay, but I get “bus error” when I run them.

I’ll try to find out more from some other contacts

Adding -v to the link flags seems to indicate the correct arch is being called:

pgf90 -v frealign_v8.o frealign_v8.a -o ../bin/frealign_v8_osx.exe

/usr/bin/ld /usr/lib/crt1.o /nfs/build/compilers/osx.i386/pgi/osx86-64/7.1-5/lib/pgimainxx.o /nfs/build/compilers/osx.i386/pgi/osx86-64/7.1-5/lib/f90main.o -arch x86_64 -L/nfs/build/compilers/osx.i386/pgi/osx86-64/7.1-5/lib -L/usr/lib -L/usr/lib/gcc/i686-apple-darwin9/4.0.1/x86_64 -L/usr/lib/gcc/i686-apple-darwin9/4.0.1 frealign_v8.o frealign_v8.a -o ../bin/frealign_v8_osx.exe -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lc -lnspgc -lpgc -lm -lgcc -lc -lgcc -lSystem
call out of range from _MAIN_ (100001930) in frealign_v8.o to _foo_ (2E5FF1000) in frealign_v8.o
ld: rel32 out of range in _MAIN_ from frealign_v8.o
pgf90-Fatal-linker completed with exit code 1

make: *** [frealign_v8] Error 2

For what it’s worth, the Intel compilers can link it right now either. I have a ticket open with them.

Got a similar error. Fixed it by changing the name of a subroutine /function.

I had modified an old function ‘functionVeryLongName’ and copied the older unused version to the name ‘functionVeryLongNameOriginal’ that I kept in the source code. When I commented out the ‘functionVeryLongNameOriginal’ my program compiled without the error.

After the last post, I also realized that commenting out this function also freed up a lot of unused allocated memory. It may be an issue of memory limits being exceeded.