Zulip Chat Archive

Stream: lean4

Topic: Building Lean program from source


Locria Cyber (Feb 23 2023 at 14:35):

I bodged together something to build a lean program using Zig and lean's source repo.
lean need to be installed on $PATH.
Nim is used to compile all referenced lean files to C.

https://git.envs.net/iacore/lean-from-source

Locria Cyber (Feb 23 2023 at 14:36):

Lesson: if the installation ship with src/runtime and src/Init*, it can build any Lean program from source.

Locria Cyber (Feb 23 2023 at 14:37):

Anyone interested in making this a reality?

Locria Cyber (Feb 23 2023 at 14:37):

I hope Lake will use this for cross-compiling.

Locria Cyber (Feb 23 2023 at 14:39):

Is it possible to compile .ilean + .olean to C file? If that's the case, we don't need to ship src/Init/**.lean

Andrés Goens (Feb 23 2023 at 15:26):

@Locria Cyber could you explain the motivation for that? I'm curious but I don't really understand it

Mario Carneiro (Feb 23 2023 at 15:27):

Locria Cyber said:

Is it possible to compile .ilean + .olean to C file? If that's the case, we don't need to ship src/Init/**.lean

The lean files are important for enabling go-to-definition on declarations in those files

Locria Cyber (Feb 24 2023 at 03:29):

The motivation is to use Zig to cross-compile Lean code to many platforms.

Locria Cyber (Feb 24 2023 at 03:30):

One problem is still that src/runtime depends on too much POSIX stuff.

Locria Cyber (Feb 24 2023 at 03:30):

Even if I don't use mutex&threads, I can't compile the runtime to wasm32-wasi.


Last updated: Dec 20 2023 at 11:08 UTC