The problem:
I have added OpenMP to a C++ project, which is build using cmake. I got it to build successfully locally on my setup, with ubuntu 18.04. I am then trying to build it on Jenkins, whose ubuntu version is also 18.04 However, when it builds it cannot find the OpenMP library.
So how do I configure the Jenkins pipeline to get it to include omp library(sorry I have never had to configure Jenkins before)?
I have already tried running sudo apt-get install libomp-dev
as a build step
it fails with
17:56:57 E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
17:56:57 E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
here is what happens when I do ld -lomp --verbose
23:25:39 attempt to open //usr/local/lib/x86_64-linux-gnu/libomp.so failed
23:25:39 attempt to open //usr/local/lib/x86_64-linux-gnu/libomp.a failed
23:25:39 attempt to open //lib/x86_64-linux-gnu/libomp.so failed
23:25:39 attempt to open //lib/x86_64-linux-gnu/libomp.a failed
23:25:39 attempt to open //usr/lib/x86_64-linux-gnu/libomp.so failed
23:25:39 attempt to open //usr/lib/x86_64-linux-gnu/libomp.a failed
23:25:39 attempt to open //usr/lib/x86_64-linux-gnu64/libomp.so failed
23:25:39 attempt to open //usr/lib/x86_64-linux-gnu64/libomp.a failed
23:25:39 attempt to open //usr/local/lib64/libomp.so failed
23:25:39 attempt to open //usr/local/lib64/libomp.a failed
23:25:39 attempt to open //lib64/libomp.so failed
23:25:39 attempt to open //lib64/libomp.a failed
23:25:39 attempt to open //usr/lib64/libomp.so failed
23:25:39 attempt to open //usr/lib64/libomp.a failed
23:25:39 attempt to open //usr/local/lib/libomp.so failed
23:25:39 attempt to open //usr/local/lib/libomp.a failed
23:25:39 attempt to open //lib/libomp.so failed
23:25:39 attempt to open //lib/libomp.a failed
23:25:39 attempt to open //usr/lib/libomp.so failed
23:25:39 attempt to open //usr/lib/libomp.a failed
23:25:39 attempt to open //usr/x86_64-linux-gnu/lib64/libomp.so failed
23:25:39 attempt to open //usr/x86_64-linux-gnu/lib64/libomp.a failed
23:25:39 attempt to open //usr/x86_64-linux-gnu/lib/libomp.so failed
23:25:39 attempt to open //usr/x86_64-linux-gnu/lib/libomp.a failed
23:25:39 ld: cannot find -lomp
Any help is greatly appreciated. Thanks in advance.
After doing these 2 things it seems like the Jenkins is able to build with OpenMP flags.
sudo -s apt-get update
as a build step, before the actual build comment, in Jenkins.find_package(OpenMP)
in the cmake file.