leanprover / leanprover/lean4

[question] How to write the 'require' line in lakefile.lean to use the pre-installed Lean library?

Open
#3,193 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Lake P-medium
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

I have the Std library installed as a package which provides these files.
They are the same files that 'lake build' left in the .lake/build folder when Std was built.

When some lake project has import Std, for example:

import Std

def main (args : List String) : IO Unit :=
  IO.println "Hello, world!"

lake build fails:

ld: error: undefined symbol: initialize_Std

This is because the require line is missing in lakefile.lean.

But how to write this require line?

This require line expects the checked out project with lakefile.lean:

require std from "/usr/local"

What would be the correct syntax for the require line that would pick up the pre-installed Lean library?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the lakefile.lean dependency declaration and the example containing import Std, then reproduce the failure with lake build. Determine the require syntax that uses the pre-installed Std files and leaves the example building without the initialize_Std linker error.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.