Files
Codesys-Library-Atom-Modbus/docs/BUILD.md
T
2026-09-30 21:17:41 -06:00

1.7 KiB

Linux builds

A binary must match CPU architecture, libc and the CODESYS component interface. One .so cannot cover every Linux version. Build on the oldest supported target OS within each architecture, or use its sysroot in a matching cross toolchain.

Native Pi build, from Library:

sudo apt-get install build-essential make m4 sed dos2unix python3
./tools/build-linux.sh linux-aarch64

Native x86-64 Linux build: ./tools/build-linux.sh linux-x86_64. 32-bit ARM requires a matching ARM hard-float compiler/OS; do not use the ARM64 binary. The target argument labels output; it does not choose a compiler.

Cross-build example, provided a matching compiler and libc sysroot are installed:

CC=aarch64-linux-gnu-gcc ./tools/build-linux.sh linux-aarch64

For a custom compiler/sysroot use a compiler wrapper as CC. Cross builds have not been validated in this bundle. The supplied SDK's makefile controls linking; check its options before adding toolchain flags. CC must be one executable path. Build targets sequentially because component/out is shared and cleaned each run.

The build script accepts an SDKDIR environment override. Preserve the supplied SDK unchanged and use separate folders for replacement SDK versions. Record and test compatibility before changing the generated external function ABI. For ABI changes, regenerate C/M4 from the external CODESYS library and review tools/prepare_component.py; do not overwrite component implementations blindly.

Build metadata includes compiler, host, SDK file hashes and output architecture. Host OS/glibc describes the build host, not necessarily a cross-compiler sysroot. Add the actual sysroot and tested target runtime to build-info.txt before release.