"Undefined symbols for architecture x86_64"
Dear all,
I am having some troubles compiling fortran f90 codes and I really hope someone among you can enlighten me. Please note that I am not the author of the code. After discussing with him, it appears we have the same system (compiler, OS), and he can successfully compile while I can't. Which is slightly frustrating. We couldn't figure out what is happening, so here I am.
First, some details about my system:
- OS X 10.7.2, with XCode 4.1
gfortran-4.2 was downloaded and installed from: http://r.research.att.com/tools/ (gfortran-lion-5666-3.pkg)
and a 'gfortran-4.2 -v' (which is in /usr/bin/gfortran-4.2) returns:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
A 'gcc -v' (being in /usr/bin as well) returns:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/dst-llvmCore/Deve loper/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
When it comes to the compilation, here's what I have:
Undefined symbols for architecture x86_64:
"__gfortran_internal_malloc64", referenced from:
__bvls_mod(bool, void, long, short)in bvls_dp.o
_dogleg_ in minpack.o
_fdjac1_ in minpack.o
_fdjac2_ in minpack.o
_hybrd_ in minpack.o
_hybrd1_ in minpack.o
_hybrj_ in minpack.o
...
"__gfortran_internal_free", referenced from:
__bvls_mod(bool, void, long, short)in bvls_dp.o
_dogleg_ in minpack.o
_fdjac1_ in minpack.o
_fdjac2_ in minpack.o
_hybrd_ in minpack.o
_hybrd1_ in minpack.o
_hybrj_ in minpack.o
...
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I tried to compile the code with the '-m32' option, but then I have some different messages, and it is still not working:
ld: warning: ignoring file datatypes.o, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file nat_const.o, file was built for unsupported file format which is not the architecture being linked (i386)
After reading a few things on different forums (e.g., https://discussions.apple.com/thread/2145325?answerId=10137389022#10137389022 ), it looks like it is a problem of libraries.
But I must confess I have no clue how to check and/or fix this kind of problems.
Hope someone can help me, that would be very much appreciated,
Best,
Johan
MacBook Pro, Mac OS X (10.7.2)