Skip to content

fix(linux): enable vendored static deps for portable JNI builds#764

Closed
jamesarich wants to merge 1 commit into
maplibre:mainfrom
jamesarich:fix/linux-static-deps-amalgamation
Closed

fix(linux): enable vendored static deps for portable JNI builds#764
jamesarich wants to merge 1 commit into
maplibre:mainfrom
jamesarich:fix/linux-static-deps-amalgamation

Conversation

@jamesarich
Copy link
Copy Markdown

Description

Enable MLN_LINUX_STATIC_DEPS in the Linux CMake preset and point the maplibre-native submodule to a branch that supports vendoring system dependencies as static libraries.

This resolves #627 — Linux JNI artifacts will no longer crash with UnsatisfiedLinkError on distros whose system library versions differ from the build environment.

Changes

  • lib/maplibre-native-bindings-jni/CMakePresets.json — Added "MLN_LINUX_STATIC_DEPS": "ON" to the linux-base preset
  • .gitmodules — Updated submodule URL to fork with vendoring support
  • Submodule pointer updated to include the vendored deps implementation

Upstream dependency

This PR depends on the maplibre-native changes in sargunv/maplibre-native#2. Once merged upstream, the submodule URL and pointer should be updated to point to the upstream repo.

Test plan

Desktop (Linux, Ubuntu 25.04):

  • ./gradlew :lib:maplibre-native-bindings-jni:buildNative succeeds
  • Built .so has no dynamic dependencies on vendored libraries
  • No vendored symbols leaked in .so exports
  • Map renders correctly in a Compose Desktop application

Other platforms:

  • Changes are Linux-only (preset gating) — no impact on macOS, Windows, Android, iOS, or JS builds

Breaking changes

None. This only affects the Linux native build process, not the public API.

Enable MLN_LINUX_STATIC_DEPS in linux-base CMake preset to build all
C/C++ dependencies from source with -fPIC. This produces a portable
libmaplibre-jni.so that only dynamically links against system graphics
(X11, OpenGL), networking (libcurl, OpenSSL), and C++ runtime.

Updates maplibre-native submodule to include vendored deps support.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesarich
Copy link
Copy Markdown
Author

Closing to re-open with corrected changes. The .gitmodules URL change was incorrect — submodule should stay pointing to sargunv/maplibre-native.

@jamesarich jamesarich closed this Apr 16, 2026
@jamesarich jamesarich deleted the fix/linux-static-deps-amalgamation branch April 16, 2026 15:07
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.

desktop: build with amalgamated maplibre native

1 participant