Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lake native libraries include main symbol #2436

Closed
Tracked by #7
SchrodingerZhu opened this issue Aug 20, 2023 · 3 comments · Fixed by #5143
Closed
Tracked by #7

Lake native libraries include main symbol #2436

SchrodingerZhu opened this issue Aug 20, 2023 · 3 comments · Fixed by #5143
Labels
bug Something isn't working Lake Lake related issue

Comments

@SchrodingerZhu
Copy link

see the issue at digama0/lean-sys#5.

lean_lib Lake

In lake, it seems that, when Main resides in the lib source directory, the main symbol will also live inside the lib. Is this by design?

@Kha
Copy link
Member

Kha commented Aug 21, 2023

No, this was not intended. @tydeu This is a bit of a problem, lean.mk identifies package files by folder, not import graph. So there is no easy way to exclude everything not reachable from Lake.lean from libLake.a. We can add this to the list of things that would be made easier by building the Lean libraries with Lake but for now we could simply move Lake/Main.o out of the archive manually after the fact.

@digama0
Copy link
Collaborator

digama0 commented Aug 21, 2023

I'm not sure it would be correct to leave out everything not reachable from Lake.lean from libLake.a either, because that file was optimized for import Lake to be usable in lakefiles, while libLake.a should also include functions for interacting with lake's data structures. I previously requested to @tydeu that they split lake into a library and an executable, but they declined, so just deleting Lake/Main.o seems like the lowest-maintenance approximation to this.

@tydeu
Copy link
Member

tydeu commented Aug 21, 2023

I'm not sure it would be correct to leave out everything not reachable from Lake.lean from libLake.a either, because that file was optimized for import Lake to be usable in lakefiles, while libLake.a should also include functions for interacting with lake's data structures.

The things missing from Lake.lean are Lake.CLI (except Lake.CLI.Actions) and Lake.Load. This could be solved with a separate Lake/LibMain.lean that imports these and is used as the build source for lean_lib Lake (if Lake is built with Lake).

@tydeu tydeu changed the title lean_lib includes main symbol lean_lib Lake includes main symbol Aug 21, 2023
@tydeu tydeu added Lake Lake related issue bug Something isn't working labels Aug 21, 2023
@tydeu tydeu changed the title lean_lib Lake includes main symbol Lake native libraries include main symbol Aug 21, 2023
@tydeu tydeu removed their assignment Oct 12, 2023
github-merge-queue bot pushed a commit that referenced this issue Sep 9, 2024
Fixes #2436 #5050

Next step: when libLake_shared is in stage 0, --load-dynlib it when
building stage 1 Lake
@Kha Kha closed this as completed in #5143 Sep 9, 2024
tobiasgrosser pushed a commit to opencompl/lean4 that referenced this issue Sep 16, 2024
Fixes leanprover#2436 leanprover#5050

Next step: when libLake_shared is in stage 0, --load-dynlib it when
building stage 1 Lake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Lake Lake related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants