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
emacs: fix paths for native compilation #98673
Conversation
The given paths gives rise to errors such as, ``` x86_64-unknown-linux-gnu-gcc-9.3.0: fatal error: cannot execute ‘as’: execvp: No such file or directory compilation terminated. ``` in the `*Async-native-compile-log*` buffer. Fixes <nix-community/emacs-overlay#69>
The -B flag to gcc (and libgccjit) allows us to specify where it can find things it needs to correctly compile code (both programs and libraries) without adjusting any environmental flags: So, no need to wrap the program for a PATH entry containing binutils, and no need to explicitly pass a linker path anymore.
"${lib.getBin stdenv.cc.bintools.bintools}" | ||
"${lib.getBin stdenv.cc.cc}/bin" | ||
"${lib.getBin stdenv.cc.bintools}/bin" | ||
"${lib.getBin stdenv.cc.bintools.bintools}/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my tests, it looked like libgccjit would search through subdirs for binaries. At least that's what I was led to believe based on the prefix
name in the docs. Weirdly enough, it can find the as
binaries on my macOS system, and I was pretty certain we tested gccemacs's ability to compile on a Linux machine also, with -B paths sans /bin.
I'm pretty sure your change results in the right directory names, but I'm a bit worried we may be flip-flopping between two solutions that only half fix the problem. Hrm. I can try this change on macOS later this weekend, can check if it continues working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... I read those docs differently than you, but I can certainly see the confusion. Give the /bin
version a shot to see if it works for you, too. In the overlay issue I linked, you can see that another user was pulling as
in via another mechanism, and it's not hard to imagine some as
getting onto $PATH
through various out-of-band mechanisms.
So one thought I just had was that it would be really cool to have a test checked into nixpkgs that ensures a gccemacs can produce working .eln files. I'm not sure how that can be done since we get gccemacs from the overlay, but it would make this "will it work / won't it work on [platform]" back and forth so much easier to resolve! |
Wow, yeah, that does seem to fall into the gap. I guess the overlay should have the test, which would be better than no automated test, even if some bug fixes would need to land here. |
OK, I've compiled emacs-gcc (from current emacs-overlay) with nixpkgs from your branch, running the resulting emacs with The resulting The resulting emacs could natively-compile a .el file I made, and the resulting .eln file could be loaded. So, I think your change is good! Also, agreed re. having that test live in the overlay. I'm not sure how to formulate it, but it would be a really really good thing to have. |
Thank you for looking into it! |
The given paths gives rise to errors such as,
in the
*Async-native-compile-log*
buffer.Fixes nix-community/emacs-overlay#69
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)