Code fails at runtime - can't find omp_lib [message #1840253] |
Fri, 09 April 2021 20:43 |
Robert Lockwood Messages: 45 Registered: October 2010 Location: Riverside, CA, USA |
Member |
|
|
I'm trying to relearn Fortran (and make) after 35 years or so using f95 and OpenMP.
My test code (copy and paste) builds with no errors but at runtime fails with the error message: 'There are no files that export a module named omp_lib'
I'm assuming that this has something to do with the statement:
use, intrinsic :: opt_lib
but I might be wrong.
I've provided a path to first of the two places where I found include files
/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/finclude/omp_lib.h
/usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/finclude/omp_lib.h
That did not work.
I'm on Big Sur and using OpenMP installed with Homebrew and gfortran.
How do I interpret the error and what fix is available.
TIA
[Updated on: Fri, 09 April 2021 20:43] Report message to a moderator
|
|
|
Re: Code fails at runtime - can't find omp_lib [message #1840295 is a reply to message #1840253] |
Sun, 11 April 2021 22:34 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
You likely need to add the path to libomp.so (what it's called in Linux anyway) to the dynamic library search path.
I have no idea how you do this in macOS .
A liberal use of the magical -fopenmp switch during compile and link may solve this
https://gcc.gnu.org/onlinedocs/libgomp/Enabling-OpenMP.html
UPDATE:
All that was needed to get the OpenMP Hello World example to compile and link
was to add -fopenmp to the compile and link steps
- g++ -O0 -g3 -Wall -c -fmessage-length=0 -fopenmp -MMD -MP -MF"src/OpenMP-HelloWorld.d" -MT"src/OpenMP-HelloWorld.o" -o "src/OpenMP-HelloWorld.o" "../src/OpenMP-HelloWorld.cpp"
- g++ -fopenmp -o "OpenMP-HelloWorld" ./src/OpenMP-HelloWorld.o
[Updated on: Mon, 12 April 2021 08:29] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.24796 seconds