Straight bootstrap trigger native compiling straight.el on every launch of Emacs.
I've traced it down to this line
Compiling /Users/.../.config/emacs/straight/repos/straight.el/straight.el...
Compilation finished.
Test Case
(straight-bug-report)
2021-03-22 15:34:21darwinprerelease (grafted, HEAD -> develop, origin/develop) 770bbc6 2021-03-21GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.3.0, NS appkit-2022.30 Version 11.2.1 (Build 20D74))
of 2021-03-21Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done
Test run with version: prerelease (HEAD -> develop, origin/develop) 770bbc6 2021-03-21
Maybe it's related to https://github.com/raxod502/straight.el/issues/643
Very possible, logic here changed. See: https://github.com/raxod502/straight.el/issues/697#issuecomment-804151436
Loading an elc explicitly will no longer load the eln implicitly
Didn't realized that loading an elc explicitly used to load the eln implicitly...
But why loading elc triggers native compiling process?
Just tried a random elc file with command load-file which also triggers.
The idea of the native compilation branch is that all el/elc files are compiled to eln asynchronously. Once they're compiled, they're loaded and the next time Emacs starts, the native compiled version will be available. The elc is a stop-gap until the eln is in place.
Oh, that's the reason there are no elc output files under straight build folder.
Should I close this issue? Or will you do it?
Well, it's still odd that it's doing a native compilation every time. It should probably not do that, so once the other stuff is fixed, it'd be good to ensure this doesn't happen...
If I'm not mistaken, I think it's doing a native compilation each time I use a library too. For example, I restart emacs and I wait for everything to be recompiled yet again. Now I open a project and try to use Magit (C-x g) and I get another spate of fan whirling... Is there a workaround, because this might get old.
You might want to see if you can narrow a repro and raise it with emacs-devel. It could be a regression. I'm on a build from 3-10 and do not have this issue. I don't know the commit sha, unfortunately.
I've had to snap revert emacs (revert to the previous native-comp snapshot on Ubuntu) to get work done. I'll check if there's a ticket upstream already.
@eamonnsullivan Thanks for the link to the upstream bug report.
There's a reply from Eli in there stating he has the same issue, so I doubt the problem lies entirely with straight.el.
I'll keep an eye on that thread and see how it develops.
Upstream commit 4a3b43f55cfa96f5dd42e360eb4577750e97dbf0 solved this problem for me.
@pRot0ta1p Thank you for the information.
Can anyone else confirm if the above commit resolves this issue for them?
Using that one or later the issue does not repro. I skipped the bad commit though so I never saw the bug.
Just tested. Still happening.
Just to clarify that it only try to native compiling
.config/emacs/straight/repos/straight.el/straight.el...
on every launch.
This issue I reported here is kind of different from this one
from upstream(http://emacs.1067599.n8.nabble.com/bug-47337-28-0-50-feature-native-comp-Compilation-over-and-over-again-td532024.html). It claims that
Emacs re-compiles all files over and over again.
I never had this issue though. Mine is that
Emacs re-compiles .config/emacs/straight/repos/straight.el/straight.el
Emacs re-compiles
.config/emacs/straight/repos/straight.el/straight.el
Sorry... my mistake, I over looked this straight.el recompile behaviour, those are indeed different bugs :sweat: .
With latest native-comp branch commit 79b8b6ca45ad707d86244882430e275efd95cdb9, this bug still exists.
I can confirm that I see straight.el recompiled every time as well. I hadn't noticed that before.
The problem appears to be that explicitly loading an elc triggers a native compilation regardless. I'll report this upstream
613caa9527 upstream in the native-comp branch should fix this without #729 (though #729 is still superior because it will allow the eln to be loaded for straight.el). I think this issue can be closed since it is fixed upstream.
Most helpful comment
613caa9527upstream in the native-comp branch should fix this without #729 (though #729 is still superior because it will allow the eln to be loaded forstraight.el). I think this issue can be closed since it is fixed upstream.