Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Code fails at runtime - can't find omp_lib(Can't tell compiler/linker where amp_lib is, I think.)
Code fails at runtime - can't find omp_lib [message #1840253] Fri, 09 April 2021 16:43 Go to next message
Eclipse UserFriend
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 16:43] by Moderator

Re: Code fails at runtime - can't find omp_lib [message #1840295 is a reply to message #1840253] Sun, 11 April 2021 18:34 Go to previous message
Eclipse UserFriend
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 04:29] by Moderator

Previous Topic:cannot create temporary il file
Next Topic:Obscure error while attempting to build first "Hello World" program
Goto Forum:
  


Current Time: Wed Jul 23 18:33:47 EDT 2025

Powered by FUDForum. Page generated in 0.02748 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top