Skip to content

Document and script building the native bridge for older Linux#1

Merged
OscarSotoSanchez merged 1 commit into
mainfrom
docs/build-native-older-linux
Jul 18, 2026
Merged

Document and script building the native bridge for older Linux#1
OscarSotoSanchez merged 1 commit into
mainfrom
docs/build-native-older-linux

Conversation

@OscarSotoSanchez

Copy link
Copy Markdown
Member

The native bridge libraries bundled in the JAR are compiled on Ubuntu 24.04, so they require GLIBC_2.32 and a libstdc++ exporting GLIBCXX_3.4.32 (a GCC 13+ runtime). On older hosts (e.g. Ubuntu 20.04: glibc 2.31 / GLIBCXX 3.4.28, and also Ubuntu 22.04, whose libstdc++ only reaches GLIBCXX_3.4.30) the first BRKGA call fails to load the bridge with "Cannot open library: /tmp/brkga-native-*/libbrkga_bridge_1.so". Nothing in the docs covered this.

Add a way to build a compatible bridge locally and pick it up transparently:

  • scripts/build_brkga_native.sh: standalone helper that clones the published tag and builds the bridge inside an older base image (default ubuntu:20.04) with g++-13 from the ubuntu-toolchain-r PPA. It statically links libstdc++/libgcc by folding the flags into CXX ("-static-libstdc++ -static-libgcc"), so the result links against an old-enough glibc and carries its own C++ runtime, needing no host GLIBCXX. The base image (IMAGE), objective counts (TUPLE_NS), generic bridge (GENERIC), mating mode, extra-blob capacity and output directory (OUT_DIR) are all parametrizable; inputs are validated up front and the temporary clone is cleaned up on exit.

  • docs/JAVA_GUIDE.md: new "Running on an older Linux" section explaining the symptom, exactly which glibc/GLIBCXX thresholds are affected (with a table showing that release date is not the criterion), and two build routes (Docker and a local toolchain). Pointers added from "Installing", "Requirements and platform", the root README and the examples README.

  • .gitignore: ignore the locally built native/ output directories.

Verified end-to-end on Ubuntu 20.04: the built libbrkga_bridge_1.so needs at most GLIBC_2.29 and no libstdc++.so.6, and the MainMinimal example runs against it via examples/native/ with no extra flags.

The native bridge libraries bundled in the JAR are compiled on Ubuntu 24.04,
so they require GLIBC_2.32 and a libstdc++ exporting GLIBCXX_3.4.32 (a GCC 13+
runtime). On older hosts (e.g. Ubuntu 20.04: glibc 2.31 / GLIBCXX 3.4.28, and
also Ubuntu 22.04, whose libstdc++ only reaches GLIBCXX_3.4.30) the first BRKGA
call fails to load the bridge with "Cannot open library:
/tmp/brkga-native-*/libbrkga_bridge_1.so". Nothing in the docs covered this.

Add a way to build a compatible bridge locally and pick it up transparently:

- scripts/build_brkga_native.sh: standalone helper that clones the published
  tag and builds the bridge inside an older base image (default ubuntu:20.04)
  with g++-13 from the ubuntu-toolchain-r PPA. It statically links
  libstdc++/libgcc by folding the flags into CXX ("-static-libstdc++
  -static-libgcc"), so the result links against an old-enough glibc and carries
  its own C++ runtime, needing no host GLIBCXX. The base image (IMAGE),
  objective counts (TUPLE_NS), generic bridge (GENERIC), mating mode, extra-blob
  capacity and output directory (OUT_DIR) are all parametrizable; inputs are
  validated up front and the temporary clone is cleaned up on exit.

- docs/JAVA_GUIDE.md: new "Running on an older Linux" section explaining the
  symptom, exactly which glibc/GLIBCXX thresholds are affected (with a table
  showing that release date is not the criterion), and two build routes (Docker
  and a local toolchain). Pointers added from "Installing", "Requirements and
  platform", the root README and the examples README.

- .gitignore: ignore the locally built native/ output directories.

Verified end-to-end on Ubuntu 20.04: the built libbrkga_bridge_1.so needs at
most GLIBC_2.29 and no libstdc++.so.6, and the MainMinimal example runs against
it via examples/native/ with no extra flags.
@OscarSotoSanchez
OscarSotoSanchez merged commit 2181c4e into main Jul 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant