Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenMP + linux - GOMP_4.0 not found

I've been trying to compile a program which uses OpenMP on suse with gcc --version 4.9.4

> g++ -std=c++11 -o a.exe -fopenmp ./file.cpp
> ./a.exe

./a.exe: /usr/lib64/libgomp.so.1: version `GOMP_4.0' not found (required by ./a.exe)

I have a file named "/usr/lib64/libgomp.so.1" how may I fix it?

like image 733
Yurkee Avatar asked Aug 18 '16 11:08

Yurkee


2 Answers

Since you have multiple GCC-compiler installations (4.3 and 4.9), it is likely that your problem arises because you compile with GCC 4.9 (which supports OpenMP 4.0) but at runtime the OS loader uses the GCC 4.3 libraries (which does not support OpenMP 4.0).

There are some alternatives to avoid this issue:

  1. Statically compile your binary by using -static at link time.
  2. Make O/S to search the appropriate libraries rather than the old libraries. You can use the command

    find / name -name libgomp.so.1
    

    to list the available libgomp libraries from your system and then add the directory where it is stored into the LD_LIBRARY_PATH environment variable.

  3. Alternatively to 2), you can also tell the linker to generate a binary and letting it to know where to find additional shared libraries in addition to where LD_LIBRARY_PATH points to. You can also use gcc ... -Wl,-rpath -Wl,<dir>/lib (or lib64 rather than lib, if it applies) where <dir> refers to the directory from point 2).
like image 148
Harald Avatar answered Oct 08 '22 15:10

Harald


Installing correct new library from here http://packages.ubuntu.com/search?keywords=libgomp1 helped me in similar situation.

like image 26
Anna Vergeles Avatar answered Oct 08 '22 16:10

Anna Vergeles