diff --git a/.devcontainer/Readme.md b/.devcontainer/Readme.md index fa8c81d4e6b2..80febe02529e 100644 --- a/.devcontainer/Readme.md +++ b/.devcontainer/Readme.md @@ -6,7 +6,7 @@ VSCode supports creating development environments inside of a docker container. 1. Install Docker, a tool for managing containerized VMs: https://www.docker.com - If you have Docker installed, make sure it is updated to the most recent version (there is a "Check for Updates" option in the application UI). - - If installing Docker on macOS for the first time, I recommend selecting the "Advanced" installation option, specifying a "User" installation and disabling the two options below. This makes it so your Docker installation does not require root privileges for anything, making updates more seamless. This will require you telling VSCode where the `docker` executable ended up by chaging the "dev.containers.dockerPath" setting `"/Users//.docker/bin/docker”`. You should make sure this executable exists by executing `"/Users//.docker/bin/docker --version”`, if you are not on macOS the `docker` executable might be at a different path. + - If installing Docker on macOS for the first time, I recommend selecting the "Advanced" installation option, specifying a "User" installation and disabling the two options below. This makes it so your Docker installation does not require root privileges for anything, making updates more seamless. This will require you telling VSCode where the `docker` executable ended up by changing the "dev.containers.dockerPath" setting `"/Users//.docker/bin/docker”`. You should make sure this executable exists by executing `"/Users//.docker/bin/docker --version”`, if you are not on macOS the `docker` executable might be at a different path. 2. Install Visual Studio Code and the Remote Containers extensions: https://code.visualstudio.com/docs/devcontainers/tutorial 3. Configure Docker by opening up the Docker application and navigating to "Settings" - Recommended settings for macOS (some of these are defaults): diff --git a/.devcontainer/cmake-helper b/.devcontainer/cmake-helper index 5912cf1b3c7b..54c1b64fb264 100755 --- a/.devcontainer/cmake-helper +++ b/.devcontainer/cmake-helper @@ -1,10 +1,10 @@ #!/usr/bin/env bash -set -e +set -euo pipefail # Calls CMake, loading arguments from devcontainer settings to maintain a single source of truth. -PROJECT_NAME=circel +PROJECT_NAME=circt SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) PROJECT_ROOT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel) @@ -39,7 +39,6 @@ case "$1" in fi fi - set -e echo "-DCMAKE_BUILD_TYPE=Debug" sed 's@//.*@@' < "$VSCODE_SETTINGS_FILE" | \ sed "s@\${[A-Za-z]*orkspaceFolder}@$PROJECT_ROOT@" | \ diff --git a/.devcontainer/default/Dockerfile b/.devcontainer/default/Dockerfile index 86ffe07b1e89..d184090b21ea 100644 --- a/.devcontainer/default/Dockerfile +++ b/.devcontainer/default/Dockerfile @@ -3,26 +3,17 @@ FROM --platform=$BUILDPLATFORM ubuntu:rolling # The following line is needed to set the $TARGETARCH variable to amd64 or arm64 depending on the target architecture. If you need alternative formulations (x86_64 or aarch64) use $(arch) in a RUN command. ARG TARGETARCH -# This can be changed to "ci" to remove developer tools and reduce image size. Currently this only saves about 200MB of space. +# This can be changed to "ci" to remove developer tools and reduce image size. Currently this only saves about 200MB of space ARG CONTAINER_MODE=dev -# Different versions of clang and Java can be selected by specifying the following build arguments, but are not guaranteed to work. +# The version of clang to use ARG CLANG_VERSION=17 -ARG JAVA_VERSION=java11 - -# Can be set to something like `firtool-1.56.1` to use a specific CIRCT release -ARG PINNED_CIRCT_VERSION= # Setup container environment ENV \ # Change locale to suppress some warnings LC_ALL=C \ # - # Setup clang - CC=clang-$CLANG_VERSION \ - CXX=clang++-$CLANG_VERSION \ - LLVM_SYMBOLIZER_PATH=llvm-symbolizer-$CLANG_VERSION \ - # # Set VSCode as default editor EDITOR="code --wait" \ GIT_EDITOR="code --wait" @@ -76,6 +67,9 @@ RUN \ apt autoremove -y && \ rm /usr/bin/clang-cl-$CLANG_VERSION && \ # + # Create suffix-free links to clang binaries + for FILE in $(find /usr/bin -name "*-$CLANG_VERSION"); do ln -s ${FILE} ${FILE%-$CLANG_VERSION}; done && \ + # # Verilator hardcodes "g++" as the C++ compiler, so we symlink clang++ to g++ to avoid having gcc installed cd /usr/bin && ln -s clang++-$CLANG_VERSION g++ && \ # diff --git a/.devcontainer/default/VSCode/settings.json b/.devcontainer/default/VSCode/settings.json index f27989c05131..1b72ac4d6d41 100644 --- a/.devcontainer/default/VSCode/settings.json +++ b/.devcontainer/default/VSCode/settings.json @@ -23,7 +23,7 @@ "-DLLVM_USE_SANITIZER=", // LLVM (performance) - "-DLLVM_USE_LINKER=lld-17", + "-DLLVM_USE_LINKER=lld", "-DLLVM_OPTIMIZED_TABLEGEN=ON", "-DLLVM_USE_SPLIT_DWARF=ON", @@ -34,7 +34,6 @@ ], // -- Clangd Settings - "clangd.path": "clangd-17", "clangd.checkUpdates": false, "clangd.onConfigChanged": "restart", "clangd.arguments": [ @@ -42,7 +41,6 @@ "--compile-commands-dir=${workspaceFolder}/build/circt", "--header-insertion=never", "--clang-tidy", - "--clang-tidy-checks=*", "--pch-storage=memory" ], diff --git a/.devcontainer/default/devcontainer.json b/.devcontainer/default/devcontainer.json index ad504e03c7ee..43de7b9fc888 100644 --- a/.devcontainer/default/devcontainer.json +++ b/.devcontainer/default/devcontainer.json @@ -2,16 +2,17 @@ "name": "CIRCT", "dockerFile": "Dockerfile", "runArgs": [ + // Allow the processes in the container to attach a debugger "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], "mounts": [ - /// VSCode settings in Docker need to be different from the host machine + // VSCode settings in Docker need to be different from the host machine "source=${localWorkspaceFolder}/.devcontainer/default/VSCode,target=${containerWorkspaceFolder}/.vscode,type=bind", - /// Use a named volume for the build products for optimal performance (https://code.visualstudio.com/remote/advancedcontainers/improve-performance?WT.mc_id=javascript-14373-yolasors#_use-a-targeted-named-volume) + // Use a named volume for the build products for optimal performance (https://code.visualstudio.com/remote/advancedcontainers/improve-performance?WT.mc_id=javascript-14373-yolasors#_use-a-targeted-named-volume) "source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/build,type=volume", - /// Use a named volume to share the ccache database. We use a simple name so that different devcontainers which build llvm could all share the same ccache database. Also share the configuration folder so configuration settings persist. + // Use a named volume to share the ccache database. We use a simple name so that different devcontainers which build llvm could all share the same ccache database. Also share the configuration folder so configuration settings persist. "source=shared-llvm-ccache-database,target=/root/.cache/ccache,type=volume", "source=shared-llvm-ccache-config,target=/root/.config/ccache,type=volume" ], @@ -32,7 +33,7 @@ ], "settings": { // This must be set in devcontainer.json because it must be an absolute path and thus cannot use `${workspaceFolder}` if defined in `settings.json` - "mlir.server_path": "${containerWorkspaceFolder}/build/circt/bin/circt-lsp-server", + "mlir.server_path": "${containerWorkspaceFolder}/build/circt/bin/circt-lsp-server" } } } diff --git a/.devcontainer/devcontainer-helper b/.devcontainer/devcontainer-helper index 68460545ea5a..b9861dc835c6 100755 --- a/.devcontainer/devcontainer-helper +++ b/.devcontainer/devcontainer-helper @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -euo pipefail PROJECT_ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd ) cd "$PROJECT_ROOT" || exit 1