railwaycat / homebrew-emacsmacport

Emacs mac port formulae for the Homebrew package manager
BSD 2-Clause "Simplified" License
1.68k stars 125 forks source link

native-comp support #274

Open railwaycat opened 2 years ago

railwaycat commented 2 years ago

The "work" branch of upstream is aligned with 28 pretest since the recent commit, the latest alignment is to 28.0.91. Which means the native-comp feature finally comes to emacs mac port.

I will use this issue to track the work to support homebrew formula to build with native-comp.

railwaycat commented 2 years ago

There will not native-comp cask version for now because I haven't find a way (and not sure if I can find a good way) to ship a cask build with native-comp enabled and with gcc/libgccjit.

pkryger commented 2 years ago

I played today a bit with native-compilation but I haven’t found a solution. FWIW:

Apologies if that’s not really helpful, but I’d love to see this port with native-compilation. And would like to learn something in the process.

railwaycat commented 2 years ago

I borrowed part of the config code from emacs-plus and fit it into this formula. With change 09504b4, this formula is able to build with option --with-native-comp successfully on both Intel Mac and Apple Silicon Mac.

open issues:

  1. option --with-native-comp only works with --HEAD. We have to wait until the upstream 28 based release.
  2. A symbolic link need to be added by hand, from $(brew --prefix)/opt/emacs-mac/lib/emacs/28.0.91/native-lisp to your Emacs.app/Contents/native-lisp. For example mine:
    > ls -l /Applications/Emacs.app/Contents
    total 48
    -rw-r--r--  1 xin  admin  17925 Jan 12 15:36 Info.plist
    drwxr-xr-x  5 xin  admin    160 Jan 12 15:36 MacOS
    -rw-r--r--  1 xin  admin      8 Jan 12 15:36 PkgInfo
    drwxr-xr-x  5 xin  admin    160 Jan 12 15:36 Resources
    lrwxr-xr-x  1 xin  admin     57 Jan 12 15:36 native-lisp -> /opt/homebrew/opt/emacs-mac/lib/emacs/28.0.91/native-lisp

    I suppose this is a bug on collecting paths to find *.eln files. I'm not able to find a workaround to automatically create this link.

A small proof of success:) :

Screen Shot 2022-01-12 at 15 57 43
pkryger commented 2 years ago

2. A symbolic link need to be added by hand, from $(brew --prefix)/opt/emacs-mac/lib/emacs/28.0.91/native-lisp to your Emacs.app/Contents/native-lisp

