I'm trying to compile a Fortran file (zernsurf.f95
) which uses GOMP with f2py. Here is my f2py call:
f2py -c -m zernsurf zernsurf.f95 --f90flags=-fopenmp -lgomp
This call returns an error which states that the compiler cannot find the library 'gomp' in directories, even though I though gcc automatically included gomp. The portion of the output which I thought was most relevant I've included below:
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
I've successfully compiled this same file on a Mac, so I know it can compile. I just don't know where to go from here. Perhaps set my PATH variables to somehow show the compiler this 'gomp' library? Any help would be greatly appreciated.