Opened 4 years ago

Closed 3 years ago

#61896 closed defect (worksforme)

emacs{-app,}-devel +nativecomp: runtime native compilation fails on Big Sur 11.1

Reported by: amake (Aaron Madlon-Kay) Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: drkp (Dan Ports), catap (Kirill A. Korinsky)
Port: emacs-devel, emacs-app-devel

Description (last modified by amake (Aaron Madlon-Kay))

After updating to Big Sur 11.1 I find that the runtime native compilation (shown in the *Async-native-compile-log* buffer) fails with errors like the following:

Compiling /Users/amake/.emacs.d/elpa/use-package-20201110.2133/use-package-core.el...
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice "/Users/amake/.emacs.d/elpa/use-package-20201110.21..." "failed to compile" "/Users/amake/.emacs.d/eln-cache/28.0.50-x86_64-app..." "error invoking gcc driver")
  signal(native-ice ("/Users/amake/.emacs.d/elpa/use-package-20201110.21..." "failed to compile" "/Users/amake/.emacs.d/eln-cache/28.0.50-x86_64-app..." "error invoking gcc driver"))
  comp--native-compile("/Users/amake/.emacs.d/elpa/use-package-20201110.21..." t)
  eval-buffer(#<buffer  *load*> nil "/var/folders/m1/c0nhy2412p1_5bbn8t5hzs000000gn/T/e..." nil t)  ; Reading at buffer position 7282
  load-with-code-conversion("/var/folders/m1/c0nhy2412p1_5bbn8t5hzs000000gn/T/e..." "/var/folders/m1/c0nhy2412p1_5bbn8t5hzs000000gn/T/e..." nil t)
  command-line-1(("-l" "/var/folders/m1/c0nhy2412p1_5bbn8t5hzs000000gn/T/e..."))
  command-line()
  normal-top-level()

I believe that this was caused by the update to 11.1 (I'm pretty sure it was working fine on 11.0). I've tried recompiling but it didn't help.

I should note that compilation at build time seems to be fine.

Change History (12)

comment:1 Changed 4 years ago by amake (Aaron Madlon-Kay)

Description: modified (diff)

comment:2 Changed 4 years ago by amake (Aaron Madlon-Kay)

Cc: catap added

CC'ing @catap because he expressed interest in the +nativecomp variant elsewhere.

comment:3 Changed 4 years ago by telotortium (Robert Irelan)

Intel or M1?

comment:4 Changed 4 years ago by amake (Aaron Madlon-Kay)

Intel for me.

comment:5 Changed 4 years ago by amake (Aaron Madlon-Kay)

I have seen in other ports a problem with the system SDK, wherein a port has baked into it a reference to e.g. MacOSX11.0.sdk which no longer exists on Big Sur 11.1 (there is only MacOSX.sdk or MacOSX11.1.sdk).

On a whim I searched the emacs binary for the string MacOSX11.0.sdk and found that indeed it did have it:

% grep -l -U MacOSX11.0.sdk /opt/local/bin/emacs 
/opt/local/bin/emacs

In fact I did a recursive search on my $prefix and found that lots of things had the old SDK baked in. One of those things was the glibtool binary, which I vaguely thought might be involved in the build process.

So I force-uninstalled the libtool port and reinstalled from source. Then I reinstalled emacs-devel +nativecomp from source as well. (In the process coreutils was also built and installed from source.)

This seems to have fixed my problem.

comment:6 Changed 4 years ago by amake (Aaron Madlon-Kay)

It turns out I also had to reinstall gcc10 from source.

comment:7 in reply to:  2 Changed 4 years ago by catap (Kirill A. Korinsky)

Replying to amake:

CC'ing @catap because he expressed interest in the +nativecomp variant elsewhere.

Thanks! Sorry for very long delay, last weeks was very overloaded.

Anyway, yesterday I've updated my laptop and I enjoyed this issue.

I belive that xcode was updated some time ago, and I just haven't restarted laptop and emacs for month or something like this.

Because I thought that it is another issue inside native I've opened an issue at upstream: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45817

I've tried a few hacks that includes to put to early-init.el a lines:

(setq comp-native-driver-options '(
       (concat
        "-L"
        (substring (shell-command-to-string "xcode-select -p") 0 -1)
        "/SDKs/MacOSX.sdk/usr/lib")))

Let me say that it doesn't help and right now I'm rebuilding gcc10 from sources :)

comment:8 Changed 4 years ago by amake (Aaron Madlon-Kay)

I'm quite sure that this isn't a problem with upstream.

comment:9 in reply to:  8 Changed 4 years ago by catap (Kirill A. Korinsky)

Replying to amake:

I'm quite sure that this isn't a problem with upstream.

Yes, I'd like to confirm that reinstalling gcc10 from sources fixed an issue.

comment:10 Changed 4 years ago by telotortium (Robert Irelan)

Is there a way to avoid having to rebuild libtool, gcc10, and emacs-app-devel every time macOS is upgraded? 11.2 is going to be released soon.

comment:11 Changed 4 years ago by amake (Aaron Madlon-Kay)

I think this commit should fix things for gcc10:

https://github.com/macports/macports-ports/commit/e8866c5019d60832527850b4e50fdc1de8878716

I'm not sure if libtool will still be a problem.

comment:12 Changed 3 years ago by amake (Aaron Madlon-Kay)

Resolution: worksforme
Status: assignedclosed

I have not had this problem recently, so I will close.

Note: See TracTickets for help on using tickets.