我已经创建了一个CentOS 7映像,其中包含在gitlab.com上运行CI/CD管道所需的相关包。其中一个要求是使用gcc 8,我使用的是devtoolset-8。镜像存储在dockerhub上。我在/etc/profile中添加了以下内容:
source /opt/rh/devtoolset-8/enable如果我手动拉取此镜像,并在docker中运行此镜像,则一切如预期:
root@xxxxxx~]# docker run -i -t yyyyyy/zzzz:latest
...
[root@3463ccd63d42 build]# cmake -DCMAKE_BUILD_TYPE=Debug ..
-- The C compiler identification is GNU 8.3.1
-- The CXX compiler identification is GNU 8.3.1但是,当我在gitlab.com上的CI/CD管道中使用映像时,看起来devtoolset没有启用。我还尝试在script:节中手动执行此操作。作业输出:
Pulling docker image yyyyyy/zzzz:latest
...
Executing "step_script" stage of the job script
$ scl enable devtoolset-8 bash
..
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
-- The C compiler identification is GNU 4.8.5你知道问题出在哪里吗?
发布于 2021-03-04 05:32:37
我今天遇到了这个问题。
我不确定这个问题背后的机制是什么,但解决方案将是使用,例如:
scl enable devtoolset-8 'cmake .. && make all'...if你想用cmake来构建一些东西。
https://stackoverflow.com/questions/64169370
复制相似问题