0

我正在尝试编译一个zernsurf.f95使用 GOMP 和 f2py 的 Fortran 文件 ()。这是我的 f2py 电话:

f2py -c -m zernsurf zernsurf.f95 --f90flags=-fopenmp -lgomp

此调用返回一个错误,指出编译器在目录中找不到库“gomp”,即使我在 gcc 自动包含 gomp 时也是如此。我认为最相关的输出部分包括在下面:

compiling Fortran sources
Fortran f77 compiler: C:\msys64\mingw64\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -O3 -funroll-loops
Fortran f90 compiler: C:\msys64\mingw64\bin\gfortran.exe -fopenmp -O3 -funroll-loops
Fortran fix compiler: C:\msys64\mingw64\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -fopenmp -O3 -funroll-loops
compile options: '-Ic:\users\ben\appdata\local\temp\tmpzsrysh\src.win-amd64-2.7 -IC:\Users\Ben\Anaconda2\lib\site-packages\numpy\core\include -IC:\Users\Ben\Anaconda2\include -IC:\Users\Ben\Anaconda2\PC -c'
gfortran.exe:f90: zernsurf.f95
gfortran.exe:f77: c:\users\ben\appdata\local\temp\tmpzsrysh\src.win-amd64-2.7\zernsurf-f2pywrappers.f
could not find library 'gomp' in directories []
C:\msys64\mingw64\bin\gfortran.exe -Wall -g -Wall -g -shared ..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o ..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\users\ben\appdata\local\temp\tmpzsrysh\src.win-amd64-2.7\zernsurf-f2pywrappers.o -LC:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\7.3.0 -LC:\Users\Ben\Anaconda2\libs -LC:\Users\Ben\Anaconda2\PCbuild\amd64 -LC:\Users\Ben\Anaconda2\PC\VS9.0\amd64 -o c:\users\ben\appdata\local\temp\tmpzsrysh\Release\extra-dll\libzernsurf.NVNMLU4BAM43JLHGAZSG5DZQSFKWQ4FF.gfortran-win_amd64.dll -Wl,--allow-multiple-definition -Wl,--output-def,c:\users\ben\appdata\local\temp\tmpzsrysh\Release\libzernsurf.NVNMLU4BAM43JLHGAZSG5DZQSFKWQ4FF.gfortran-win_amd64.def -Wl,--export-all-symbols -Wl,--enable-auto-import -static -mlong-double-64
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0xb55): undefined reference to `omp_get_num_threads'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0xb62): undefined reference to `omp_get_thread_num'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0x1080): undefined reference to `omp_get_num_threads'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0x108d): undefined reference to `omp_get_thread_num'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0x15ae): undefined reference to `omp_get_num_threads'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0x15ba): undefined reference to `omp_get_thread_num'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0x5cd0): undefined reference to `GOMP_parallel'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0x5e09): undefined reference to `GOMP_parallel'
..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o:zernsurf.f95:(.text+0x659c): undefined reference to `GOMP_parallel'
collect2.exe: error: ld returned 1 exit status
error: Command "C:\msys64\mingw64\bin\gfortran.exe -Wall -g -Wall -g -shared ..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\zernsurf.o ..\..\users\ben\appdata\local\temp\tmpzsrysh\Release\users\ben\appdata\local\temp\tmpzsrysh\src.win-amd64-2.7\zernsurf-f2pywrappers.o -LC:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\7.3.0 -LC:\Users\Ben\Anaconda2\libs -LC:\Users\Ben\Anaconda2\PCbuild\amd64 -LC:\Users\Ben\Anaconda2\PC\VS9.0\amd64 -o c:\users\ben\appdata\local\temp\tmpzsrysh\Release\extra-dll\libzernsurf.NVNMLU4BAM43JLHGAZSG5DZQSFKWQ4FF.gfortran-win_amd64.dll -Wl,--allow-multiple-definition -Wl,--output-def,c:\users\ben\appdata\local\temp\tmpzsrysh\Release\libzernsurf.NVNMLU4BAM43JLHGAZSG5DZQSFKWQ4FF.gfortran-win_amd64.def -Wl,--export-all-symbols -Wl,--enable-auto-import -static -mlong-double-64" failed with exit status 1

我已经在 Mac 上成功编译了同一个文件,所以我知道它可以编译。我只是不知道从这里去哪里。也许设置我的 PATH 变量以某种方式向编译器显示这个“gomp”库?任何帮助将不胜感激。

4

0 回答 0