I'm not entirely sure why it has to be done by hand. Is it because only after install finishes we have all the files In right places? If so, how about:

  def post_install
    if build.head? and build.with? "native-comp"
      ln_sf "#{Dir[opt_prefix/"lib/emacs/*"].first}/native-lisp", "#{opt_prefix}/Emacs.app/Contents/native-lisp"
    end
  end

If not maybe the if can be right after "system "make", "install" in install?

Jonghyun-Yun commented 2 years ago

Installation failed on OS X 10.15 with brew install emacs-mac --HEAD --with-native-comp --with-rsvg --with-starter --with-mac-metal. Any helps will be appreciated!

Last 15 lines from /Users/yunj/Library/Logs/Homebrew/emacs-mac/03.make:
  CC       image.o
  CC       xgselect.o
  CC       json.o
  CC       macappkit.o
  CC       macfont.o
  CC       terminfo.o
  CC       lastfile.o
macappkit.m:5873:62: error: property 'unsignedIntValue' not found on object of type 'id _Nullable'
     view.window.screen.deviceDescription[@"NSScreenNumber"].unsignedIntValue);
                                                             ^
1 error generated.
make[1]: *** [macappkit.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [src] Error 2
make: *** Waiting for unfinished jobs....
pkryger commented 2 years ago

Installation failed on OS X 10.15 with brew install emacs-mac --HEAD --with-native-comp --with-rsvg --with-starter --with-mac-metal. Any helps will be appreciated!

Last 15 lines from /Users/yunj/Library/Logs/Homebrew/emacs-mac/03.make:
[...]
macappkit.m:5873:62: error: property 'unsignedIntValue' not found on object of type 'id _Nullable'
     view.window.screen.deviceDescription[@"NSScreenNumber"].unsignedIntValue);
[...]

It seems that this has been changed fairly recently.

FWIW, I compiled successfully with this change in on macOS 11.6.2 using most recent CommandLineTools. If you already have them, perhaps reverting that commit (or just that one hunk) can help?

Jonghyun-Yun commented 2 years ago

Installation failed on OS X 10.15 with brew install emacs-mac --HEAD --with-native-comp --with-rsvg --with-starter --with-mac-metal. Any helps will be appreciated!

Last 15 lines from /Users/yunj/Library/Logs/Homebrew/emacs-mac/03.make:
[...]
macappkit.m:5873:62: error: property 'unsignedIntValue' not found on object of type 'id _Nullable'
     view.window.screen.deviceDescription[@"NSScreenNumber"].unsignedIntValue);
[...]

It seems that this has been changed fairly recently.

FWIW, I compiled successfully with this change in on macOS 11.6.2 using most recent CommandLineTools. If you already have them, perhaps reverting that commit (or just that one hunk) can help?

Thanks for the info.

George9000 commented 2 years ago

Experienced same error as @Jonghyun-Yun on M1, macOS 12.1

quangIO commented 2 years ago

There will not native-comp cask version for now because I haven't find a way (and not sure if I can find a good way) to ship a cask build with native-comp enabled and with gcc/libgccjit.

jimeh/emacs-builds is self-contained, but I think you need to ship a fixed libgccjit version with the Cask.

pkryger commented 2 years ago

@George9000 @Jonghyun-Yun it seems that Mitsuharu has pushed a fix that may alleviate the issue you've stumbled upon.

Jonghyun-Yun commented 2 years ago

@pkryger Thanks for the update. With the fix, the installation went well without errors.

George9000 commented 2 years ago

Build succeeded. However, using doom, initially doom install kept giving error of emacs not found on PATH. /opt/homebrew/Cellar/emacs-mac/HEAD-263c430/bin had two emacs files. In order for doom install to work, needed to ln -s /opt/homebrew/Cellar/emacs-mac/HEAD-263c430/bin/emacs-28.0.91 /opt/homebrew/bin/emacs After doom install, which got stuck on the last two files during native comp (vterm and with-editor) and needed killing, did a doom sync. Success. However, when launching Emacs.app, nothing happens. From the command line, launching emacs-28.0.91 launches the GUI but this is unable to take text input -- all text goes into the terminal command line. Very strange. Ultimately, gave up -- just not worth the squeeze!

Jonghyun-Yun commented 2 years ago

Build succeeded. However, using doom, initially doom install kept giving error of emacs not found on PATH. /opt/homebrew/Cellar/emacs-mac/HEAD-263c430/bin had two emacs files. In order for doom install to work, needed to ln -s /opt/homebrew/Cellar/emacs-mac/HEAD-263c430/bin/emacs-28.0.91 /opt/homebrew/bin/emacs After doom install, which got stuck on the last two files during native comp (vterm and with-editor) and needed killing, did a doom sync. Success. However, when launching Emacs.app, nothing happens. From the command line, launching emacs-28.0.91 launches the GUI but this is unable to take text input -- all text goes into the terminal command line. Very strange. Ultimately, gave up -- just not worth the squeeze!

I had the same issue and https://github.com/hlissner/doom-emacs/issues/5592 was helpful to resolve it.

diocletiann commented 2 years ago

Does --native-full-aot make a difference and if so would it be possible to add it?

tianrui-wei commented 2 years ago

I borrowed part of the config code from emacs-plus and fit it into this formula. With change 09504b4, this formula is able to build with option --with-native-comp successfully on both Intel Mac and Apple Silicon Mac.

open issues:

  1. option --with-native-comp only works with --HEAD. We have to wait until the upstream 28 based release.
  2. A symbolic link need to be added by hand, from $(brew --prefix)/opt/emacs-mac/lib/emacs/28.0.91/native-lisp to your Emacs.app/Contents/native-lisp. For example mine:
> ls -l /Applications/Emacs.app/Contents
total 48
-rw-r--r--  1 xin  admin  17925 Jan 12 15:36 Info.plist
drwxr-xr-x  5 xin  admin    160 Jan 12 15:36 MacOS
-rw-r--r--  1 xin  admin      8 Jan 12 15:36 PkgInfo
drwxr-xr-x  5 xin  admin    160 Jan 12 15:36 Resources
lrwxr-xr-x  1 xin  admin     57 Jan 12 15:36 native-lisp -> /opt/homebrew/opt/emacs-mac/lib/emacs/28.0.91/native-lisp

I suppose this is a bug on collecting paths to find *.eln files. I'm not able to find a workaround to automatically create this link.

A small proof of success:) : Screen Shot 2022-01-12 at 15 57 43

I'm not sure about why my symbolic link is different from yours, but mine is at /usr/local/Cellar/emacs-mac/HEAD-299a04b/lib/emacs/28.0.91

railwaycat commented 2 years ago

@tianrui-wei Interesting, is it still works? I haven't add the patch to create symbolic link into formula (thanks @pkryger it works perfect, I will add it soon) so the symbolic link should be made by yourself.

tianrui-wei commented 2 years ago

@railwaycat In my particular case, linking against the aforementioned path works, but otherwise does not.

pkryger commented 2 years ago

@tianrui-wei would you mind checking if the following symlink works for you?

native-lisp -> /usr/local/opt/emacs-mac/lib/emacs/28.0.91/native-lisp

It seems that @railwaycat is on M1, hence the $(brew --prefix) is pointing to /usr/homebrew, while the Intel one is usually /usr/local.

tianrui-wei commented 2 years ago

@pkryger No the symlink does not work for me.

xukai92 commented 2 years ago

I used brew install emacs-mac --HEAD --with-native-comp followed by doom build and doom sync (I'm using Doom Emacs) to succesffuly install Emacs 28.

One issue has to deal with manually was that Doom Emacs can be stuck at building some of the libraries, which I manually checked using ps and just copied-pasted the command that is stuck to run it manually, after which I kill the process to let doom build finish its process.

co-dan commented 2 years ago

@tianrui-wei would you mind checking if the following symlink works for you?

native-lisp -> /usr/local/opt/emacs-mac/lib/emacs/28.0.91/native-lisp

It seems that @railwaycat is on M1, hence the $(brew --prefix) is pointing to /usr/homebrew, while the Intel one is usually /usr/local.

Just tried installing emacs-mac (HEAD) with the native compilation on, running on M1. I can confirm that I had to add a symlink for native-lisp, and in my case it looked something like this:

native-list -> /opt/homebrew/opt/emacs-mac/lib/emacs/28.0.91/native-lisp

as my brew --prefix is /opt/homebrew.

co-dan commented 2 years ago

Nevermind, I am getting a lot of errors whenever I lazy-load elisp code:

Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /opt/homebrew/Cellar/emacs-mac/HEAD-299a04b/share/emacs/28.0.91/lisp/international/latexenc.el.gz: Error: Internal native compiler error failed to compile Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /opt/homebrew/Cellar/emacs-mac/HEAD-299a04b/share/emacs/28.0.91/lisp/emacs-lisp/crm.el.gz: Error: Internal native compiler error failed to compile Disable showing Disable logging
...

EDIT: I've sent this out too hastily. After some testing I figured out that this issue only arise when you launch Emacs from the Finder/dock, whereas everything works nicely if you launch emacs from the terminal. So it seems to me that it is some issue with the environment variables.

neoheartbeats commented 2 years ago

I notice that --HEAD has already been released to emacs-28.0.92. Using the old symbolic link $(brew --prefix)/opt/emacs-mac/lib/emacs/28.0.91/native-lisp would make app failed to open. Now we should use $(brew --prefix)/opt/emacs-mac/lib/emacs/28.0.92/native-lisp instead. Hope this instruction could be modified to avoid unpredictable mistakes.

I borrowed part of the config code from emacs-plus and fit it into this formula. With change 09504b4, this formula is able to build with option --with-native-comp successfully on both Intel Mac and Apple Silicon Mac.

open issues:

  1. option --with-native-comp only works with --HEAD. We have to wait until the upstream 28 based release.
  2. A symbolic link need to be added by hand, from $(brew --prefix)/opt/emacs-mac/lib/emacs/28.0.91/native-lisp to your Emacs.app/Contents/native-lisp. For example mine:
> ls -l /Applications/Emacs.app/Contents
total 48
-rw-r--r--  1 xin  admin  17925 Jan 12 15:36 Info.plist
drwxr-xr-x  5 xin  admin    160 Jan 12 15:36 MacOS
-rw-r--r--  1 xin  admin      8 Jan 12 15:36 PkgInfo
drwxr-xr-x  5 xin  admin    160 Jan 12 15:36 Resources
lrwxr-xr-x  1 xin  admin     57 Jan 12 15:36 native-lisp -> /opt/homebrew/opt/emacs-mac/lib/emacs/28.0.91/native-lisp

I suppose this is a bug on collecting paths to find *.eln files. I'm not able to find a workaround to automatically create this link.

A small proof of success:) : Screen Shot 2022-01-12 at 15 57 43

amake commented 2 years ago

Just FYI, the MacPorts equivalent of this package (emacs-mac-app-devel) is up to date with 28.0.92, supports native-comp, and installs without need for any manual symlinks. https://github.com/macports/macports-ports/blob/131fc3c868c828d5619abc5d70e76e35341e5162/aqua/emacs-mac-app/Portfile#L83

George9000 commented 2 years ago

@amake Thanks. Successfully installed port emacs-mac-app-devel (default native-comp during build) without trouble. Also, the tip from @xukai92 was helpful in installing Doom Emacs. doom install hangs with native compilation on two scripts. As mentioned above:

open a separate terminal from doom install:

% ps                                                                                                                                                                                                     13:41
  PID TTY           TIME CMD
58606 ttys000    0:00.20 -zsh
60061 ttys000    0:00.00 sh /Users/foo/.emacs.d/bin/doom install
60063 ttys000    0:19.48 emacs --no-site-file --script /Users/foo/.emacs.d/bin/doom -- install
73637 ttys001    0:01.43 /Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-evil-collection-vterm-XvMk43.el
72684 ttys006    0:00.59 /Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-with-editor-JeJtry.el

then copying the relevant processes above:

/Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-evil-collection-vterm-XvMk43.el
/Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-with-editor-JeJtry.el

then:
kill -9 73637
kill -9 72684

which allows doom install in the other terminal to finish.

The error occurs because the vterm script needs user input (y/n) during execution.

xukai92 commented 2 years ago

Deleted as I just realised I was repeating myself for https://github.com/railwaycat/homebrew-emacsmacport/issues/274#issuecomment-1047217248

ywwry66 commented 2 years ago

For the cask, I just tried the Emacs official Windows binary, which is built with native-comp support but libgccjit not included. If I install mingw-w64-x86_64-libgccjit with MSYS2 and put that under Windows PATH, native-comp will work automatically.

I think we can do something similar here. Just build emacs-mac with native-comp support without the library bundled into the app. Maybe add a line to the cask code like depends_on formula: "libgccjit". But homebrew cask does not provide :optional or :recommended to fine tune dependencies, so I don't know what is the best practice here.

Edit: well apparently it is a bad idea to mess with dependency here. Just tell the user to brew install libgccjit under caveats should be enough.

railwaycat commented 2 years ago

I tried to build the bundle as you described @ywwry66. It is able to run without libgccjit/gcc but complains for missing libgccjit/gcc libraries in warning buffer. For example libgccjit.so: error: error invoking gcc driver. Those warnings keep growing for every compile error.

Then install gcc and libgccjit from brew and explicit set LIBRARY_PATH in early-init.el can make the bundle works good without any warning. But this is not something good to be shipped to user since I cannot suppress the warnings by default or require a dependency from cask.

I could upload the bundle for people to try as @PatrickNorton suggested in #287, but I don't feel that benefits as other cask builds, since it still requires you to install (and compile in the worse case) something from homebrew formulas.

I'm going to stop here for native-comp cask build for now and will shipping 28.1-mac-9.0 cask bundles without native-comp this weekend, it is not super fast but stable and works. Sorry for the delay.

After that I will turn to find if there is a way to add bottles to a tapped formula:)

jdtsmith commented 2 years ago

FYI, with emacs-28.1-mac-9.0 and brew install emacs-mac --with-emacs-sexy-icon --with-native-comp on MacOS 12.3.1, I still needed to make a symlink "by hand", in Emacs.app/Contents:

 ln -s /usr/local/Cellar/emacs-mac/emacs-28.1-mac-9.0/lib/emacs/28.1/native-lisp .

After that it starts compiling away, filling my ~/.emacs.d/eln-cache/28.1-3cd3e628/ folder full of 51MB of pure native code. 👍

lts33 commented 2 years ago

FYI, with emacs-28.1-mac-9.0 and brew install emacs-mac --with-emacs-sexy-icon --with-native-comp on MacOS 12.3.1, I still needed to make a symlink "by hand", in Emacs.app/Contents:

 ln -s /usr/local/Cellar/emacs-mac/emacs-28.1-mac-9.0/lib/emacs/28.1/native-lisp .

After that it starts compiling away, filling my ~/.emacs.d/eln-cache/28.1-3cd3e628/ folder full of 51MB of pure native code. 👍

I installed emacs-28.1-mac-9.0 with --with-native-comp successfully without adding ln

jdelStrother commented 2 years ago

I installed emacs-28.1-mac-9.0 with --with-native-comp successfully without adding ln

Was that on intel or Apple Silicon? IIRC my M1 Mini needed ln but not my ancient MacBook

lts33 commented 2 years ago

I installed emacs-28.1-mac-9.0 with --with-native-comp successfully without adding ln

Was that on intel or Apple Silicon? IIRC my M1 Mini needed ln but not my ancient MacBook

On Apple Silicon M1 Max

railwaycat commented 2 years ago

with the latest formula and PR from @pkryger, the extra ln step no longer needed.

jdtsmith commented 2 years ago

Sadly it still fails for me (just rebuilt):

brew  postinstall -d railwaycat/emacsmacport/emacs-mac 
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/railwaycat/homebrew-emacsmacport/Formula/emacs-mac.rb
==> Postinstalling emacs-mac
Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall railwaycat/emacsmacport/emacs-mac
==> An exception occurred within a child process:
  Errno::ENOENT: No such file or directory @ rb_file_s_symlink - (/native-lisp, /usr/local/opt/emacs-mac/Emacs.app/Contents/native-lisp)

/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/fileutils.rb:363:in `symlink'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/fileutils.rb:363:in `block in ln_s'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/fileutils.rb:1574:in `fu_each_src_dest0'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/fileutils.rb:361:in `ln_s'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/fileutils.rb:380:in `ln_sf'
/usr/local/Homebrew/Library/Taps/railwaycat/homebrew-emacsmacport/Formula/emacs-mac.rb:165:in `post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1131:in `block (2 levels) in run_post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:948:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1130:in `block in run_post_install'
/usr/local/Homebrew/Library/Homebrew/utils.rb:595:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1119:in `run_post_install'
/usr/local/Homebrew/Library/Homebrew/postinstall.rb:22:in `<main>'

My link step above (ln -s /usr/local/Cellar/emacs-mac/emacs-28.1-mac-9.0/lib/emacs/28.1/native-lisp .) still works though. Note the difference in location.

Another small issue: a recent libgccjit update changed the packaged library from .so to .dylib, which the build scripts and/or linker cannot find. This was fixed upstream, but not yet in Yamamoto's port; I've emailed him. A temporary fix is just (before building):

/usr/local/opt/libgccjit/lib/gcc/11
% ln -s libgccjit.0.dylib libgccjit.so.0
egnha commented 2 years ago

Another small issue: a recent libgccjit update changed the packaged library from .so to .dylib, which the build scripts and/or linker cannot find. This was fixed upstream, but not yet in Yamamoto's port …

The upstream commit was cherrypicked into Yamamoto's work branch.

j-minster commented 2 years ago

Hi all. I just finished compiling emacs 28 with native-comp on my M1 Pro MBP. Running doom emacs now without a hitch so far. I wanted to switch from emacs-plus since I was having issues with childframes on that build. Testing now. Seems good so far.

maikol-solis commented 2 years ago

Hi all. I just finished compiling emacs 28 with native-comp on my M1 Pro MBP. Running doom emacs now without a hitch so far. I wanted to switch from emacs-plus since I was having issues with childframes on that build. Testing now. Seems good so far.

Could you please post wow did you compile it? I normally use the Cask version and I am wondering how to active the native-comp for this build. Thanks.

j-minster commented 2 years ago

I didn't do anything beyond 'tapping' this repo then calling 'brew install emacs-mac --with-native-comp'. It took about ten (?) minutes to compile and didn't show any errors during that time.

Update on stability: I've used it for roughly 10 of the last 24 hours (sad, I know), and it has frozen once, requiring a restart. This seems to happen on waking my computer from sleep. Childframes are more stable though (compared to emacs-plus). Emacs-plus would often mangle the childframe process, resulting in a loss of 'company'. So far, emacs-mac does seem more prone to overall freezing and crashing in my case.

maikol-solis commented 2 years ago

Thanks for the explanation. I'll try it.

j-minster commented 2 years ago

Update 2 after about 20h of usage:

Has anyone experienced this in other builds? Is there any tweaks I can do to make native fullscreen more stable?

jdtsmith commented 2 years ago

@j-minster Note that any actual bugs like this need to be reported upstream to Yamamoto-san. The way to report this bug is to find a reliable way to trigger it, starting with /Applications/Emacs.app/Contents/MacOS/Emacs -Q, write out some precise minimal reproduction steps, and M-x report-emacs-bug.

I had a long-standing (several year) bug where emacs-mac would abruptly change space on certain commands like magit calls; turned out to be a bug with the "tab spinner". I guess if you are experiencing this full-frame wake from sleep issue, others are too, so it would be wonderful to dig a bit deeper and benefit us all!

shivahnshankar commented 2 years ago

So whats the current recommendation for using emacs-mac with native compilation enabled? Is it usable as is with soime tweaks or its recommended not to use at all?

George9000 commented 2 years ago

@shivahnshankar I've been using emacs native compilation version on an M1 Mac without trouble. I'm using doom emacs configuration. I install with MacPorts (see replies above). The latest MacPorts version installs as below. If you have an existing directory .doom.d, rename it (.doom.d.old) so that when you install doom emacs, it's a 'fresh' install. Then copy over relevant parts or just do an ediff between the old and new files in .doom.d.

sudo port install emacs-mac-app-devel +nativecomp

Additional instructions for doom emacs install on native compilation

Error below (getting stuck with native compilation of vterm) may be avoided by moving .doom.d in your home directory to another name (say, .doom.d.old). Then build doom from the ground up.

After installing, launch and go to the init file in .doom.d directory Uncomment vterm. (make sure you have already installed libvterm via brew or macports) Quit and doom sync. The relaunch and start vterm. Allow it to install. Quit Then one by one, ediff the old init, packages, and config files with the new one. After each update, quit, and doom sync.

When all is done, copy over any old snippets directory from .doom.d.old into the new .doom.d directory.

Error: Install gets stuck natively compiling two processes.

Example of a fix.

  1. open a separate terminal from doom install:
% ps
                                                                                                                                                                                                    13:41
  PID TTY           TIME CMD
58606 ttys000    0:00.20 -zsh
60061 ttys000    0:00.00 sh /Users/foo/.emacs.d/bin/doom install
60063 ttys000    0:19.48 emacs --no-site-file --script /Users/foo/.emacs.d/bin/doom -- install
73637 ttys001    0:01.43 /Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-evil-collection-vterm-XvMk43.el
72684 ttys006    0:00.59 /Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-with-editor-JeJtry.el
  1. copy the relevant commands for the EmacsMac processes above and run the commands in a separate terminal:
/Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-evil-collection-vterm-XvMk43.el
/Applications/MacPorts/EmacsMac.app/Contents/MacOS/emacs --batch -l /var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/emacs-async-comp-with-editor-JeJtry.el
  1. afterwards, kill the stuck process IDs above
    kill -9 73637
    kill -9 72684

    Reference

Possible additional error

message: with-editor.elc failed to provide feature ‘with-editor’

fix: rm -rf ~/.emacs.d/.local/straight/build*/with-editor && doom sync

