Skip to content

Software

libmodbus

From github.com/stephane/libmodbus (opens in a new tab)

  • Robot arms and industry
  • Library
  • LGPL-2.1-only

A C library for talking to devices over the Modbus protocol, using either a serial port or an Ethernet connection.

Facts

GitHub stars
4,301read on 28 Nov 2026
Last update
2 Jul 2026Newest commit on master
Maintenance
Maintaineda commit in the last 12 months
Difficulty
Intermediate
Hardware it needs, as the project states it
A C compiler (gcc or clang) with automake, autoconf and libtool to build it; MCUs are supported via the Embox RTOS.

Checked on GitHub on 28 Nov 2026.

Licenses

Code
LGPL-2.1-only (opens in a new tab)

Read by Robotheca from COPYING.LESSER (opens in a new tab) (LGPL-2.1-only) at commit a9b025d (opens in a new tab), on 16 Oct 2026.

Commercial use
Yes

Copyleft: Modified source must be published.

At a glance

What it is
  • Sends and receives data with Modbus devices over a serial port or Ethernet.
  • Its functions are derived from the Modicon Modbus Protocol Reference Guide.
  • Written in C and designed to run on Linux, Mac OS X, FreeBSD, Embox, QNX and Windows.
  • Can be used on MCUs with the Embox RTOS.
  • Installed with a standard configure and make sequence, and provides a libmodbus.pc file for pkg-config.
  • Includes test programs (unit-test-server and unit-test-client) and a make check target.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
LGPL-2.1-only. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Maintained, last commit on 2 Jul 2026.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit a9b025d

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by @stephane, at commit a9b025d, under LGPL-2.1-only (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

A groovy modbus library

(opens in a new tab)

Overview

libmodbus is a free software library to send/receive data with a device which respects the Modbus protocol. This library can use a serial port or an Ethernet connection.

The functions included in the library have been derived from the Modicon Modbus Protocol Reference Guide which can be obtained from http://www.modbus.org (opens in a new tab).

The license of libmodbus is LGPL v2.1 or later.

The official website is http://www.libmodbus.org (opens in a new tab). The website contains the latest version of the documentation.

The library is written in C and designed to run on Linux, Mac OS X, FreeBSD, Embox, QNX and Windows.

You can use the library on MCUs with Embox RTOS.

Installation

You will only need to install automake, autoconf, libtool and a C compiler (gcc or clang) to compile the library and asciidoc and xmlto to generate the documentation (optional).

To install, just run the usual dance, ./configure && make install. Run ./autogen.sh first to generate the configure script if required.

You can change installation directory with prefix option, eg. ./configure --prefix=/usr/local/. You have to check that the installation library path is properly set up on your system (/etc/ld.so.conf.d) and library cache is up to date (run ldconfig as root if required).

The library provides a libmodbus.pc file to use with pkg-config to ease your program compilation and linking.

If you want to compile with Microsoft Visual Studio, you should follow the instructions in ./src/win32/README.md.

To compile under Windows, install MinGW (opens in a new tab) and MSYS then select the common packages (gcc, automake, libtool, etc). The directory ./src/win32/ contains a Visual C project.

To compile under OS X with homebrew (opens in a new tab), you will need to install the following dependencies first: brew install autoconf automake libtool.

To build under Embox, you have to use its build system.

Testing

Some tests are provided in tests directory, you can freely edit the source code to fit your needs (it's Free Software :).

See tests/README for a description of each program.

For a quick test of libmodbus, you can run the following programs in two shells:

  1. ./unit-test-server
  2. ./unit-test-client

By default, all TCP unit tests will be executed (see --help for options).

It's also possible to run the unit tests with make check.

To report a bug or to contribute

See CONTRIBUTING (opens in a new tab) document.

By contributing to libmodbus, you agree to the Contributor License Agreement (opens in a new tab).

Documentation

You can serve the local documentation with:

pip install mkdocs-material
mkdocs serve

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.