Skip to content

fix(build): restore precompiled MLN builds#242

Merged
ciscorn merged 6 commits into
maplibre:mainfrom
MIERUNE:fix-precompiled
Jun 19, 2026
Merged

fix(build): restore precompiled MLN builds#242
ciscorn merged 6 commits into
maplibre:mainfrom
MIERUNE:fix-precompiled

Conversation

@ciscorn

@ciscorn ciscorn commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

I found MLN_PRECOMPILE=1 builds are currently broken, but this was not caught by CI. This PR updates the precompiled MapLibre Native release and fixes the link setup:

(Some of these changes are based on #237 by @yuiseki - thanks!)

Note: macOS still does not work with MLN_PRECOMPILE=1 because the amalgam (built with armerge --keep-symbols 'mbgl.*') also hides the C++ exception RTTI symbols.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores support for MLN_PRECOMPILE=1 builds by updating the precompiled MapLibre Native release metadata, fixing build-script include/link configuration, and adding CI coverage to prevent future regressions.

Changes:

  • Bump the precompiled MapLibre Native release tag used by MLN_PRECOMPILE=1.
  • Restore the vendored bridge include/ directory to the C++ bridge include path.
  • Link libuv only on non-Apple targets in the build script, and exercise precompiled builds in CI.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Cargo.toml Updates package.metadata.mln.release to a newer precompiled MapLibre Native core tag.
build.rs Restores bridge include dirs (adds include/) and adjusts libuv linking to be non-Apple only.
.github/workflows/ci.yml Switches selected matrix legs to precompiled: 1 / amalgam: 1 to cover precompiled builds in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ciscorn ciscorn marked this pull request as draft June 17, 2026 23:14
@ciscorn ciscorn marked this pull request as ready for review June 18, 2026 01:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 11 comments.

Comment thread tests/image_renderer.rs
Comment thread tests/image_renderer.rs
Comment thread tests/image_renderer.rs
Comment thread tests/image_renderer.rs
Comment thread tests/image_renderer.rs
Comment thread tests/image_renderer.rs
Comment thread src/style/geojson.rs Outdated
Comment thread src/style/geojson.rs
Comment thread src/cpp/geojson/geojson.cpp
Comment thread build.rs
ciscorn and others added 2 commits June 18, 2026 11:53
Co-authored-by: yuiseki <yui.matsumura@geolonia.com>
@yuiseki

yuiseki commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Thank you for referring to my PR!

FYI:
I've sent a small PR to publish mbgl::style::conversion::stringifyGeoJSON to maplibre-native:

I think it may be helpful for maplibre-native-rs.

@ciscorn

ciscorn commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

@yuiseki Thanks. I switched the stringify parts I'd removed to commented-out instead🙏

return std::make_unique<GeoJson>(geojson.get());
}

rust::String stringify(const GeoJson& geojson) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add a feature flag and disable conditionally?

@ciscorn ciscorn Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping it commented out and waiting for maplibre/maplibre-native#4345 is the safe option here, rather than adding a feature flag.

Reasons:

  • A flag can't link against anything until stringifyGeoJSON ships; then we just un-comment it — no flag needed.
  • Gating one method — with no clear use case yet — needs a lot of plumbing.
  • We're actively embracing breaking changes for now.

Comment thread tests/image_renderer.rs
tick_until_ready(|| request.is_ready());

let image = request.finish().expect("geometry-fit renderer should render");
let image = request.wait().expect("geometry-fit renderer should render");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we name it wait_finish? Because wait is quite generic?

@ciscorn ciscorn Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that wait may be a bit generic. That said, this is the blocking utility for a render request, so I think RenderRequest::wait() is still acceptable, similar to JoinHandle::join() or process::Child::wait().

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, suggestions to improve the name are very welcome.

Comment thread build.rs

// The precompiled headers tarball omits `platform/default/` headers
// (e.g. `mbgl/gfx/headless_frontend.hpp`), so add vendored fallbacks.
let root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do this only for amalgam. We don't need this include folder when compiling our self

@ciscorn ciscorn Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is already scoped that way! It's only added inside bundle_precompiled(), so source builds don't pull it in.

@ciscorn ciscorn requested a review from Murmele June 18, 2026 07:27
Comment thread .github/workflows/ci.yml
Comment on lines 93 to +96
- runs-on: ubuntu-latest
backend: vulkan
precompiled: 0
amalgam: 0
precompiled: 1
amalgam: 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add another variant to the matrix not remove a variant from ci.
If CI thakes longer because of this, this is preferable to not checking a path that we could have checked imo

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hesitant to grow the matrix, but I think it's the right call. Added it. Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, growing beyond 10 jobs means that one gets queued, unless github has extra capa, but that is fine.

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with this change, but I would prefer if we wait the maybe week or so that the PR in native would take. Seems like an easy fix.

Thanks @yuiseki for looking into this ❤️

@ciscorn

ciscorn commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review and approval 🙏❤️

A small scope note, since the GeoJSON discussion may have drawn the focus: the core fix here is the broken MLN_PRECOMPILE=1 build (include path, libuv/sqlite3, CI coverage). The only caveat is that it temporarily comments out to_json_string() — which I'd added alongside parse() without a real use case, and which is blocking this MLN_PRECOMPILE=1 fix.

@CommanderStorm

Copy link
Copy Markdown
Member

if there is no real usecase behind this, I am fine with removing it (incl the commnted out code) as well.
Your (and @yuiseki's) call.

@ciscorn

ciscorn commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks! Merging this now. I'll re-enable the commented-out lines once @yuiseki's maplibre/maplibre-native#4345 lands.

@ciscorn ciscorn merged commit b2bb93d into maplibre:main Jun 19, 2026
29 of 31 checks passed
@ciscorn ciscorn deleted the fix-precompiled branch June 19, 2026 05:34
@CommanderStorm CommanderStorm mentioned this pull request Jun 17, 2026
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.

5 participants