[mesa-users] Solution to "ld: archive has no table of contents for architecture x86_64" in gyre
Kevin Moore
kmoore at physics.ucsb.edu
Tue Aug 6 19:46:41 EDT 2013
Hey all,
So I came across a compile-time error when building MESA 5271 on my Mac (OSX 10.7.5), which is fixed with a small modification to Rich's makefile for gyre. Yes, I'm using the up to date SDK - revision 203 (20130408).
gfortran -v:
Using built-in specs.
COLLECT_GCC=/Applications/mesasdk/bin/gfortran.exec
COLLECT_LTO_WRAPPER=/Applications/mesasdk/libexec/gcc/x86_64-apple-darwin11.4.2/4.9.0/lto-wrapper
Target: x86_64-apple-darwin11.4.2
Configured with: ./configure CC='gcc -D_FORTIFY_SOURCE=0' --build=x86_64-apple-darwin11.4.2 --prefix=/Applications/mesasdk --with-gmp=/Applications/mesasdk --with-mpfr=/Applications/mesasdk --with-mpc=/Applications/mesasdk --enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.9.0 20130408 (experimental) (GCC)
uname -a:
Darwin kmoore.physics.ucsb.edu 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64 i386
echo $MESASDK_ROOT
/Applications/mesasdk
echo $PATH
/Applications/mesasdk/bin:/opt/globus/bin:/opt/globus/sbin:/Library/Frameworks/EPD64.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/opt/local/bin:/opt/local/sbin:/opt/intel/composerxe-2011.4.184/bin/intel64:/opt/intel/composerxe-2011.4.184/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/Kevin/mpich-install/bin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin:/Library/Ruby/bin:/usr/texbin:/Users/Kevin/.rvm/bin:/opt/intel/composerxe-2011.4.184/mpirt/bin/intel64
The error happens during the linking step of the gyre module:
make: `libgyre.a' is up to date.
gfortran -fopenmp -o ../tester test_gyre.o -L../../make -lgyre `mesasdk_lapack_link` -L../../../lib -lconst
ld: archive has no table of contents for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [tester] Error 1
I actually encountered practically the same error when linking the MA28 library while compiling FLASH on my laptop, so know how to fix it. One way is to run the command "ranlib libgyre.a" to update the library file in mesa/gyre/make. The root of this problem seems to be that gyre's makefile creates libgyre.a (line 45) using the command
"ar cr libgyre.a *.o"
However, the command for making library files for other MESA modules is found in mesa/utils/makefile_header on line 148:
# LIB_TOOL creates libraries
LIB_TOOL = ar crs
Using "ar s libgyre.a" is equivalent to running "ranlib libgyre.a", so changing line 45 of mesa/gyre/make/makefile to
"@ar crs libgyre.a *.o" fixes things for me. No idea why no one else encountered this problem though...
-Kevin
More information about the Mesa-users
mailing list