A Modern C Development Environment | Interrupt

Sometimes, C/C++ projects have a long development cycle. When working on such a project, it can be easy to take our development environment for granted, and forget about the effort invested in its bring-up. The build environment works like magic, the test framework is neatly integrated, and the CI/CD pipeline relieves us of tedious, repetitive tasks.


This is a companion discussion topic for the original entry at https://interrupt.memfault.com/blog/a-modern-c-dev-env

Nice writeup.
One thing I’d like to add, which I’ve incorporated into my own devcontainers is that you can also install the vendor toolchains, by using docker’s COPY command to copy a fixed version installer and running the installer through the commandline.
What this allows you to do, is to then open and use your vendor’s configuration and code generation tools.
You can forward your X-server to the devcontainer by adding this mount to your devcontainer.json:

"mounts": [
    "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind"
]

This also means that if you run windows, and use docker with the wsl2 backend (which you should on windows) and you’re running on an updated windows 11 release, you will be able to see the programs launched in the devcontainer as they go:
devcontainer’s X11-server → WSL2’s X11-server → WSLg

Same goes for other nice tools like forwarding your ssh-agent to the container, which allows you to use ssh keys stored in your agent from within the devcontainer, to commit/pull/push and such :slight_smile:
For that there is this mount (replace /home/developer with your devcontainer user’s home dir):


"mounts": [
	"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/developer/.ssh,type=bind"
]

There’s also been two talks about this kind of setup at emBO++ 2023:

