Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 链接lapack和fftw3库时出现问题_Macos_Fortran_Static Linking_Lapack_Fftw - Fatal编程技术网

Macos 链接lapack和fftw3库时出现问题

Macos 链接lapack和fftw3库时出现问题,macos,fortran,static-linking,lapack,fftw,Macos,Fortran,Static Linking,Lapack,Fftw,我有一个Fortran 90程序,它使用lapack子例程,并在我的Ubuntu系统上成功运行。现在我想在Mac上运行它(OSX版本10.11.4)。我使用gfortran编译器作为gcc的一部分,安装在自制存储库中,使用lapack库,安装在/usr/local/lib/中。 当我试图编译代码时,出现以下错误: gfortran my_prog.f90 -L/usr/local/lib/ -llapack Undefined symbols for architecture x86_64:

我有一个Fortran 90程序,它使用lapack子例程,并在我的Ubuntu系统上成功运行。现在我想在Mac上运行它(OSX版本10.11.4)。我使用gfortran编译器作为gcc的一部分,安装在自制存储库中,使用lapack库,安装在/usr/local/lib/中。 当我试图编译代码时,出现以下错误:

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
经过一些谷歌搜索,我明白了问题是因为链接。当我像这样编译它时,一切都很好:

gfortran my_prog.f90 -llapack
另外,当使用frameworkaccelerate中的llapack时,编译器也不会抱怨

gfortran my_prog.f90 -framework accelerate
这些库采用x86-64体系结构:

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
LAPACK并不是唯一一个给我带来错误的,后来FFTW3也出现了同样的问题。你能告诉我这个问题的解决办法吗

不属于本协议的一部分。如果要使用它,还需要将
-lfftw3
添加到编译选项中

如果库不在默认库路径中,则可能还需要指定
-L/PATH/to/fftw/libs
。如果您正在使用include路径的模块
-I/path/to/fftw/include
,则include路径也是如此


请注意,库的
vDSP
部分还提供了。您可能根本不需要FFTW

daxpy
ztrmv
是Blas库的一部分,而不是lapack。因此,您是否可以尝试通过执行
-llapack-lblas
来链接Blas?