Reputation: 733
I have the intel compiler install at the following $HOME/tpl/intel
. When I compile a simple hello_omp.cpp
with openMP enabled
#include <omp.h>
#include <iostream>
int main ()
{
#pragma omp parallel
{
std::cout << "Hello World" << std::endl;
}
return 0;
}
I compile with ~/tpl/intel/bin/icpc -O3 -qopenmp hello_omp.cpp
but when I run I get the following error:
./a.out: error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory
.
I would like to explicitly link the intel compiler and the appropriate library during the make process without using the LD_LIBRARY_PATH
?
Upvotes: 3
Views: 1953
Reputation: 354
Intel Compiler ships compilervars.sh script in the bin directory which when sourced will set the appropriate env variables like LD_LIBRARY_PATH, LIBRARY_PATH and PATH with the right directories which host OpenMP runtime library and other compiler specific libraries like libsvml (short vector math library) or libimf (more optimized version of libm).
Upvotes: 0
Reputation: 9499
You have 2 simple solutions for your problem:
~/tpl/intel/bin/icpc -O3 -qopenmp -static_intel hello_omp.cpp
-rpath
:~/tpl/intel/bin/icpc -O3 -qopenmp -Wl,-rpath=$HOME/tpl/intel/lib/intel64 hello_omp.cpp
-Wl,
to transmit the option to the linker.Upvotes: 2