Skip to content

fix: lake: library load & link order#7809

Merged
tydeu merged 7 commits intoleanprover:masterfrom
tydeu:lake/fix-precompile
Apr 6, 2025
Merged

fix: lake: library load & link order#7809
tydeu merged 7 commits intoleanprover:masterfrom
tydeu:lake/fix-precompile

Conversation

@tydeu
Copy link
Copy Markdown
Member

@tydeu tydeu commented Apr 3, 2025

This PR fixes the order of libraries when loading them via --load-dynlib or --plugin in lean and when linking them into a shared library or executable. A Dynlib now tracks its dependencies and they are topologically sorted before being passed to either linking or loading.

Closes #7790.

@tydeu tydeu added release-ci Enable all CI checks for a PR, like is done for releases changelog-lake Lake labels Apr 3, 2025
@tydeu tydeu force-pushed the lake/fix-precompile branch from 2cbd318 to 485e814 Compare April 4, 2025 01:14
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Apr 4, 2025
ghost pushed a commit to leanprover-community/batteries that referenced this pull request Apr 4, 2025
ghost pushed a commit to leanprover-community/mathlib4 that referenced this pull request Apr 4, 2025
@tydeu tydeu marked this pull request as ready for review April 4, 2025 04:51
@ghost ghost added the builds-mathlib CI has verified that Mathlib builds against this PR label Apr 4, 2025
@ghost
Copy link
Copy Markdown

ghost commented Apr 4, 2025

Mathlib CI status (docs):

@tydeu
Copy link
Copy Markdown
Member Author

tydeu commented Apr 4, 2025

!bench

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 1550805.
There were significant changes against commit 911ea07:

  Benchmark                   Metric         Change
  ============================================================
- bv_decide_inequality.lean   maxrss           2.0%   (20.5 σ)
+ lake build no-op            instructions   -10.3% (-240.6 σ)
+ lake config import          task-clock      -3.7%  (-11.2 σ)
+ lake config import          wall-clock      -3.7%  (-10.5 σ)
- unionfind                   task-clock       5.5%   (10.3 σ)
- unionfind                   wall-clock       5.5%   (10.3 σ)

@tydeu tydeu added this pull request to the merge queue Apr 6, 2025
Merged via the queue into leanprover:master with commit c3ff433 Apr 6, 2025
28 checks passed
@tydeu tydeu deleted the lake/fix-precompile branch April 6, 2025 19:12
github-merge-queue bot pushed a commit that referenced this pull request Apr 19, 2025
This PR fixes bugs in #7809 and #7909 that were not caught partially
because the `badImport` test had been disabled.

**Bugs Fixed:**

* Building by path no longer drops top-level logs.
* "bad import" errors are once again printed.
* Transitively imported precompiled modules are once again loaded during
elaboration.
tydeu added a commit to tydeu/lean4 that referenced this pull request Apr 30, 2025
This PR fixes the order of libraries when loading them via
`--load-dynlib` or `--plugin` in `lean` and when linking them into a
shared library or executable. A `Dynlib` now tracks its dependencies and
they are topologically sorted before being passed to either linking or
loading.

Closes leanprover#7790.
tydeu added a commit that referenced this pull request May 1, 2025
This PR backports fixes to dynamic library linking and loading in Lake
to `v4.19.0`.

Includes changes from #7809, #8026, #8152, and #8190.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-mathlib CI has verified that Mathlib builds against this PR changelog-lake Lake release-ci Enable all CI checks for a PR, like is done for releases toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure due to shared library being loaded in the wrong order by Lake when using precompileModules

2 participants