Answer the question
In order to leave comments, you need to log in
How to connect the LAPACK library to Fortran on MacOS X?
Good day!
There is a Fortran 90 program that uses the LAPACK linear algebra library. The program compiles and runs normally in Ubuntu. Now you need to run it on Mac OS X (version 10.11.4). I'm using the gfortran compiler installed via homebrew, the lapack library is in the /usr/local/lib/ directory. When I try to compile the code, I get the following error:
gfortran my_prog.f90 -L/usr/local/lib/ -llapack
Undefined symbols for architecture x86_64:
"_daxpy_", referenced from:
_zggbal_ in liblapack.a(zggbal.o)
.. .
"_ztrmv_", referenced from:
_zlarft_ in liblapack.a(zlarft.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status An
internet search suggests that the error is due to a library reference. When I compile the program without writing the path to the library, the error disappears. Also, the error does not appear if you use framework accelerate.
x86-64 library architecture
lipo -info *.a
input file libfftw3.a is not a fat file
input file liblapack.a is not a fat file
Non-fat file: libfftw3.a is architecture: x86_64
Non-fat file: liblapack. a is architecture: x86_64
The error occurs not only when using LAPACK, but also when trying to connect the FFTW library.
Please, give me some idea to solve the problem.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question