See this

shivahnshankar commented 2 years ago

Thanks! I will try your suggestion...

matteha commented 2 years ago

Update 2 after about 20h of usage:

  • I've had the childframe process stop working once. I created a new frame and closed the old one. They work in the new frame.
  • Emacs has frozen several times, at a rate significantly more often than emacs-plus did during my 6mo of usage.
  • I determined that it was happening on waking my computer after leaving it for a while. This would happen while both using and not using an external monitor.
  • The external monitor guaranteed that emacs would freeze and require killing. I would wake the system up and need to restart emacs each time.
  • I have found success in not using emacs in native fullscreen
  • Keeping it expanded across a desktop, I have not had it crash or freeze once in roughly 5 hours, which is a win.
  • I'm not happy with this though, as significant screen real estate is lost and the title-bar & mac menu bar is distracting.

Has anyone experienced this in other builds? Is there any tweaks I can do to make native fullscreen more stable?

I am experiencing the same thing as well, with emacs freezing upon having been in fullscreen mode. Have you found a fix by any chance?

George9000 commented 2 years ago

@matteha I'm using emacs 28.1, native comp, full-screen with MacPorts as detailed above on an M1 MacBook Pro. In addition, I may have several 'workspaces' open in doom. I have had no problems with freezes. Don't know if this is due to a difference in build between brew and MacPorts.

jasonm23 commented 2 years ago

Using native comp from formula build.

brew install emacs-mac --with-dbus\
 --with-starter\
 --with-no-title-bars\
 --with-emacs-icons-project-EmacsIcon7\
 --with-native-comp\
 --with-mac-metal\
 --with-xwidgets

No issues.

jdtsmith commented 2 years ago

What's the consensus on --with-mac-metal for M1/2? A year ago it didn't seem to provide much value.

sfraize commented 2 years ago

I just tried a 28.2 build both ways, and couldn't see a difference, though it was only a quick test -- if someone has seen effects here let us know.

manuraj17 commented 2 years ago

I just installed with these flags

brew install emacs-mac --with-dbus --with-starter --with-natural-title-bar --with-native-comp --with-mac-metal --with-xwidgets --with-imagemagick

Intel machine.

Currently got this

❯ emacs --version
GNU Emacs 28.2
Copyright (C) 2022 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Using doom (duh) (doom-dah, nvm); Will update in couple of days how the perfomance is, is there anything that I can do to help this thread?