Skip to content

Dev Container

The main development workflow runs inside a Docker dev container that ships the can-utils tooling and the toolchain required to build and test the library.

Make sure that you have the Devconatiner plugin already installed on your IDE of choice, we mainly use VSCode here, so this guide will be tailored towards those users.

When you open VSCode, you should see a popup in the bottom that says

VSCode Popup
Folder contains a Dev Container configuration file.
Reopen folder to develop in container.

Click Reopen in Container and VSCode should automatically start building the container.

Building the container usually takes a 5-15 minutes depending on the machine but once you build the Devcontainer the firs time around.

If you use an IDE that relies on a compile_commands file, the container automatically creates a compile_commands.json file for linux architecture inside the dev container. Use that file for the LSP.

In our testing we are going to be creating and destroying a virtual can line vcan_test this is going to be used for testing our messages actually being sent down the can line. The way you setup the canline is by running the following.

Terminal
sudo modprobe vcan
sudo ip link add dev vcan_test type vcan
sudo ip link set up vcan_test

If you don’t run these commands ahead of time before trying to send anything down the can line, you will error out.