unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44774: 27.1; emacs build fails on M1 Mac
@ 2020-11-20 23:11 Nathan Hjelm via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; only message in thread
From: Nathan Hjelm via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-11-20 23:11 UTC (permalink / raw)
  To: 44774

[-- Attachment #1: Type: text/plain, Size: 4958 bytes --]

This bug report is being generated on a version of emacs built with the
below fix.

emacs 27.1 (and git master) fails to build on any ARM64 Mac. The error
is:

./temacs Killed: 9

This issue is caused by an invalid code signature. ld signs a binary by
default with an ad-hoc signature. This signature is invalidated by the
make-fingerprint program. To restore the binary it is necessary to
re-sign the binary. This can be done by running codesign -s - on the
binary. This will re-sign the binary with an ad-hoc signature. The
following patch does just this but only on ARM64 systems. Legacy Intel
systems do not yet require a code signature to work (though this
wouldn't break them). See the attached patch.

diff --git a/configure.ac b/configure.ac
index 888b415148..6376e5e83e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5107,6 +5107,11 @@ case $opsys in
     dnl Not DARWIN, because Panther and lower CoreFoundation.h use DARWIN to
     dnl distinguish macOS from pure Darwin.
     AC_DEFINE(DARWIN_OS, [], [Define if the system is Darwin.])
+    case "${canonical}" in
+      arm-* | aarch64-* )
+        AC_CHECK_PROGS(CODESIGN, [codesign], [yes])
+        ;;
+    esac
     ;;
 
   gnu-linux | gnu-kfreebsd )
diff --git a/src/Makefile.in b/src/Makefile.in
index c5fb2ea3ab..0874db6489 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -336,6 +336,8 @@ DUMPING=@DUMPING@
 CHECK_STRUCTS = @CHECK_STRUCTS@
 HAVE_PDUMPER = @HAVE_PDUMPER@
 
+CODESIGN = @CODESIGN@
+
 # 'make' verbosity.
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 
@@ -653,6 +655,12 @@ temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \
          $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
 ifeq ($(HAVE_PDUMPER),yes)
        $(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp
+
+  ifneq ($(CODESIGN),)
+## make-fingerprint breaks the code signature. This code signature must
+## be valid for the executable to run on a ARM Mac.
+       $(CODESIGN) -s - $@.tmp
+  endif
 endif
        $(AM_V_at)mv $@.tmp $@
        $(MKDIR_P) $(etc)



In GNU Emacs 27.1 (build 1, arm-apple-darwin20.1.0)
 of 2020-11-20 built on Mac-mini.local
System Description:  macOS 11.0.1

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
normal-splash-screen: Opening directory: Permission denied, /Users/hjelmn/.emacs.d/auto-save-list
Configured using:
 'configure --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs/27.1/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs/27.1 --with-gnutls --without-x
 --with-xml2 --without-dbus --with-modules --without-ns
 --without-imagemagick'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB XIM MODULES THREADS JSON PDUMPER
GMP

Important settings:
  locale-coding-system: nil

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow regexp-opt sort mail-extr emacsbug message rmc puny dired
dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache
epa derived epg epg-config gnus-util rmail tool-bar rmail-loaddefs
text-property-search time-date subr-x seq mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
term/xterm xterm byte-opt gv bytecomp byte-compile cconv disp-table
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue multi-tty make-network-process emacs)

Memory information:
((conses 16 47079 7064)
 (symbols 48 6013 1)
 (strings 32 15896 1743)
 (string-bytes 1 514215)
 (vectors 16 7411)
 (vector-slots 8 79909 4622)
 (floats 8 22 251)
 (intervals 56 178 1)
 (buffers 1000 12))

[-- Attachment #2.1: Type: text/html, Size: 41635 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-20 23:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-20 23:11 bug#44774: 27.1; emacs build fails on M1 Mac Nathan Hjelm via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).