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?
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:
-static
at link time.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.
-Wl,-rpath -Wl,<dir>/lib
(or lib64 rather than lib, if it applies) where <dir>
refers to the directory from point 2).