My lightning talk: (Florian Humblot - Getting Rid of “It Works on my Machine” - emBO++ 2023 - YouTube
And a talk from Jonas Nussdorfer (more specifically about Zephyr): Hands on Molding VS code into a care free development environment to develop with Zephyr RTOS - emBO - YouTube

Nice to instructions for a full dev environment setup in one place.

Note that when running WSL2 on Windows, and using a Linux container, you’re getting hardware virtualization. As long as your code resides within the WSL2 Linux file system (not the mounted Windows file system) you get close to native Linux performance. I did a side-by-side comparison building the same FW image in the same Docker container definition on a Windows/WSL2 machine and a native install Linux machine. While the machines were slightly different, the build times were approximately the same.

Great article, thank you! I think the most important thing is getting a consistent version reference on all the tools (Ceedling, clang-tidy, etc.). I also appreciate the acknowledgments of Docker’s limitations and pointing them out up front. No, Dockerfiles are not forever. Pre-Docker, some companies have been creating VM images (VMWare or VirtualBox) and cataloguing that as their “dev environment”. In the case of Docker, depending on security and longevity concerns, I think it means that you have the image captured on a local server.

As far as multiple tools in the same dev environment, I have been exploring with the possibility of Docker Compose for bringing in multiple tools, but it doesn’t work. It has to all be in one container. I think that one needs to have different Docker images for CI vs. local development. The issue is that in CI the jobs are running separately and you don’t want to pull the same container multiple times for separate jobs (unit tests, clang-format, build, etc.). The local dev environment is different. In this case, you do want it all mashed into one container. I don’t like this solution as I feel it violates DRY, but I’m still looking at what is possible here.

A few points I want to touch on.

In the section Building outside of vscode and mounting volumes, the mount is not a Docker volume mount. It is a bind-mount, even when using the VOLUME instruction in your Dockerfile. Microsoft VS Code dev containers specifically bind-mount the working directory of the project into the container. The VOLUME instruction itself creates a mount point, not a volume. The -v parameter with two arguments is still creating a bind-mount.

I would also recommend sticking with the same directory naming as the dev container when building from the command line. Instead of /builder/mnt, I would use /workspaces/cproject. The issue is that you’re changing the path names that appear in the compile_commands.json, the CMake output files, and the ELF file. This will screw up IntelliSense and incremental builds when you go back into the container.

The second issue is this statement:

For Windows, at the time of writing, I don’t know of a similar solution so you might have to dig a little deeper in case you run into performance problems.

This has a simple solution: use WSL. On Windows, Docker is native to WSL2. Building from WSL2 blows away the performance building natively from (NTFS) Windows even before considering Docker. And mounting from a WSL2 instance into a Docker container has no performance impact. I have done empirical testing on this. We had a project recently at my company that was over 300 steps according to Ninja. (I say steps as opposed to compilation units because this includes intermediate static library generation, the linking stage, and OBJCOPY stages.). Here are my the results of my tests for just the Ninja portion of this build (i.e. the equivalent of the cmake --build build step in this example).

  • WSL2 native: 6 seconds
  • WSL2 bind-mounted into dev container: 6 seconds
  • Windows (NTFS) native: 18 seconds
  • Windows (NTFS) bind-mounted into dev container: 1 minute

Bind-mounting from WSL2 is a wash and building from WSL2 is already super fast. I don’t have a direct measurement against Mac OS, but based on watching builds, my impression is that it’s faster. The other benefit of WSL2 is that it’s a true Linux environment, which brings me to my third point.

Building from the Docker environment on Linux will build with different user and group permissions. In this case, the builder-run target in the Makefile is building as root, which means access is denied to these files once you exit the container.

Sample output:

aaronf@DESKTOP-2HU5QJM:~/Learning/cproject$ make builder-run
docker run \
        --rm \
        -it \
        --platform linux/amd64 \
        --workdir /builder/mnt \
        -v .:/builder/mnt \
        cproject-builder:latest \
        /bin/bash
root ➜ /builder/mnt $ rm -rf build
root ➜ /builder/mnt $ cmake -B build
-- The C compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /builder/mnt/build
root ➜ /builder/mnt $ cmake --build build
Scanning dependencies of target Dummy
[ 50%] Building C object CMakeFiles/Dummy.dir/src/dummy.c.o
[100%] Linking C static library libDummy.a
[100%] Built target Dummy
root ➜ /builder/mnt $ exit
exit
aaronf@DESKTOP-2HU5QJM:~/Learning/cproject$ rm -rf build
rm: cannot remove 'build/CMakeFiles/Dummy.dir/depend.internal': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/DependInfo.cmake': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/link.txt': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/flags.make': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/progress.make': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/cmake_clean.cmake': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/cmake_clean_target.cmake': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/C.includecache': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/depend.make': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/build.make': Permission denied
rm: cannot remove 'build/CMakeFiles/Dummy.dir/src/dummy.c.o': Permission denied
rm: cannot remove 'build/CMakeFiles/CMakeDirectoryInformation.cmake': Permission denied
rm: cannot remove 'build/CMakeFiles/progress.marks': Permission denied
rm: cannot remove 'build/CMakeFiles/CMakeTmp': Permission denied
rm: cannot remove 'build/CMakeFiles/cmake.check_cache': Permission denied
rm: cannot remove 'build/CMakeFiles/Makefile2': Permission denied
rm: cannot remove 'build/CMakeFiles/3.18.4/CMakeCCompiler.cmake': Permission denied
rm: cannot remove 'build/CMakeFiles/3.18.4/CMakeSystem.cmake': Permission denied
rm: cannot remove 'build/CMakeFiles/3.18.4/CMakeDetermineCompilerABI_C.bin': Permission denied
rm: cannot remove 'build/CMakeFiles/3.18.4/CompilerIdC/tmp': Permission denied
rm: cannot remove 'build/CMakeFiles/3.18.4/CompilerIdC/a.out': Permission denied
rm: cannot remove 'build/CMakeFiles/Makefile.cmake': Permission denied
rm: cannot remove 'build/CMakeFiles/CMakeOutput.log': Permission denied
rm: cannot remove 'build/libDummy.a': Permission denied
rm: cannot remove 'build/CMakeCache.txt': Permission denied
rm: cannot remove 'build/Makefile': Permission denied
rm: cannot remove 'build/cmake_install.cmake': Permission denied
rm: cannot remove 'build/compile_commands.json': Permission denied
aaronf@DESKTOP-2HU5QJM:~/Learning/cproject$ code .

hi all,
i build the environment ,it get “unable to prepare context: unable to get relative Dockerfile path Rel: can’t ma
ke R:\Temp\devcontainercli\container-features\0.50.0-1694015292266\Dockerfile-wi
th-features relative to C:\Users\steve\esp\Embeded”

ps, the system templete directory “R” is an RAM disk.
and i can build docker existing Docker image from Docker Hub(vs code and wsl is work)

how to solve this and Provide some advisory information

platform :

Windows 11 64-bit
Linux LAPTOP-436CQ9L1 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
——————————————
full log :
[2023-09-06T15:48:09.184Z] Dev Containers 0.304.0 in VS Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794).

