问题:
我已将 OpenMP 添加到 C++ 项目中,该项目是使用 cmake 构建的。我使用 ubuntu 18.04 在本地成功构建了它。 然后我尝试在 Jenkins 上构建它,其 ubuntu 版本也是 18.04 但是,当它构建时,它找不到 OpenMP 库。
那么如何配置 Jenkins 管道以使其包含 omp 库(抱歉我以前从未配置过 Jenkins)? 我已经尝试过运行
sudo apt-get install libomp-dev
作为构建步骤
它失败了
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?
这是我执行 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
非常感谢任何帮助。预先感谢。
完成这两件事后,Jenkins 似乎能够使用 OpenMP 标志进行构建。
sudo -s apt-get update
作为构建步骤。find_package(OpenMP)
。