Zulip Chat Archive

Stream: general

Topic: lake build takes forever when updating mathlib


shortc1rcuit (Jul 13 2024 at 16:35):

I've been doing some work in the Compfiles project and I've found an annoyance whenever mathlib gets updated there. I have to rebuild the files using lake build, which causes my laptop to build over 4500 files. This takes over an hour and puts my laptop's CPU under a lot of strain. However, if I delete my .lake folder and then build, it builds a fraction of the files. Is there a way to build without deleting and redownloading everything?

Henrik Böving (Jul 13 2024 at 16:46):

You should be able to just run lake exe cache get to download mathlib's build cache

shortc1rcuit (Jul 13 2024 at 16:46):

I did make sure to do that. The same problem occurs.

Henrik Böving (Jul 13 2024 at 16:48):

That's unusual. Is your toolchain the same as the one from the mathlib commit you are using as well?

shortc1rcuit (Jul 13 2024 at 16:50):

I ran elan update and lake update.

Henrik Böving (Jul 13 2024 at 16:54):

That's not going to fix your toolchain to the one mathlib uses. Mathlib's master branch usually uses the latest stable version available (up to relese candidates), you can check their lean-toolchain file. Your lean-toolchain file must match that such that you can use mathlib's build cache.

shortc1rcuit (Jul 13 2024 at 16:56):

Ours are both leanprover/lean4:v4.10.0-rc2

Henrik Böving (Jul 13 2024 at 16:58):

Then it's not quite clear to me why the cache doesn't work I'm afraid

Henrik Böving (Jul 13 2024 at 16:58):

Maybe someone else who knows that part of the infra better can help.

Kim Morrison (Jul 13 2024 at 17:02):

@shortc1rcuit, could you provide a commit that someone could check out, at which lake exe cache get appears to work, but lake build still needs to recompile?

shortc1rcuit (Jul 13 2024 at 17:18):

Jumping to this commit (i.e. the one before this commit) seems to recreate the issue for me.

shortc1rcuit (Jul 13 2024 at 17:18):

Also it may be an issue with lake exe cache get

shortc1rcuit (Jul 13 2024 at 17:19):

What's the normal output for that command?

Rida Hamadani (Jul 13 2024 at 17:47):

When successful, it outputs a success message: Completed successfully!.

shortc1rcuit (Jul 13 2024 at 18:19):

Ok that all seems to work

shortc1rcuit (Jul 13 2024 at 20:41):

So if it's not getting the cache I'm not sure what is wrong

Michael Rothgang (Jul 14 2024 at 08:36):

Does running lake exe cache get! make your build fast? (To be clear: this is a band-aid fix, not a real solution. I'd rather use that than have to manually rebuild everything, though.)

shortc1rcuit (Jul 14 2024 at 15:03):

It does not seem to no

shortc1rcuit (Jul 14 2024 at 15:04):

Actually it does

shortc1rcuit (Jul 14 2024 at 15:10):

In fact everything seems to be working.

shortc1rcuit (Jul 14 2024 at 15:10):

Not sure what fixed that

shortc1rcuit (Jul 14 2024 at 15:11):

But now getting the cache normally doesn't mean the builds take forever.

shortc1rcuit (Jul 14 2024 at 15:11):

Yay?

shortc1rcuit (Jul 14 2024 at 15:11):

Sorry to anyone in the future who came here thinking this would contain the solution

Notification Bot (Jul 14 2024 at 18:59):

shortc1rcuit has marked this topic as resolved.

Notification Bot (Jul 14 2024 at 18:59):

shortc1rcuit has marked this topic as unresolved.

Johan Commelin (Jul 15 2024 at 05:50):

@shortc1rcuit Probably some file in the cache was corrupted (e.g. by an interrupted download) and lake exe cache get! forcefully redownloaded the file, thereby fixing the problem.


Last updated: May 02 2025 at 03:31 UTC