[2023-09-06T15:48:09.184Z] Start: Resolving Remote

[2023-09-06T15:48:09.208Z] Setting up container for folder or workspace: c:\Users\steve\esp\Embeded

[2023-09-06T15:48:09.209Z] Start: Run: wsl -l -v

[2023-09-06T15:48:09.366Z] Stop (157 ms): Run: wsl -l -v

[2023-09-06T15:48:09.366Z] Start: Run: wsl -d Ubuntu -e /bin/sh -c echo ~

[2023-09-06T15:48:09.571Z] Stop (205 ms): Run: wsl -d Ubuntu -e /bin/sh -c echo ~

[2023-09-06T15:48:09.573Z] Start: Run: wsl -d Ubuntu -e /bin/sh -c cd ‘/home/steven’ && /bin/sh

[2023-09-06T15:48:09.578Z] Start: Run in host: id -un

[2023-09-06T15:48:09.786Z] steven

[2023-09-06T15:48:09.787Z]

[2023-09-06T15:48:09.787Z] Stop (209 ms): Run in host: id -un

[2023-09-06T15:48:09.787Z] Start: Run in host: getent passwd steven

[2023-09-06T15:48:09.788Z] Stop (1 ms): Run in host: getent passwd steven

[2023-09-06T15:48:09.788Z] Start: Run in host: echo ~

[2023-09-06T15:48:09.789Z] /home/steven

[2023-09-06T15:48:09.789Z]

[2023-09-06T15:48:09.789Z] Stop (1 ms): Run in host: echo ~

[2023-09-06T15:48:09.790Z] Start: Run in host: test -x ‘/home/steven/.vscode-remote-containers/bin/6c3e3dba23e8fadc360aed75ce363ba185c49794/node’

[2023-09-06T15:48:09.791Z]

[2023-09-06T15:48:09.791Z]

[2023-09-06T15:48:09.791Z] Stop (1 ms): Run in host: test -x ‘/home/steven/.vscode-remote-containers/bin/6c3e3dba23e8fadc360aed75ce363ba185c49794/node’

[2023-09-06T15:48:09.791Z] Start: Run in host: test -f ‘/home/steven/.vscode-remote-containers/dist/vscode-remote-containers-server-0.304.0.js’

[2023-09-06T15:48:09.792Z]

[2023-09-06T15:48:09.792Z]

[2023-09-06T15:48:09.792Z] Stop (1 ms): Run in host: test -f ‘/home/steven/.vscode-remote-containers/dist/vscode-remote-containers-server-0.304.0.js’

[2023-09-06T15:48:09.794Z] userEnvProbe: loginInteractiveShell (default)

[2023-09-06T15:48:09.795Z] userEnvProbe: not found in cache

[2023-09-06T15:48:09.795Z] userEnvProbe shell: /bin/bash

[2023-09-06T15:48:10.024Z] userEnvProbe PATHs:

Probe: ‘/home/steven/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/usbipd-win/:/mnt/c/Program Files/TortoiseGit/bin:/mnt/c/Program Files/Nordic Semiconductor/nrf-command-line-tools/bin/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/CMake/bin:/Docker/host/bin:/mnt/c/Users/steve/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/steve/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/home/steven/.local/bin’

Container: None

[2023-09-06T15:48:10.030Z] Start: Run in Host: wslpath -w /run/user/1000/wayland-0

[2023-09-06T15:48:10.033Z] Stop (3 ms): Run in Host: wslpath -w /run/user/1000/wayland-0

[2023-09-06T15:48:10.034Z] Start: Check Docker is running

[2023-09-06T15:48:10.034Z] Start: Run: docker version --format {{.Server.APIVersion}}

[2023-09-06T15:48:10.196Z] Stop (162 ms): Run: docker version --format {{.Server.APIVersion}}

