diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8842d5e327158676a04118103aa83737914a2b5b..0bf31296c7681e1de61aec90f8cb17b495e29aec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,4 +41,17 @@ build_fedora: - docker build -f docker/Dockerfile_full -t $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:${TAG} -t $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:latest . - docker container prune - docker push $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:${TAG} - - if [ "${UPDATE_LATEST_TAG}" == "True" ]; then docker push $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:latest; fi \ No newline at end of file + - if [ "${UPDATE_LATEST_TAG}" == "True" ]; then docker push $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:latest; fi + +build_boost: + stage: build + retry: 2 + only: + - web + script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + # Latest is always generated but not pushed if ${UPDATE_LATEST_TAG} is not "True" + - docker build -f docker/Dockerfile_full -t $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:${TAG} -t $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:latest . + - docker container prune + - docker push $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:${TAG} + - if [ "${UPDATE_LATEST_TAG}" == "True" ]; then docker push $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:latest; fi \ No newline at end of file diff --git a/6-InRealEnvironment/4b-Demo/1-ProblematicCase/CMakeLists.txt b/6-InRealEnvironment/4b-Demo/1-ProblematicCase/CMakeLists.txt index 3793468c08be9e833933b908e387d22d730d015e..cbc4757bc6ccbf9f7ff561fade5865d4b6d19b89 100644 --- a/6-InRealEnvironment/4b-Demo/1-ProblematicCase/CMakeLists.txt +++ b/6-InRealEnvironment/4b-Demo/1-ProblematicCase/CMakeLists.txt @@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall - add_executable(simple_boost simple_boost.cpp) # Not portable at all but not the point here! -target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include") +target_include_directories(simple_boost PUBLIC "/opt/include") target_link_libraries(simple_boost - /Codes/ThirdParty/opt/lib/libboost_filesystem.a - /Codes/ThirdParty/opt/lib/libboost_system.a) \ No newline at end of file + /opt/lib/libboost_filesystem.a + /opt/lib/libboost_system.a) \ No newline at end of file diff --git a/6-InRealEnvironment/4b-Demo/2-FixByBuildSystem/CMakeLists.txt b/6-InRealEnvironment/4b-Demo/2-FixByBuildSystem/CMakeLists.txt index 4e2f7aa143bb3f34cefec68741989724c78fdb54..58cf778b20414fa810176812c1bdecd1072d7dfe 100644 --- a/6-InRealEnvironment/4b-Demo/2-FixByBuildSystem/CMakeLists.txt +++ b/6-InRealEnvironment/4b-Demo/2-FixByBuildSystem/CMakeLists.txt @@ -29,8 +29,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall - add_executable(simple_boost simple_boost.cpp) # Not portable at all but not the point here! -target_include_directories(simple_boost SYSTEM PUBLIC "/Codes/ThirdParty/opt/include") +target_include_directories(simple_boost SYSTEM PUBLIC "/opt/include") target_link_libraries(simple_boost - /Codes/ThirdParty/opt/lib/libboost_filesystem.a - /Codes/ThirdParty/opt/lib/libboost_system.a) \ No newline at end of file + /opt/lib/libboost_filesystem.a + /opt/lib/libboost_system.a) \ No newline at end of file diff --git a/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/CMakeLists.txt b/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/CMakeLists.txt index 0fd6382eecf41f1ab36ec23944a0b1122b98f403..b59887220c4b4d9a13efc5d659313f62a88d42a9 100644 --- a/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/CMakeLists.txt +++ b/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/CMakeLists.txt @@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall - add_executable(simple_boost simple_boost.cpp) # Not portable at all but not the point here! -target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include") +target_include_directories(simple_boost PUBLIC "/opt/include") target_link_libraries(simple_boost - /Codes/ThirdParty/opt/lib/libboost_filesystem.a - /Codes/ThirdParty/opt/lib/libboost_system.a) \ No newline at end of file + /opt/lib/libboost_filesystem.a + /opt/lib/libboost_system.a) \ No newline at end of file diff --git a/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/simple_boost.cpp b/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/simple_boost.cpp index 61ff100930131a796f56dd9199b14cb602e71471..563392dee521e50a0b8b1453df13ccdb6e480a5b 100644 --- a/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/simple_boost.cpp +++ b/6-InRealEnvironment/4b-Demo/3-FixByPragmas-clang/simple_boost.cpp @@ -22,6 +22,7 @@ #pragma clang diagnostic ignored "-Wsuggest-override" // added in 2021! #pragma clang diagnostic ignored "-Wsuggest-destructor-override" // added in 2021! #pragma clang diagnostic ignored "-Wc11-extensions" // added in 2021! +#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override" // added in 2021! #include "boost/exception/diagnostic_information.hpp" #include "boost/filesystem.hpp" diff --git a/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/CMakeLists.txt b/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/CMakeLists.txt index 0fd6382eecf41f1ab36ec23944a0b1122b98f403..b59887220c4b4d9a13efc5d659313f62a88d42a9 100644 --- a/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/CMakeLists.txt +++ b/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/CMakeLists.txt @@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall - add_executable(simple_boost simple_boost.cpp) # Not portable at all but not the point here! -target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include") +target_include_directories(simple_boost PUBLIC "/opt/include") target_link_libraries(simple_boost - /Codes/ThirdParty/opt/lib/libboost_filesystem.a - /Codes/ThirdParty/opt/lib/libboost_system.a) \ No newline at end of file + /opt/lib/libboost_filesystem.a + /opt/lib/libboost_system.a) \ No newline at end of file diff --git a/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/simple_boost.cpp b/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/simple_boost.cpp index 6c352fc8af5ff8392c14a6f85b3ab053d093ebe6..ac26d6e99bc0123da98e032fb875c3bfc0cbb025 100644 --- a/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/simple_boost.cpp +++ b/6-InRealEnvironment/4b-Demo/4-FixByPragmas-clang-gcc/simple_boost.cpp @@ -23,6 +23,7 @@ #pragma clang diagnostic ignored "-Wsuggest-override" // added in 2021! #pragma clang diagnostic ignored "-Wsuggest-destructor-override" // added in 2021! #pragma clang diagnostic ignored "-Wc11-extensions" // added in 2021! +#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override" // added in 2021! #include "boost/exception/diagnostic_information.hpp" #include "boost/filesystem.hpp" diff --git a/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/CMakeLists.txt b/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/CMakeLists.txt index 0fd6382eecf41f1ab36ec23944a0b1122b98f403..b59887220c4b4d9a13efc5d659313f62a88d42a9 100644 --- a/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/CMakeLists.txt +++ b/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/CMakeLists.txt @@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall - add_executable(simple_boost simple_boost.cpp) # Not portable at all but not the point here! -target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include") +target_include_directories(simple_boost PUBLIC "/opt/include") target_link_libraries(simple_boost - /Codes/ThirdParty/opt/lib/libboost_filesystem.a - /Codes/ThirdParty/opt/lib/libboost_system.a) \ No newline at end of file + /opt/lib/libboost_filesystem.a + /opt/lib/libboost_system.a) \ No newline at end of file diff --git a/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/clean_boost_filesystem.hpp b/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/clean_boost_filesystem.hpp index e06a4fe1007a7021f13251502231f5665ad06da0..1c5e0ba1b513474cece7b331ee7d3a5e9c2e702f 100644 --- a/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/clean_boost_filesystem.hpp +++ b/6-InRealEnvironment/4b-Demo/5-FixByPragmas-common/clean_boost_filesystem.hpp @@ -26,6 +26,8 @@ PRAGMA_DIAGNOSTIC(ignored "-Wnon-virtual-dtor") PRAGMA_DIAGNOSTIC(ignored "-Wc++98-compat") PRAGMA_DIAGNOSTIC(ignored "-Wc++98-compat-pedantic") PRAGMA_DIAGNOSTIC(ignored "-Wexit-time-destructors") + PRAGMA_DIAGNOSTIC(ignored "-Winconsistent-missing-destructor-override") + PRAGMA_DIAGNOSTIC(ignored "-Wsuggest-destructor-override") #endif // __clang__ #include "boost/exception/diagnostic_information.hpp" diff --git a/6-InRealEnvironment/4b-Demo/Dockerfile b/6-InRealEnvironment/4b-Demo/Dockerfile deleted file mode 100644 index ec188e2f15b0f5ae3ae7b1e9c9eacc0ac3e950d0..0000000000000000000000000000000000000000 --- a/6-InRealEnvironment/4b-Demo/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# See Config /Dockerfile at the root of the project to generate this base image. -FROM formation_cpp_docker_base -LABEL maintainer Sébastien Gilles "sebastien.gilles@inria.fr" - -RUN (dnf update -y && dnf upgrade -y -q) - -RUN dnf install -y wget && dnf clean packages - -RUN mkdir -p Codes/ThirdPartyWarning && mkdir -p Codes/ThirdParty - -WORKDIR Codes/ThirdParty - -RUN wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz \ - && tar xzf boost_1_72_0.tar.gz \ - && rm -f boost_1_72_0.tar.gz - -WORKDIR boost_1_72_0 - -RUN ./bootstrap.sh cxxstd=14,17 --prefix=../opt --with-toolset=clang --with-libraries=filesystem,system -RUN ./b2 install link=static toolset=clang variant=debug - -WORKDIR /Codes/ThirdPartyWarning - -ENTRYPOINT ["zsh"] \ No newline at end of file diff --git a/6-InRealEnvironment/4b-Demo/README.md b/6-InRealEnvironment/4b-Demo/README.md index e2a6670cf41828d1f6794cf6ae0e326de1363bd8..c976b3e680ebd986e1ca1b3e7dca9667df44b749 100644 --- a/6-InRealEnvironment/4b-Demo/README.md +++ b/6-InRealEnvironment/4b-Demo/README.md @@ -1,49 +1,13 @@ # How to use Docker for this example? -First of all, make sure [Docker](https://www.docker.com/) is properly installed and running. +The image is based on Fedora and is created through this [Dockerfile](../docker/Dockerfile.boost). -## Getting the image - -Then to get the relevant image you may either: - -### Build the image from the provided Dockerfile - -Make sure to have first built the image in Config directory (at the root of the project). - -Then type in a terminal: - -```` -docker build -t demo_third_party_warning . -```` - -This may take few minutes. - -### Or fetching it from the gitlab registry - -Type in a terminal (provided you have an account on the [Inria gitlab](https://gitlab.inria.fr) - if not you may create one easily): +To run it type: ```` -docker login registry.gitlab.inria.fr -docker pull registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp/demo_third_party_warning:latest +docker run -it -v $PWD:/home/formation/gettingstartedwithmoderncpp --cap-drop=all registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp/with_boost:latest ```` -## Running the image - -Go in the _Docker/ThirdPartyWarning_ folder and type: - -```` -docker run -v $PWD:/Codes/ThirdPartyWarning --cap-drop=all -it demo_third_party_warning -```` - -For those of you not familiar with Docker: - -* `-v` creates a mapping between local folder and the /Codes/ThirdPartyWarning folder in the container; this enables you to edit the file from your comfy environment and see the file edited this way in the Docker container. -* `--cap-drop=all` is a safety when you're running a Docker image not built by yourself: you're essentially blocking the few remaining operations that might impact your own environment that Docker lets by default open with the run command. -* `-it` tells we want an interactive session: your terminal session will place you inside the container (here a Fedora environment). - -`third_party_warning` is a Docker **image**; the instantiation of this image obtained after the run command is a **container**. - - # Step by step: illustrating the issue After run, the container is opened and you are in a folder (inside the container) named `/Codes/ThirdPartyWarning`. diff --git a/docker/Dockerfile.boost b/docker/Dockerfile.boost new file mode 100644 index 0000000000000000000000000000000000000000..a23b04a5e6b8d53224bc6f084276a9f22c9ac5ce --- /dev/null +++ b/docker/Dockerfile.boost @@ -0,0 +1,26 @@ +FROM fedora:latest +LABEL maintainer Sébastien Gilles "sebastien.gilles@inria.fr" + +RUN (dnf update -y && dnf upgrade -y -q) + +RUN dnf install -y git cmake clang gcc gcc-c++ ninja-build which hostname make && dnf clean packages +# wget is kept separated as the previous line is in commin with Dockerfile.fedora: so cache may be used if both are built on the same machine. +RUN dnf install -y wget && dnf clean packages + +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz \ + && tar xzf boost_1_76_0.tar.gz \ + && rm -f boost_1_76_0.tar.gz + +WORKDIR boost_1_76_0 + +RUN ./bootstrap.sh cxxstd=14,17 --prefix=../opt --with-toolset=clang --with-libraries=filesystem,system +RUN ./b2 install link=static toolset=clang variant=debug + +# Create non root user +ENV USER "formation" +RUN useradd --create-home ${USER} +USER ${USER} + +WORKDIR /home/${USER}/gettingstartedwithmoderncpp + + diff --git a/docker/README.md b/docker/README.md index d989730a986eef75dee26072e1b3d1f6f72c01b9..61dbfe4b6e340351a41dbf8aa618d6b6cc335888 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,4 +11,4 @@ There are several Dockerfiles here: - [Dockerfile], which creates an image with a Conda environment to run properly Xeus-cling. - [Dockerfile-full], which creates an image with a Conda environment to run properly Xeus-cling and installs as well local compilers so that they may be invoked from the notebooks (for the 6-InRealEnvironment part). - [Dockerfile.fedora] which provides an environment with both clang and gcc installed. This notebook is not intended to run the notebooks but may be used to run the TPs. - +- [Dockerfile.boost] is used along with [the notebook about third party warnings](../6-InRealEnvironment/4-ThirdParty.ipynb).