Skip to content

Lake/Lean fails to build native libraries on Linux because it tries to load libLake_shared.so #9420

Description

@ineol

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

  1. Create a project which depends on mathlib and imports it
  2. enable native compilation with precompileModules
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LakeLake related issueP-mediumWe may work on this issue if we find the timebugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions