jimeh / build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
484 stars 50 forks source link

Is --with-native-comp mandatory now? #32

Closed SreenivasVRao closed 3 years ago

SreenivasVRao commented 3 years ago

https://twitter.com/Koral_001/status/1365392277678530561

GCCEmacs maintainer posted this a few weeks ago.

I saw that the plain ./build-emacs-for-macos --git-sha <SHA> --native-full-aot didn't actually build with the native-comp. But when I retrieved with --with-native-comp it worked automatically.

jimeh commented 3 years ago

Are you using the latest version of the build script? And what git SHA did you use?

I suspect it might be a bug with the native comp detection code, but I'd need the exact SHA to verify.

if neither --with-native-comp or --no-with-native-comp options are given, the script will attempt to detect if the native-comp is supported by the emacs sources it's building. It does this by capturing the output of ./configure --help and checking for the native comp option. I did recently need to update the auto-detection code due to changes in the native-comp branch. I did test the change, but I might have missed an edge case.

SreenivasVRao commented 3 years ago

This is the build I tried with. Emacs.app-[2021-03-02][1653536][macOS-10.15][x86_64].tbz

(if (and (fboundp 'native-comp-available-p)
       (native-comp-available-p))
  (message "Native compilation is available")
(message "Native complation is *not* available"))

"Native complation is not available"

It worked fine when I built Emacs.app-[2021-03-06][c60f2f4][macOS-10.15][x86_64].tbz with the --with-native-comp flag

jimeh commented 3 years ago

Ah, the issue there is that commit https://github.com/emacs-mirror/emacs/commit/165353674e5fe7109ba9cbf526de0333902b7851 looks to be from the master branch, not the feature/native-comp branch. The lisp/emacs-lisp/comp.el file does not exist for example.

Commit https://github.com/emacs-mirror/emacs/commit/c60f2f458a63a8ae4288652228f24e43fdc7bba7 is on the feature/native-comp branch though, so it should yield a native-comp capable build even without the --with-native-comp flag.

The build script should print information about native-comp very early on when it runs, something like this:

==> INFO: Detecting native-comp support: Supported
==> INFO: Compiling from source. This will take a while...
==> INFO: Compiling with native-comp enabled

That said, I do need to improve implementation and/or docs for the --git-sha option, as it's effectively just a override which I added to enable building historically known good builds listed on #6. Potentially I'll add a "--ref-name-override" option instead of the --git-sha option just to make it more obvious what's actually happening.

Personally I use this diff view between the master and feature/native-comp branches to see which new commits have appeared on the native-comp branch: https://github.com/emacs-mirror/emacs/compare/feature/native-comp

SreenivasVRao commented 3 years ago

Hm... I wasn't watching the logs closely.

I do see the commit show up on the feature branch: https://github.com/emacs-mirror/emacs/commits/feature/native-comp?after=5e4ec4d3c944f586892e08ea4fb7715e0f6ac365+174&branch=feature%2Fnative-comp if you Cmd-F for that commit.... Maybe I'm not reading the commit history right. Thanks anyhow :)

jimeh commented 3 years ago

Right, yeah just the list of commits for the branch can be misleading, as it includes all commits on the branch, regardless of if they originated in the branch in question or on another branch and was later merged in.

And the commit in question originated on the master branch, and wasn't merged into feature/native-comp till the 6th of March in this commit: https://github.com/emacs-mirror/emacs/commit/43b0df62cd5922df5495b3f4aee5b7beca14384f

If you look at the diff view I linked to earlier, there's only a single commit on the 2nd of March.

I'll close this issue now, but feel free to reply if you have any more questions :)