This README explains how to go from the extension source code to a working ESBMC integration inside Visual Studio Code on Linux, incorporating the lessons learned from the test log in Teste_ESBMC.txt.
The ESBMC VS Code extension allows you to:
- Run ESBMC on the current C/C++ file directly from the editor.
- Install (download + unpack) the latest ESBMC binary on Linux using a dedicated command.
- See ESBMC results in the integrated VS Code terminal.
This document assumes you are using a Debian/Ubuntu-based distribution and the bash shell.
Before building and using the extension, make sure you have:
- Linux (tested on Ubuntu-based systems).
- Visual Studio Code installed.
- curl and git (for downloads and version control).
- unzip installed on your system (required for automatic ESBMC installation).
- Node.js (LTS) and npm, installed via nvm (Node Version Manager).
- vsce (VS Code Extension Manager) to package the extension as a
.vsix.
Open a terminal and run:
sudo apt update
sudo apt install curl git unzip -ycurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashsource ~/.bashrcnvm install --ltsnode -v
npm -vYou should see version numbers for Node.js and npm without errors.
Download or clone the ESBMC VS Code extension repository and move into the project folder. For example:
git clone https://github.com/esbmc/vscode-esbmc.git
cd vscode-esbmcThe exact directory name may vary; just ensure you are in the folder that contains package.json.
Install the required npm packages with:
npm installNotes based on the test:
-
This step worked correctly.
-
npm may show warnings or a message similar to:
11 vulnerabilities (1 low, 5 moderate, 4 high, 1 critical)In this case, you may optionally run:
npm audit npm audit fix
The extension can still be built and used even if some vulnerabilities remain.
Compile the extension (TypeScript → JavaScript) with:
npm run compileIf you see a Permission denied error when running npm run compile, fix the permissions for the TypeScript compiler and re-run the command:
chmod +x ./node_modules/.bin/tsc
npm run compileAfter a successful compilation, a directory named out will be created in the project folder.
Use npm to install vsce:
npm install -g @vscode/vsceFrom the root of the project (where package.json is located), run:
vsce packageTypical behavior:
vscemay ask or warn about:README.mdcontents,- missing
LICENSE, - missing
repositoryfield.
- You can confirm the prompts with
yto continue.
At the end, you should see a file such as:
vscode-esbmc-0.0.1.vsix
(or another versioned name) generated in the current directory.
- Open Visual Studio Code.
- Press Ctrl + Shift + P to open the Command Palette.
- Run “Extensions: Install from VSIX…”.
- Navigate to the
.vsixfile you created (e.g.vscode-esbmc-0.0.1.vsix) and select it. - After installation, click “Reload” to restart VS Code and activate the extension:
Open the command palette (Ctrl + Shift + P) and execute the command:
>Reload Window
After reloading, the ESBMC extension will be available for all your projects.
With the extension installed and active:
-
Open the Command Palette (Ctrl + Shift + P).
-
Look for and run:
ESBMC: Install the latest versionIf ESBMC is already installed, you could also do the following:
ESBMC: Update to latest version
The extension will automatically download and install the latest ESBMC binary suitable for your Linux environment.
According to Teste_ESBMC.txt, this workflow was successfully tested:
-
Open a C or C++ source file in VS Code.
-
Open the Command Palette (Ctrl + Shift + P).
-
Run:
ESBMC: Verify file
VS Code opens a terminal showing:
- the ESBMC command line,
- verification progress,
- and the final result.
By following the steps in this README, you can:
- Prepare your Linux environment (curl, git, nvm, Node.js, npm).
- Install dependencies and compile the ESBMC VS Code extension (
npm install,npm run compile). - Package the extension as a
.vsixfile withvsce package. - Install the
.vsixinto Visual Studio Code. - Use the extension to install ESBMC and verify C/C++ programs, either at the file level or per function.
This extension now supports local AI explanations for ESBMC verification results.
The AI is fully offline, running through the Ollama framework on Linux.
This feature is optional — you can continue using ESBMC normally without AI.
- Linux (tested on Ubuntu)
- ESBMC installed through this extension
- Ollama installed and running
- A local AI model downloaded (recommended below)
Run in terminal:
curl https://ollama.ai/install.sh | shStart the service:
ollama serveNote
If you see an error such as
Error: listen tcp 127.0.0.1:11434: bind: address already in use
it usually means that Ollama is already running and listening on port11434.You can confirm which process is using this port with:
sudo lsof -i:11434And you can check the Ollama service status with:
systemctl status ollamaIf the service is
active (running), you can safely skipollama serveand go directly to the verification step below.
Verify that it is running:
curl http://localhost:11434/api/tagsThis extension defaults to the model: llama3.1:8b
To install it:
ollama pull llama3.1:8b
- Open a C/C++ file in VS Code
- Press Ctrl + Shift + P
- Run:
ESBMC: Verify File with Local AI
The output will include:
- ESBMC verification results
- A concise AI explanation (English only)
- Suggested patch with corrected C code
| Symptom | Possible cause | Fix |
|---|---|---|
| [ERROR] Could not contact local AI | Ollama not running | Run ollama serve |
| Very slow output | Model too large for hardware | Try llama3.1:3b model |
| ESBMC not detected | PATH misconfiguration | Re-install ESBMC via extension |
✔ Feature Summary
| Feature | Status |
|---|---|
| ESBMC Installation | ✔ |
| ESBMC Verification inside VS Code | ✔ |
| Local AI-based Analysis using Ollama | NEW ✔ |