-
Notifications
You must be signed in to change notification settings - Fork 50
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
M1 support #47
Comments
This error actually looks like you're missing Xcode or the Xcode command line tools. Try this:
As for building Emacs on M1-based machines, it should in theory work fine as people have reported the emacs-plus homebrew formula working with native-comp and all. That said I've not seen any reports of successful builds with my build script here, and I don't have a M1 Mac myself yet. So I'd be curious to hear if you can get it working 🙂 |
Ah, I have the Xcode command line tools installed but didn't realize I need the full Xcode installation as well. Ill get it installed and get back to you. I've been using the emacs-plus formula so far, but I just wanted to try the official version for fun |
Sadly got the same error after installing full Xcode as well: build-emacs-for-macos on master [?] via v2.6.3 took 12s
❯ ./build-emacs-for-macos -j8 --native-comp --no-titlebar
==> INFO: Fetching info for git ref: master
==> INFO: emacs-mirror-emacs-1855e3d.tgz already exists locally, attempting to use.
==> INFO: emacs-mirror-emacs-1855e3d source tree exists, attempting to use.
==> CMD: ./autogen.sh
Checking whether you have the necessary tools...
(Read INSTALL.REPO for more details on building Emacs)
Checking for autoconf (need at least version 2.65) ... ok
Your system has the required tools.
Running 'autoreconf -fi -I m4' ...
You can now run './configure'.
==> INFO: Compiling from source. This will take a while...
==> INFO: Compiling with native-comp enabled
==> CMD: ./configure --with-ns --with-modules --enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp --with-xwidgets --with-native-compilation
checking for xcrun... xcrun
checking for make... yes
checking for GNU Make... make
checking build system type... aarch64-apple-darwin20.4.0
checking host system type... aarch64-apple-darwin20.4.0
checking whether the C compiler works... no
configure: error: in `/Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-1855e3d':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: Exit code: 77 |
Hmm, no full Xcode shouldn't be needed. My original suspicion was that it couldn't locate clang for some reason. After a bit more digging, I have a feeling the issue might be the Could you try commenting out the |
just started the build, looks like its working so far! |
looks like it builds fine but I get an error while opening: Process: Emacs [70494]
Path: /Users/USER/*/Emacs.app/Contents/MacOS/Emacs
Identifier: org.gnu.Emacs
Version: ???
Code Type: ARM-64 (Native)
Parent Process: ??? [1]
Responsible: Emacs [70494]
User ID: 501
Date/Time: 2021-05-30 12:32:20.016 -0400
OS Version: macOS 11.3.1 (20E241)
Report Version: 12
Anonymous UUID: 2F65C0AB-23F0-A096-AB97-66F55868F8F5
Sleep/Wake UUID: EDA3124E-5E50-4549-9647-C23E3E5CF125
Time Awake Since Boot: 660000 seconds
Time Since Wake: 260 seconds
System Integrity Protection: enabled
Crashed Thread: Unknown
Exception Type: EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes: 0x0000000000000032, 0x0000000104cd8000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace CODESIGNING, Code 0x2
kernel messages:
VM Regions Near 0x104cd8000:
--> mapped file 104cd8000-104f2c000 [ 2384K] r-x/r-x SM=COW Object_id=97d15133
mapped file 104f2c000-1052dc000 [ 3776K] rw-/rw- SM=COW Object_id=97d15133
Backtrace not available
Unknown thread crashed with ARM Thread State (64-bit):
x0: 0x0000000104cd8000 x1: 0x000000016b1279b8 x2: 0x000000016b127968 x3: 0x0000000105565f02
x4: 0x000000000000003d x5: 0x000000000000003d x6: 0x000000016b127710 x7: 0x00000000000005f0
x8: 0x000000016b127998 x9: 0x000000016b127978 x10: 0x000000010558aa78 x11: 0x0000000000000003
x12: 0x0000000000000003 x13: 0x00000000fffffffc x14: 0x0000000000000000 x15: 0x0000000000000000
x16: 0x000000010553a088 x17: 0x6ae100016b127968 x18: 0x0000000000000000 x19: 0x000000016b1279b8
x20: 0x0000000104cd8000 x21: 0x000000016b127968 x22: 0x0000000104cd8000 x23: 0x000000016b127b18
x24: 0x000000016b127b80 x25: 0x000000016b127a50 x26: 0x0000000000000000 x27: 0x0000000000000000
x28: 0x000000016b127af8 fp: 0x000000016b127950 lr: 0x710f80010553a050
sp: 0x000000016b1278d0 pc: 0x000000010553c474 cpsr: 0x80000000
far: 0x0000000104cd8000 esr: 0x92000007
Binary images description not available
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
Writable regions: Total=8976K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=8976K(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
STACK GUARD 56.0M 1
Stack 8176K 1
VM_ALLOCATE 1.0G 2
VM_ALLOCATE (reserved) 608K 2 reserved VM address space (unallocated)
mapped file 7600K 7
=========== ======= =======
TOTAL 1.1G 13
TOTAL, minus reserved VM space 1.1G 13
Model: MacBookPro17,1, BootROM 6723.101.4, proc 8:4:4 processors, 16 GB, SMC
Graphics: kHW_AppleM1Item, Apple M1, spdisplays_builtin
Memory Module: LPDDR4
AirPort: spairport_wireless_card_type_airport_extreme, wl0: Apr 2 2021 00:48:12 version 18.52.1.2.7.8.116 FWID 01-9f7b4413
Bluetooth: Version 8.0.4d18, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB 3.1 Bus
USB Device: USB 3.1 Bus
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc. |
That's interesting and weird, some googling reveals issues around Have you tried launching emacs with |
Hmm, if you're able to codesign the app yourself, could you try first signing all Simplest is to do something like |
To update on this, with #44 merged, there's a new tool which will correctly sign the Emacs.app bundle. It might help getting closer to the bottom of this issue.. To use the tool, you will need to install Go ( Then to print the help info for the
The only thing you should need to pass in is the |
@jimeh Do I need to have a signing identity created to use as input in the Thanks. |
@LambertGreen Yes, the sign command does require a signing identity on your machine, which required a paid for Apple Developer Account. This article's "Acquiring a Developer ID Certificate" section covers it, personally I did the Xcode method which then didn't require a CSR. As for M1 machines, from what I've understood, for Emacs builds to run they must be signed. macOS seems to have extra security requirements when running on M1 machines, to the point even code compiled on your own machine cannot run unless it's signed, unlike on Intel-based macs. |
I believe you don't actually need a paid developer account to self-sign code, only to distribute it to other people. I used a self-signed certificate to sign Emacs, and it seems to work well. Instructions for creating a self-signed certificate are here: https://support.apple.com/guide/keychain-access/create-self-signed-certificates-kyca8916/mac |
hey, trying to build on m1 as well, running into the following issue
any ideas? |
@dignifiedquire I believe this might actually be due to some directory structure changes within the I should have time to investigate what's going on properly within the next day or two. |
I have same issue on non M1, Intel mac:
I got the build passing after commenting line 969. |
As the nightly builds done via GitHub Actions still haven't encountered this issue, I was worried it might be difficult to reproduce. But the local build I fired off early this morning has the same issue, so I should be able to get a fix sorted tonight :) |
@dignifiedquire @ianic I've just pushed v0.6.24 with a fix for the rename issue. It now only performs the rename operation if the target name is different. This is still needed for macOS 10.15, as the nightly builds which uses 10.15 have not been having this issue. So it seems the directory structure for the Monterey Also @dignifiedquire, if you get it all working on your M1 machine, would you mind confirming so, and mentioning what you had to do if you had to do anything special? Cause if it's working, we can finally close this issue :) |
Unfortunately things are not quite working, not sure exactly what the issue is. I have built using
now when I extract the
when launching the app via mouse click nothing happens. This is all on current |
@dignifiedquire I suspect this is due to the app not being signed. Try launching Emacs from a terminal with if it is a signing issue, you should see On Intel-based macs, things built on the machine did not require code signatures, but it seems that's not the case on Apple Silicon macs. One thing I'd suggest you try is right/ctrl click on Emacs.app itself, and choose "Open". Potentially that might provide a dialog that lets you open it despite being unsigned. At least it's how you by-pass the signature check on Intel-based macs if the app was not built on your machine. |
I am not getting bad access errors, the exit code when launching with The only error in the system logs for emacs is this entry
|
I removed my |
I managed to get it working using https://github.com/d12frosted/homebrew-emacs-plus, not sure what the differences are, but it does work on my machine |
@dignifiedquire Thanks for your help, apologies it didn't work out. I believe I'm just gonna have to get my hands on an M1 machine myself to try and figure what's going on. |
I've built both 28 and 29 without any issues on M1 today. |
@licht1stein Oh, that's awesome new. I haven't gotten around to trying to access a M1 machine yet, but looks like Scaleway are offering M1 Mac Minis for €0.10/hour with a minimum of 24h period, so I'll probably give that a try over the weekend :) |
I literally had zero difficulties. It compiled on first try and loaded all my configs without any problems. There were a bunch of warnings on compilation, but who cares :) |
Here's the command I used to build Emacs 28.0.60: ./build-emacs-for-macos --no-frame-refocus --no-titlebar --git-sha 70c229b1fc4f2eb66b5a173cfc8473e4b7ce48f0 |
I successfully compiled Emacs from source on the M1 Macbook Air right now. Noting down the steps in the hopes it will help others. Initially, I had a linker failure The actual commands I executed were:
Once compilation was successful, I extracted the
|
Thanks @vedang! I was struggling with the same issue of the webp library not found, and most of your solution did work for me. The only thing that didn't work was that doing Anyway, thank you very much for sharing! |
@vedang's instructions here worked perfectly for me 2 1/2 weeks ago, but now I'm getting the dreaded error about
MacOS upgraded Xcode Command Line Tools for me, which I think introduced the problem. I uninstalled Xcode Command Line Tools and homebrew, and then reinstalled homebrew (which reinstalled Xcode Command Line Tools), to no avail. Same error. I noticed that there are different gcc versions between homebrew and Xcode CL tools.
So, gcc version I did try aliasing to homebrew gcc via |
Hi Steve. Seeing same issue. FYI gcc/libgccjit were rev'd up to 12.1 in homebrew just this past week which has caused some mayhem. When I did a brew upgrade (on M1 Air) it immediately broke two existing Emacs 29 executables (one from build-emacs-for-macos, the other emacs-plus@29) as it deleted the old libraries, and rebuilds were also broken. emacs-plus@29 just pushed a patch for it so that is building again (the directory structure in the Cellar is slightly different with 12.1). I don't know if there's a LIBRARY_PATH that'll work right now. (Btw originally I had to delete and re-install CommandLineTools as well.) |
@sfraize Thanks - I also just saw the emacs-plus issue and patches. Looks like they patched the emacs configure script: They have a similar patch for 28. It looks like they added a
It looks like without the |
@stevemolitor @sfraize A patch for the libgccjit 12.x homebrew formula was added in #75, which has been merged into master. This should resolve your libgccjit related issues. |
|
Hi, as libgccjit is now available for m1 MacBooks, it should be possible to compile emacs master for apple silicon. The emacs-plus@28 --native-comp works fine, but it was a bit buggy,
trying to build using the following command
./build-emacs-for-macos --git-sha 3f8b303ec087ba3d0bd524c7fc8c628ef15a3e4a master
results in this output:Perhaps a patch is needed?
The text was updated successfully, but these errors were encountered: