简体   繁体   English

Gitlab CI/CD 的 C++17 问题

[英]C++17 problems with Gitlab CI/CD

I have been trying to set up CI/CD in the repo for a library I am working on.我一直在尝试在我正在处理的库的 repo 中设置 CI/CD。 It requires C++17 and successfully compiles on my local machine.它需要 C++17 并在我的本地机器上成功编译。 However, when the pipeline runs on Gitlab, when it compiles I get this error.但是,当管道在 Gitlab 上运行时,在编译时出现此错误。

 $ make check
 Scanning dependencies of target gtest
 [  9%] Building CXX object googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest- 
 all.cc.o
 [ 18%] Linking CXX static library ../../lib/libgtest.a
 [ 18%] Built target gtest
 Scanning dependencies of target mconf
 [ 27%] Building CXX object CMakeFiles/mconf.dir/src/config_option.cpp.o
 [ 36%] Building CXX object CMakeFiles/mconf.dir/src/config_file.cpp.o
 In file included from /builds/USER/config_parser/src/config_file.cpp:1:0:
 /builds/USER/config_parser/src/config_file.hpp:9:10: fatal error: filesystem: No 
 such file or directory
 #include <filesystem>
           ^~~~~~~~~~~~
 compilation terminated.
 CMakeFiles/mconf.dir/build.make:86: recipe for target 
 'CMakeFiles/mconf.dir/src/config_file.cpp.o' failed
 make[3]: *** [CMakeFiles/mconf.dir/src/config_file.cpp.o] Error 1
 CMakeFiles/Makefile2:100: recipe for target 'CMakeFiles/mconf.dir/all' failed
 make[2]: *** [CMakeFiles/mconf.dir/all] Error 2
 CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/check.dir/rule' failed
 make[1]: *** [CMakeFiles/check.dir/rule] Error 2
 Makefile:175: recipe for target 'check' failed
 make: *** [check] Error 2
 ERROR: Job failed: exit code 1

Here is my .gitlab-ci.yml file.这是我的 .gitlab-ci.yml 文件。

image: ubuntu:latest

stages:
    - build

before_script:
    - apt update -qq

Build:
    stage: build
    script:
        - apt install -y -qq cmake make git gcc g++
        - mkdir build
        - cd build
        - cmake ..
        - make check
    artifacts:
        paths:
            - public

I also have not changed any of the settings for CI/CD on Gitlab.我也没有更改 Gitlab 上 CI/CD 的任何设置。 I tried using debian:stable, but I just got a linker error to the functions I'm using from filesystem.我尝试使用 debian:stable,但我刚从文件系统中收到指向我正在使用的函数的链接器错误。

According to https://hub.docker.com/_/ubuntu/根据https://hub.docker.com/_/ubuntu/

The ubuntu:latest tag points to the "latest LTS", since that's the version recommended for general use. ubuntu:latest 标签指向“最新的 LTS”,因为这是推荐用于一般用途的版本。 The ubuntu:rolling tag points to the latest release (regardless of LTS status). ubuntu:rolling 标签指向最新版本(无论 LTS 状态如何)。

At the time of writing, ubuntu:latest corresponds to Ubuntu 18.04 release, which might be too old.在撰写本文时, ubuntu:latest对应于 Ubuntu 18.04 版本,可能太旧了。

Try ubuntu:rolling , which currently corresponds to Ubuntu 19.10.尝试ubuntu:rolling ,它目前对应于 Ubuntu 19.10。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM