-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Need to set LIBRARY_PATH for emacs-plus@28 with --with-native-comp #378
Comments
Start |
EDIT Don't set Original comment below I can confirm setting
|
See this message. If you have to set |
@d12frosted thanks! After reinstalling gcc and libgccjit (also from source) with no success, I poked around in my env: It seems the issue was Spacemacs caching the env variables (including |
Do you mean an error saying that it's obsolete/deprecated? 😄
This sounds great. |
Unfortunately no 😅. Still some native-comp error:
The others following immediately after it seemingly work:
|
I also got that last error fixed: it was because the compilation was kicked off by spacemacs before loading the So I can confirm that these errors were entirely due to my environment Emacs runs in not being set up properly, especially that |
People say that null pointers are billion dollars issue, but I'd rather say that it's |
This is probably a better solution IMO than relying on users having correct environments. When built with native-comp, add the path during build so on startup the compiler can find libgccjit. |
I had the same error after brew unlink emacs-plus@28 && brew link emacs-plus@28 |
General advise - never use reinstall, especially with emacs-plus. See readme section for this.
Cheers,
***@***.***
…On Fri, Sep 3, 2021 at 12:08, Anthony Hobbs ***@***.***> wrote:
I had the same error after brew reinstall ***@***.*** --with-native-comp. I was able to fix it with:
brew unlink ***@***.***
&&
brew link ***@***.***
—
You are receiving this because you were mentioned.
Reply to this email directly, [view it on GitHub](#378 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABRU3CNYJS2H4V7HAKTIZOTUACGBTANCNFSM5BR7Y3FA).
|
In case anyone else finds this wants to change (That last bit had me pulling my hair out for a while) |
On macOS 10.15 I was getting the same error while launching the Emacs application from the LaunchPad/Dock. It turned out the
Make sure that the |
On M1 Macs, the path to all Homebrew stuffs is different. I'd suggest
Without these fixes, I have to launch Emacs from the shell. Otherwise it just won't find libgccjit etc. during native compilation Edit: Shorter alias pbd=/usr/libexec/PlistBuddy
export emacsapp=`brew --prefix --installed emacs-plus@28`/Emacs.app
export infoplist="${emacsapp}/Contents/Info.plist"
pbd -c "Add :LSEnvironment dict" "${infoplist}"
pbd -c "Add :LSEnvironment:PATH string" "${infoplist}"
pbd -c "Set :LSEnvironment:PATH $(echo "$PATH")" "${infoplist}"
pbd -c "Print :LSEnvironment" "${infoplist}"
touch ${emacsapp} |
Not sure if it's all that helpful, but I mess about with the Potentially emacs-plus can do something similar, by simply ensuring it's pointing at the correct brew paths. In my case, I add some custom elisp to For reference, this is what the elisp my build-script produces looks like: ;; Set LIBRARY_PATH to point at bundled GCC and Xcode Command Line Tools to
;; ensure native-comp works.
(when (and (eq system-type 'darwin)
(string-match-p "\.app\/Contents\/MacOS\/?$"
invocation-directory))
(let* ((library-path-env (getenv "LIBRARY_PATH"))
(devtools-dir
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib")
(gcc-dir (expand-file-name
"lib/lib/gcc/11"
invocation-directory))
(darwin-dir (expand-file-name
"lib/lib/gcc/11/gcc/x86_64-apple-darwin19/11_2_0"
invocation-directory))
(lib-paths (list)))
(if library-path-env
(push library-path-env lib-paths))
(if (file-directory-p devtools-dir)
(push devtools-dir lib-paths))
(push darwin-dir lib-paths)
(push gcc-dir lib-paths)
(setenv "LIBRARY_PATH" (mapconcat 'identity lib-paths ":")))) The above obviously won't work as is in an emacs-plus Emacs.app bundle, but it could potentially be adjusted to detect/find or just hard-code the relevant homebrew paths for GCC. |
This worked great for me. Thank you 🙏 |
This appears to have worked for me, as well, on an Intel mac. |
@d12frosted would it make sense to add this to the main script? I have to manually apply this fix to every install on my M1 mac or launching from macOS launcher has not found errors |
@jsmestad in general, it's a bad idea to modify The only place where it's valid (IMHO) is WDYT @jsmestad ? |
Yeah I agree. Interested to see how you approach it! The macOS launcher issue has been hurting folks adopting Emacs, at least at my office, because they think it's too difficult/buggy to get native-comp working when in-fact this has nothing to do with native-comp. 🫤 |
The core issue here is environment in which macOS starts applications from Finder/Docker/Spotlight/etc. This change mostly helps users of `native-comp` feature (e.g. #378), but it also should help other users as well ([see this comment][1]) [1]: #414 (comment)
@jsmestad started toying around with this idea in #453. It was not obvious how to get real user For now doing it for Right now the build is red because GitHub packages degraded according to https://www.githubstatus.com In any case, I would love someone to test it 🙏 |
Ok, it's green now. So I would appreciate some testing. In case no one reports issues till Wednesday, I will merge it :) |
Worked for me! |
emacs-plus@29 --with-native-comp working fine for me, too, with no plist hacking. |
The core issue here is environment in which macOS starts applications from Finder/Docker/Spotlight/etc. This change mostly helps users of `native-comp` feature (e.g. #378), but it also should help other users as well ([see this comment][1]) [1]: #414 (comment)
Merged #453, which should ease usage of native compilation feature. Please let me know if you still encounter any issues. |
@d12frosted sorry for the delay. The patch works great. Thanks! |
@jsmestad glad to hear :) |
Just in case it helps anyone in the future, after quite a bit of trial and error, the following steps worked: Uninstalled gcc and libgccjit
Uninstalled any existing emacs-plus installations
Installed libgccjit from source
Unlinked and relinked libgccjit
Installed emacs-plus
Added the following statement to
|
I had this issue today after "sudo port upgrade outdated" on Monterey MacOS 12.7.5 on a 2015 MBP. |
I ran
brew install emacs-plus@28 --with-native-comp
and it completed successfully. However, when I tried to run Emacs although the editor worked, there were loads of native compilation warnings.The solution was to create a one-line ~/.emacs.d/early-init.el, with the following contents:
I'd suggest adding this to the "gccemacs" section of the README.
This is on an M1 iMac, it works great now.
The text was updated successfully, but these errors were encountered: