Baselibs
base libraries including common functionality
Install / Use
/learn @eclipse-score/BaselibsREADME
Base Libraries
Foundational C++ libraries providing common functionality for S-CORE modules, from QM to ASIL-B integrity levels.
Documentation
- Base Libraries Feature Documentation: High-level feature overview.
- Base Libraries Module Documentation: Detailed module documentation, including architecture and component requirements.
- Detailed Design: Each library includes a
README.mdwith usage examples and API details in its respectivescore/subdirectory.
Using Base Libraries
To depend on score_baselibs in your Bazel module, add the following to your MODULE.bazel file:
bazel_dep(name="score_baselibs", version="x.x.x")
Replace x.x.x with a version from the S-CORE Bazel Registry, where all available releases are listed.
Required Configuration Options
To use Base Libraries properly, you need to set the following build settings in your .bazelrc file or pass them to the bazel command:
--@score_baselibs//score/json:base_library=nlohmann
--@score_baselibs//score/memory/shared/flags:use_typedshmd=False
Using Unreleased Versions
To depend on an unreleased version (e.g., for testing or development), you can use a non-registry override in your MODULE.bazel file, for example git_override:
git_override(
module_name = "score_baselibs",
commit = "de5bb275ee9957433b3587582ac07d3eeb98dd6a",
remote = "https://github.com/eclipse-score/baselibs.git",
)
Replace the commit value with the specific git hash you want to use. This override allows you to depend on any commit from the repository, bypassing the registry resolution.
Contributing
Prerequisites
To set up your development environment, follow the official S-CORE Development Environment Guide. Key requirements include:
- Operating System: Linux host or a DevContainer setup (see below).
- Build System: Bazel 8+ (managed via Bazelisk).
- QNX 8.0 SDP: For QNX builds, follow the setup instructions in Bazel toolchains for QNX.
DevContainer Setup (Optional)
This repository offers a DevContainer.
For setup instructions and enabling code completion, see eclipse-score/devcontainer/README.md#inside-the-container.
[!NOTE] If you are using Docker on Windows without
WSL2in between, you have to select the alternative containereclipse-s-core-docker-on-windows.
Building the Module
First, clone the repository:
git clone git@github.com:eclipse-score/baselibs.git
cd baselibs
Building for x86_64 Linux
# Build all targets
bazel build --config=bl-x86_64-linux //...
# Run all tests
bazel test --config=bl-x86_64-linux //...
Building for AArch64 Linux
Use the same command as for x86_64 Linux, but replace --config=bl-x86_64-linux with --config=bl-aarch64-linux.
[!NOTE] AArch64 Linux support is currently experimental. Some targets may not build successfully.
Executing Cross-Compiled Tests with QEMU
When cross-compiling for AArch64, test binaries cannot run natively on an x86_64 host. They are executed locally using QEMU user-mode emulation.
Prerequisite: Install the qemu-user package on your host system:
sudo apt install qemu-user # Debian/Ubuntu
Verify the installation:
qemu-aarch64 --version
Running tests:
bazel test --config=bl-aarch64-linux //score/...
Building for x86_64 QNX 8.0 SDP
# Build all targets
bazel build --config=bl-x86_64-qnx -- //score/...
Building for AArch64 QNX 8.0 SDP
Use the same command as for x86_64 QNX, but replace --config=bl-x86_64-qnx with --config=bl-aarch64-qnx.
Sanitizers
To detect memory errors, undefined behavior, and memory leaks, run tests with sanitizers enabled:
bazel test --config=bl-x86_64-linux --config=asan_ubsan_lsan --build_tests_only -- //score/...
This configuration enables:
- AddressSanitizer (ASan): Fast memory error detector.
- UndefinedBehaviorSanitizer (UBSan): Detects undefined behavior at runtime.
- LeakSanitizer (LSan): Memory leak detector.
The sanitizers are configured with verbose output and will halt on the first error detected.
Generating Documentation
To generate the documentation locally:
bazel run //:docs
Access the documentation at _build/index.html in your browser.
Support and Community
- GitHub Issues: Report bugs or request features.
- GitHub Discussions: Ask questions and share ideas.
- Communication and Coordination: See the pinned discussion for details on communication channels and project coordination.
