diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82c9783..b1dac51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -282,9 +282,25 @@ jobs: rustup toolchain install stable --profile minimal rustup default stable rustc -vV | grep -x "host: ${{ matrix.target }}" + # On Linux the library is linked against glibc 2.28 (zig as the linker), not the runner's + # newer glibc, so it loads on every Linux distribution with glibc 2.28 or newer; the wheel's + # platform tag (manylinux_2_28_x86_64) says the same. It is copied to where the native build + # would put it, and the step fails if it needs a newer glibc than 2.28. - name: Build the binding library working-directory: sysml-sdk/abi - run: cargo build --release --locked + run: | + if [ "$RUNNER_OS" = Linux ]; then + python -m pip install --quiet ziglang==0.16.0 cargo-zigbuild==0.23.4 + export CARGO_ZIGBUILD_ZIG_PATH="$(python -c 'import os, ziglang; print(os.path.join(os.path.dirname(ziglang.__file__), "zig"))')" + cargo zigbuild --release --locked --target ${{ matrix.target }}.2.28 + mkdir -p target/release + cp target/${{ matrix.target }}/release/libsysmlv2_abi.so target/release/ + need=$(objdump -T target/release/libsysmlv2_abi.so | grep -o 'GLIBC_[0-9][0-9.]*' | sed 's/GLIBC_//' | sort -uV | tail -1) + echo "the binding library needs glibc $need" + test "$(printf '%s\n' "$need" 2.28 | sort -V | tail -1)" = 2.28 + else + cargo build --release --locked + fi # The Annex A regression test reads the specification's example model and standard library # from the SysML Toolkit's SysML-v2-Release submodule; one runner fetches it. diff --git a/CHANGELOG.md b/CHANGELOG.md index 9850428..4288a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,7 +119,8 @@ A payload, and the SysML Toolkit's JSON export: Platforms and packages: - Java needs `--enable-preview` on JDK 21; from JDK 22 on it does not. -- The Linux library is built on Ubuntu 24.04; older glibc versions are not tested. +- The Linux library is linked against glibc 2.28, so it loads on distributions with glibc 2.28 or + later (for example RHEL 8, Debian 10, Ubuntu 20.04 and newer); CI tests it on Ubuntu 24.04. - The C++ package is tested with GCC on Linux and with Apple Clang on macOS in CI, and with MinGW GCC on Windows by hand. - On macOS a library downloaded through a web browser is quarantined; remove the attribute with diff --git a/README.md b/README.md index af42aca..e42d19e 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ platform, and the standard library. The packages are not on the public registrie | Platform | Target | Wheel tag | |---|---|---| | Windows x64 | `x86_64-pc-windows-msvc` | `win_amd64` | -| Linux x64 (glibc; built on Ubuntu 24.04) | `x86_64-unknown-linux-gnu` | `linux_x86_64` | +| Linux x64 (glibc 2.28 or later) | `x86_64-unknown-linux-gnu` | `manylinux_2_28_x86_64` | | macOS, Apple silicon (11 or later) | `aarch64-apple-darwin` | `macosx_11_0_arm64` | | macOS, Intel (10.12 or later) | `x86_64-apple-darwin` | `macosx_10_12_x86_64` | | Anywhere JavaScript runs | `wasm32-unknown-unknown` | (in the npm package) | diff --git a/examples/python/README.md b/examples/python/README.md index 8281a15..d6233cc 100644 --- a/examples/python/README.md +++ b/examples/python/README.md @@ -16,7 +16,7 @@ A model is read through one of two backends, with the same classes over both: Python 3.10 or newer. Download the wheel for your platform from the release and install it: ```sh -pip install sysml-0.1.0-py3-none-win_amd64.whl # or linux_x86_64, macosx_11_0_arm64, macosx_10_12_x86_64 +pip install sysml-0.1.0-py3-none-win_amd64.whl # or manylinux_2_28_x86_64, macosx_11_0_arm64, macosx_10_12_x86_64 ``` The wheel carries the binding library; nothing else is needed. The same release has diff --git a/tools/package.py b/tools/package.py index 88687d1..b8363ed 100644 --- a/tools/package.py +++ b/tools/package.py @@ -50,9 +50,10 @@ VERSION = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))["project"]["version"] # Wheel platform tags. The macOS ones match the deployment targets the libraries are built for -# (MACOSX_DEPLOYMENT_TARGET in CI, which are also Rust's defaults for these targets). +# (MACOSX_DEPLOYMENT_TARGET in CI, which are also Rust's defaults for these targets); the x86-64 +# Linux one matches the glibc the library is linked against in CI (2.28). PLATFORM_TAGS = { - "x86_64-unknown-linux-gnu": "linux_x86_64", + "x86_64-unknown-linux-gnu": "manylinux_2_28_x86_64", "aarch64-unknown-linux-gnu": "linux_aarch64", "aarch64-apple-darwin": "macosx_11_0_arm64", "x86_64-apple-darwin": "macosx_10_12_x86_64",