Prerequisites
Please put an X between the brackets as you perform the following steps:
Description
In trying to compile a project that depends on Mathlib and that uses precompileModules, I get a build error on Linux (and not on Macos) because lean tries to load libLake_shared.so which is not available.
Steps to Reproduce
- Create a project which depends on mathlib and imports it
- enable native compilation with
precompileModules
- run
lake build
Expected behavior:
lean compiles the library to a shared object.
Actual behavior:
Lean outputs the following error:
trace: .> LEAN_PATH=/home/ineol/Code/scratch/test/.lake/packages/Cli/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/batteries/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/Qq/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/aesop/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/proofwidgets/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/importGraph/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/LeanSearchClient/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/plausible/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/packages/mathlib/.lake/build/lib/lean:/home/ineol/Code/scratch/test/.lake/build/lib/lean /home/ineol/.elan/toolchains/leanprover--lean4---nightly-2025-07-17/bin/lean --tstack=400000 /home/ineol/Code/scratch/test/SSA.lean -o /home/ineol/Code/scratch/test/.lake/build/lib/lean/SSA.olean -i /home/ineol/Code/scratch/test/.lake/build/lib/lean/SSA.ilean -c /home/ineol/Code/scratch/test/.lake/build/ir/SSA.c --setup /home/ineol/Code/scratch/test/.lake/build/ir/SSA.setup.json --json
error: SSA.lean:1:0: error loading library, libLake_shared.so: cannot open shared object file: No such file or directory
error: Lean exited with code 1
Some required builds logged failures:
Versions
Lean (version 4.23.0-nightly-2025-07-17, x86_64-unknown-linux-gnu, commit 65abbd90bf076447c83c50e7873f01d083216ad4, Release)
Additional Information
Here are the files I used to hit the error:
lakefile.toml
name = "SSA"
precompileModules = true
defaultTargets = ["SSA"]
moreLeanArgs = ["--tstack=400000"]
[[require]]
name = "mathlib"
git = "https://github.com/ineol/mathlib4"
rev = "push-txqlwmpvtuto"
[[lean_lib]]
name = "SSA"
SSA.lean
import Mathlib
def main (args : List String) : IO UInt32 :=
pure 0
Note that I used this fork of mathlib to work around another bug by not compiling a module.
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
In trying to compile a project that depends on Mathlib and that uses
precompileModules, I get a build error on Linux (and not on Macos) because lean tries to loadlibLake_shared.sowhich is not available.Steps to Reproduce
precompileModuleslake buildExpected behavior:
lean compiles the library to a shared object.
Actual behavior:
Lean outputs the following error:
Versions
Additional Information
Here are the files I used to hit the error:
lakefile.tomlSSA.leanNote that I used this fork of mathlib to work around another bug by not compiling a module.