SkillAgentSearch skills...

Cantools

No description available

Install / Use

/learn @aheit/Cantools
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

General Information

cantools is a set of libraries and command line tools for handling ASC, BLF, CLG, VSB, MDF, and DBC files from Vector-Informatik and others. The tools can be used to analyze and convert the data to other formats:

  • dbcls lists the contents of a DBC file.
  • cantomat converts log files in ASC, BLF, CLG, VSB format to a MAT
  • file (MATLAB format)
  • mdftomat converts log files in MDF format to a MAT file (up to MDF version 3.x)

Some tools are available for testing of converters:

  • matdump displays the content of a MAT file as ASCII text
  • dbccopy copies a DBC file

The tools 'cantomat' and 'mdftomat' require the package matio, which in turn requires the package hdf5. Support for these tools is optional; either disable them with '--disable-matlab' configure option or make sure hdf5 and matio dependencies are installed first (see instructions below).

Since hdf5 is intended only for native builds, it is recommended to disable the optional tools on cross-compile builds of cantools in order to avoid this dependency https://support.hdfgroup.org/HDF5/faq/compile.html#cross

Shared libraries for parsing and accessing these files are also provided:

  • libcandbc, libcanasc, libcanblf, libcanclg, libcanvsb, libcanmdf for parsing of DBC, ASC, BLF, CLG, VSB, MDF files

Installation of hdf5 (cygwin)

Prerequisites: zlib, zlib-devel, bison , flex, make, gcc

matio can be built with libhdf5, here is how to:

  1. download: wget https://support.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.10.5.tar.bz2
  2. unpack: tar xjf hdf5-1.10.5.tar.bz2
  3. build: cd hdf5-1.10.5 ./configure --with-zlib=/usr/include,/lib --prefix=/usr --with-default-api-version=v110 CFLAGS=-std=c99 make CFLAGS=-std=c99 make check
  4. install: make install

Installation of matio (cygwin)

Prerequisites: autotools, zlib, zlib-devel, make, gcc

  1. download matio-1.5.17.tar.gz: wget 'http://downloads.sourceforge.net/matio/matio-1.5.17.tar.gz?use_mirror=' -O matio-1.5.17.tar.gz or curl -o matio-1.5.17.tar.gz -L 'http://downloads.sourceforge.net/matio/matio-1.5.17.tar.gz?use_mirror='
  2. unpack: tar xzf matio-1.5.17.tar.gz
  3. configure: cd matio-1.5.17 ./configure --with-zlib=/ --with-hdf5=/ --prefix=/usr
  4. build and install: make ; make install

Installation of zlib, hdf5, matio (linux)

sudo apt-get install cmake gcc libz-dev libmatio-dev flex bison libbison-dev

Building cantools

Prerequisites (cygwin): cmake, bison, flex, make, gcc, zlib, zlib-devel, pkg-config Prerequisites (linux): cmake, libz-dev, libmatio-dev, flex, bison, libbison-dev, make, gcc, pkg-config

git clone https://github.com/aheit/cantools cantools-code cd cantools cmake -S . -B build cmake --build build

CMAKE configuration options (can be combined): cmake -DWITH_MATLAB=OFF (default: ON) - only build tools without MATLAB backend cmake -DWITH_DMALLOC=ON (default: OFF) - build with dmalloc debug library cmake -DBUILD_SHARED_LIBS=OFF (default: ON) - build static libraries instead of shared

Using libcandbc as a library

When cantools is installed, libcandbc is available as a shared library along with its headers and a pkg-config file. To use it in your project:

pkg-config --cflags --libs libcandbc

Or in CMake:

find_package(PkgConfig REQUIRED) pkg_check_modules(CANDBC REQUIRED IMPORTED_TARGET libcandbc) target_link_libraries(myapp PRIVATE PkgConfig::CANDBC)

Installed files: lib/libcandbc.so (shared library) include/cantools/dbcmodel.h (data model types and structures) include/cantools/dbcreader.h (DBC file reader) include/cantools/dbcwriter.h (DBC file writer) include/cantools/dbctypes.h (base type definitions) lib/pkgconfig/libcandbc.pc (pkg-config file)

Related Skills

View on GitHub
GitHub Stars67
CategoryDevelopment
Updated19d ago
Forks34

Languages

C

Security Score

90/100

Audited on Mar 14, 2026

No findings