[2023-09-06T15:48:10.196Z] Server API version: 1.43

[2023-09-06T15:48:10.196Z] Stop (162 ms): Check Docker is running

[2023-09-06T15:48:10.197Z] Start: Run: docker volume ls -q

[2023-09-06T15:48:10.350Z] Stop (153 ms): Run: docker volume ls -q

[2023-09-06T15:48:10.351Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\Users\steve\esp\Embeded --filter label=vsch.quality=stable

[2023-09-06T15:48:10.505Z] Stop (154 ms): Run: docker ps -q -a --filter label=vsch.local.folder=c:\Users\steve\esp\Embeded --filter label=vsch.quality=stable

[2023-09-06T15:48:10.505Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded --filter label=devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json

[2023-09-06T15:48:10.659Z] Stop (154 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded --filter label=devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json

[2023-09-06T15:48:10.659Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded

[2023-09-06T15:48:10.817Z] Stop (158 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded

[2023-09-06T15:48:10.818Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded

[2023-09-06T15:48:10.954Z] Stop (136 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded

[2023-09-06T15:48:10.954Z] Start: Run: C:\Users\steve\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js read-configuration --workspace-folder c:\Users\steve\esp\Embeded --id-label devcontainer.local_folder=c:\Users\steve\esp\Embeded --id-label devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --mount-workspace-git-root true

[2023-09-06T15:48:11.224Z] @devcontainers/cli 0.50.0. Node.js v16.17.1. win32 10.0.22621 x64.

[2023-09-06T15:48:11.224Z] Start: Run: git rev-parse --show-cdup

[2023-09-06T15:48:11.300Z] Stop (76 ms): Run: git rev-parse --show-cdup

[2023-09-06T15:48:11.301Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded --filter label=devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json

[2023-09-06T15:48:11.456Z] Stop (155 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded --filter label=devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json

[2023-09-06T15:48:11.466Z] Stop (512 ms): Run: C:\Users\steve\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js read-configuration --workspace-folder c:\Users\steve\esp\Embeded --id-label devcontainer.local_folder=c:\Users\steve\esp\Embeded --id-label devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --mount-workspace-git-root true

[2023-09-06T15:48:11.467Z] Start: Run: C:\Users\steve\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\steve\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-5bd8d5a0-ce38-48a4-a6e5-1475db3d922a1694015288678 --workspace-folder c:\Users\steve\esp\Embeded --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\steve\esp\Embeded --id-label devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=\wsl.localhost\Ubuntu\run\user\1000\wayland-0,target=/tmp/vscode-wayland-11c87064-f199-4c64-b84e-8f0b520189e7.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true

[2023-09-06T15:48:11.743Z] @devcontainers/cli 0.50.0. Node.js v16.17.1. win32 10.0.22621 x64.

[2023-09-06T15:48:11.743Z] Start: Run: docker buildx version

[2023-09-06T15:48:11.891Z] Stop (148 ms): Run: docker buildx version

[2023-09-06T15:48:11.892Z]

[2023-09-06T15:48:11.892Z] docker: ‘buildx’ is not a docker command.

See ‘docker --help’

[2023-09-06T15:48:11.892Z] Exit code 1

[2023-09-06T15:48:11.892Z] Start: Resolving Remote

[2023-09-06T15:48:11.895Z] Start: Run: git rev-parse --show-cdup

[2023-09-06T15:48:11.946Z] Stop (51 ms): Run: git rev-parse --show-cdup

[2023-09-06T15:48:11.949Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded --filter label=devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json

[2023-09-06T15:48:12.098Z] Stop (149 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\Users\steve\esp\Embeded --filter label=devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json

[2023-09-06T15:48:12.103Z] Start: Run: docker inspect --type image Microsoft Artifact Registry

[2023-09-06T15:48:12.266Z] Stop (163 ms): Run: docker inspect --type image Microsoft Artifact Registry

[2023-09-06T15:48:12.267Z] local container features stored at: c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\node_modules\vscode-dev-containers\container-features

[2023-09-06T15:48:12.268Z] Start: Run: tar --no-same-owner -x -f -

[2023-09-06T15:48:12.295Z] Stop (27 ms): Run: tar --no-same-owner -x -f -

[2023-09-06T15:48:12.297Z] Start: Run: docker build -f R:\Temp\devcontainercli\container-features\0.50.0-1694015292266\Dockerfile-with-features -t vsc-embeded-f9ddce67c0f08868332f3c79a91e0b4295e02aae2961810a7d28e3713cb3ed73 --target dev_containers_target_stage --build-arg _DEV_CONTAINERS_BASE_IMAGE=builder-install c:\Users\steve\esp\Embeded

[2023-09-06T15:48:12.482Z]

[2023-09-06T15:48:12.525Z] DEPRECATED: The legacy builder is deprecated and will be removed in a future rel

ease.

Install the buildx component to build images with BuildKit:

[2023-09-06T15:48:12.556Z] unable to prepare context: unable to get relative Dockerfile path: Rel: can’t ma

ke R:\Temp\devcontainercli\container-features\0.50.0-1694015292266\Dockerfile-wi

th-features relative to C:\Users\steve\esp\Embeded

[2023-09-06T15:48:12.617Z] Stop (320 ms): Run: docker build -f R:\Temp\devcontainercli\container-features\0.50.0-1694015292266\Dockerfile-with-features -t vsc-embeded-f9ddce67c0f08868332f3c79a91e0b4295e02aae2961810a7d28e3713cb3ed73 --target dev_containers_target_stage --build-arg _DEV_CONTAINERS_BASE_IMAGE=builder-install c:\Users\steve\esp\Embeded

[2023-09-06T15:48:12.619Z] Error: Command failed: docker build -f R:\Temp\devcontainercli\container-features\0.50.0-1694015292266\Dockerfile-with-features -t vsc-embeded-f9ddce67c0f08868332f3c79a91e0b4295e02aae2961810a7d28e3713cb3ed73 --target dev_containers_target_stage --build-arg _DEV_CONTAINERS_BASE_IMAGE=builder-install c:\Users\steve\esp\Embeded

[2023-09-06T15:48:12.619Z] at IAA (c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js:463:1698)

[2023-09-06T15:48:12.620Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5)

[2023-09-06T15:48:12.620Z] at async qw (c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js:462:1691)

[2023-09-06T15:48:12.620Z] at async mK (c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js:462:610)

[2023-09-06T15:48:12.620Z] at async mAA (c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js:479:3660)

[2023-09-06T15:48:12.620Z] at async LC (c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js:479:4775)

[2023-09-06T15:48:12.620Z] at async jeA (c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js:611:12219)

[2023-09-06T15:48:12.620Z] at async _eA (c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js:611:11960)

[2023-09-06T15:48:12.632Z] Stop (1165 ms): Run: C:\Users\steve\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\steve\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-5bd8d5a0-ce38-48a4-a6e5-1475db3d922a1694015288678 --workspace-folder c:\Users\steve\esp\Embeded --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\steve\esp\Embeded --id-label devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=\wsl.localhost\Ubuntu\run\user\1000\wayland-0,target=/tmp/vscode-wayland-11c87064-f199-4c64-b84e-8f0b520189e7.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true

[2023-09-06T15:48:12.632Z] Exit code 1

[2023-09-06T15:48:12.635Z] Command failed: C:\Users\steve\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\steve.vscode\extensions\ms-vscode-remote.remote-containers-0.304.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\steve\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-5bd8d5a0-ce38-48a4-a6e5-1475db3d922a1694015288678 --workspace-folder c:\Users\steve\esp\Embeded --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\steve\esp\Embeded --id-label devcontainer.config_file=c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\Users\steve\esp\Embeded.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=\wsl.localhost\Ubuntu\run\user\1000\wayland-0,target=/tmp/vscode-wayland-11c87064-f199-4c64-b84e-8f0b520189e7.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true

[2023-09-06T15:48:12.636Z] Exit code 1
——————————————

This is a great article on how to setup a C development environment.

I prefer to have the debugger run natively on the host and connect to it by adding
“gdbTarget”: “host.docker.internal:2331”,
to the configuration in launch.json. This way I do not have to mount the USB-probe in the container.