From e6d7c6c9190fde63fb5d248a3601b5d3c948cc7c Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 22 Oct 2024 02:56:16 +0000 Subject: [PATCH 1/5] Pending changes exported from your codespace --- .devcontainer/Dockerfile | 14 ++++++++++++++ .devcontainer/Dockerfile_raw | 24 ++++++++++++++++++++++++ .devcontainer/devcontainer.json | 31 +++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/Dockerfile_raw create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..75309cb --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,14 @@ +FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04 + +# Install latest cmake +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null +RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null +RUN sudo apt-get update && sudo apt-get install -y cmake + +# Install pre-commit +RUN sudo apt-get install -y python3-pip && pip3 install pre-commit +RUN pre-commit && pre-commit install + +# Avoid ASAN Stalling +# Alternative is to update to clang-18 and +RUN sudo sysctl -w vm.mmap_rnd_bits=28 \ No newline at end of file diff --git a/.devcontainer/Dockerfile_raw b/.devcontainer/Dockerfile_raw new file mode 100644 index 0000000..353013a --- /dev/null +++ b/.devcontainer/Dockerfile_raw @@ -0,0 +1,24 @@ +FROM ubuntu:24.04 + +RUN apt-get update + +# Install build tools +RUN apt-get install -y git +RUN apt-get install -y gcc-14 && ln -s /usr/bin/gcc-14 /usr/bin/gcc +RUN apt-get install -y g++-14 && ln -s /usr/bin/g++-14 /usr/bin/g++ +RUN apt-get install -y clang-18 && ln -s /usr/bin/clang++-18 /usr/bin/clang++ && ln -s /usr/bin/clang-18 /usr/bin/clang + +# Install CMake +RUN apt-get install -y ca-certificates gpg wget +RUN test -f /usr/share/doc/kitware-archive-keyring/copyright || \ + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null +RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null +RUN apt-get update +RUN apt-get install -y kitware-archive-keyring +RUN apt-get install -y cmake + +# Install Ninja +RUN apt-get install -y ninja-build + +# Disable safe directory +RUN git config --global --add safe.directory '*' \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..5ec0989 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp + +// TODO: update gcc and clang to avoid address randomziation problem. + +{ + "name": "C++", + // "image": "mcr.microsoft.com/devcontainers/cpp:ubuntu", + "build": { + "dockerfile": "Dockerfile" + }, + // "features": { + // // "ghcr.io/devcontainers/features/github-cli:1": {}, + // // "ghcr.io/gvatsal60/dev-container-features/pre-commit:1": {} + // } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "cmake --workflow --preset gcc-debug" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} From a9ff00b112354b1f3002620208c2ef1e8fffd11a Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 22 Oct 2024 03:02:02 +0000 Subject: [PATCH 2/5] Fix startup --- .devcontainer/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 75309cb..8de39d0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -7,7 +7,6 @@ RUN sudo apt-get update && sudo apt-get install -y cmake # Install pre-commit RUN sudo apt-get install -y python3-pip && pip3 install pre-commit -RUN pre-commit && pre-commit install # Avoid ASAN Stalling # Alternative is to update to clang-18 and From fce75810691a31eb78e1480574a98903250b5922 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:22:36 +0000 Subject: [PATCH 3/5] udpate comments with more postcreate scripts --- .devcontainer/Dockerfile | 5 +++-- .devcontainer/Dockerfile_raw | 24 ----------------------- .devcontainer/devcontainer.json | 34 +++++++++++---------------------- .devcontainer/postcreate.sh | 7 +++++++ 4 files changed, 21 insertions(+), 49 deletions(-) delete mode 100644 .devcontainer/Dockerfile_raw create mode 100644 .devcontainer/postcreate.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8de39d0..99abcb8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -9,5 +9,6 @@ RUN sudo apt-get update && sudo apt-get install -y cmake RUN sudo apt-get install -y python3-pip && pip3 install pre-commit # Avoid ASAN Stalling -# Alternative is to update to clang-18 and -RUN sudo sysctl -w vm.mmap_rnd_bits=28 \ No newline at end of file +# Alternative is to update to clang-18 and gcc-13.2 +# Maybe crashing codespace??? +RUN sudo sysctl -w vm.mmap_rnd_bits=28 diff --git a/.devcontainer/Dockerfile_raw b/.devcontainer/Dockerfile_raw deleted file mode 100644 index 353013a..0000000 --- a/.devcontainer/Dockerfile_raw +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:24.04 - -RUN apt-get update - -# Install build tools -RUN apt-get install -y git -RUN apt-get install -y gcc-14 && ln -s /usr/bin/gcc-14 /usr/bin/gcc -RUN apt-get install -y g++-14 && ln -s /usr/bin/g++-14 /usr/bin/g++ -RUN apt-get install -y clang-18 && ln -s /usr/bin/clang++-18 /usr/bin/clang++ && ln -s /usr/bin/clang-18 /usr/bin/clang - -# Install CMake -RUN apt-get install -y ca-certificates gpg wget -RUN test -f /usr/share/doc/kitware-archive-keyring/copyright || \ - wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null -RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null -RUN apt-get update -RUN apt-get install -y kitware-archive-keyring -RUN apt-get install -y cmake - -# Install Ninja -RUN apt-get install -y ninja-build - -# Disable safe directory -RUN git config --global --add safe.directory '*' \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5ec0989..d4051c8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,31 +1,19 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/cpp -// TODO: update gcc and clang to avoid address randomziation problem. - { - "name": "C++", - // "image": "mcr.microsoft.com/devcontainers/cpp:ubuntu", + "name": "Beman Project Generic Devcontainer", "build": { "dockerfile": "Dockerfile" }, - // "features": { - // // "ghcr.io/devcontainers/features/github-cli:1": {}, - // // "ghcr.io/gvatsal60/dev-container-features/pre-commit:1": {} - // } - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "cmake --workflow --preset gcc-debug" - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" + // TODO: these commands are failing + "postCreateCommand": ["bash postcreate.sh"], + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools" + ] + } + } } diff --git a/.devcontainer/postcreate.sh b/.devcontainer/postcreate.sh new file mode 100644 index 0000000..7e00171 --- /dev/null +++ b/.devcontainer/postcreate.sh @@ -0,0 +1,7 @@ +cd .. + +# Setup cmake build directory +cmake --workflow --preset gcc-debug +# Setup pre-commit +pre-commit +pre-commit install From 24b10ba203100256a66d0887ab15034ec372087c Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 8 Nov 2024 02:44:46 +0000 Subject: [PATCH 4/5] Correct post-create --- .devcontainer/Dockerfile | 2 ++ .devcontainer/devcontainer.json | 3 +-- .devcontainer/postcreate.sh | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 99abcb8..cd11825 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,7 @@ FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04 +USER vscode + # Install latest cmake RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d4051c8..07344f6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,8 +6,7 @@ "build": { "dockerfile": "Dockerfile" }, - // TODO: these commands are failing - "postCreateCommand": ["bash postcreate.sh"], + "postCreateCommand": "bash .devcontainer/postcreate.sh", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/postcreate.sh b/.devcontainer/postcreate.sh index 7e00171..bddba03 100644 --- a/.devcontainer/postcreate.sh +++ b/.devcontainer/postcreate.sh @@ -1,7 +1,3 @@ -cd .. - -# Setup cmake build directory -cmake --workflow --preset gcc-debug # Setup pre-commit pre-commit pre-commit install From 5c58e08979c0e4594966a520013a23be1b8ae9de Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:08:57 -0500 Subject: [PATCH 5/5] More documentation --- .devcontainer/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index cd11825..818d35b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -11,6 +11,7 @@ RUN sudo apt-get update && sudo apt-get install -y cmake RUN sudo apt-get install -y python3-pip && pip3 install pre-commit # Avoid ASAN Stalling -# Alternative is to update to clang-18 and gcc-13.2 +# See: https://github.com/google/sanitizers/issues/1614 +# Alternative is to update to above clang-18 and gcc-13.2 # Maybe crashing codespace??? RUN sudo sysctl -w vm.mmap_rnd_bits=28