Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clang 3.8+ -fopenmp on linux: ld cannot find -lomp

I have installed clang 3.8 from the base repositories for both Debian Jessie and Fedora 24. When I try to compile a simple HelloWorld.cpp test program with clang++, and i pass the -fopenmp flag, in both cases i get the same error:

/usr/bin/ld: cannot find -lomp clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)

I see that if I instead pass -fopenmp=libgomp, it works. However, the Clang OpenMP website says that the OpenMP runtime is shipped with Clang 3.8. Why, then, can it not find the default libomp library? I do not see this library anywhere on my system.

like image 527
Dan S Avatar asked Jul 06 '16 20:07

Dan S


1 Answers

There is good chances that the OpenMP development package is missing on your system.
On Ubuntu: sudo apt install libomp-dev

like image 130
Michael M. Avatar answered Sep 21 '22 13:09

Michael M.