-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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 for darwin's aarch64 codesigning issue #124888
emacs: fix for darwin's aarch64 codesigning issue #124888
Conversation
postPatch = lib.concatStringsSep "\n" [ | ||
(lib.optionalString srcRepo '' | ||
rm -fr .git | ||
'') | ||
|
||
# Reduce closure size by cleaning the environment of the emacs dumper | ||
'' | ||
(lib.optionalString ((stdenv.isDarwin && stdenv.isAarch64) == false) '' |
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.
I think this is a red herring, I'm going to test if this works without this change...
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.
not a red herring, needs to be there
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.
I don't see a failure if I remove this change. What error are you seeing?
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.
double blunder, this really isn't needed, now removed.
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.
This looks good to me
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.
Mostly seems reasonable, just a couple of comments.
@@ -46,10 +46,10 @@ assert withXwidgets -> withGTK3 && webkitgtk != null; | |||
let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp { | |||
NATIVE_FULL_AOT = "1"; | |||
LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib"; | |||
} // lib.optionalAttrs stdenv.isDarwin { | |||
} // lib.optionalAttrs (stdenv.isDarwin && !stdenv.isAarch64) { |
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.
This CFLAG was added in #41181, but I can't find the exact reason why this was added. It is it something we still need or can we drop it on all platforms? This controls the availability macros, and since we build against the SDK corresponding to our minimum version, this flag should have no effect.
If we keep it, it should probably follow the SDK version on all platforms, like in #124571.
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.
Good catch, I build it with nix-build -E 'with import <nixpkgs> { localSystem = "x86_64-darwin"; }; (import ./default.nix { localSystem = "x86_64-darwin"; }).emacs' -o result
and the binary (.App bundle) ran perfectly fine. Now removed for both platforms.
|
||
# Emacs checks for arm-apple-darwin, but our configuration is | ||
# aarch64-apple-darwin. Force enable DO_CODESIGN. | ||
preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' |
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.
I looked at this in more detail, and it looks like emacs itself has been churning between arm
and aarch64
, but the most recent commit uses aarch64
. If we backport this change as a patch then we know when to remove it (when it conflicts).
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.
Ok, should we change the comment, or keep it like this?
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.
Hmm. Add a link to the upstream change for context. This sed
is probably the easiest way to make the required change.
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.
Add a link to the upstream change for context.
^ I think this suggestion is still open, @hlolli. 🙂
Looking forward to these changes getting merged.
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.
Thanks for reminding me! I misunderstood as well. This part I copy pasted from the @thefloweringash's previous wip PR. Anyway, late for me here, tomorrow!
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.
ok I pushed a fetchpatch call to the svannah commit. Which should error when the patch doesn't apply anymore!
ef3a770
to
91278c1
Compare
Change LGTM. The commit history needs tidying. See the guidelines for commit messages. |
1ac6f63
to
5efbcf8
Compare
fixed |
Backport failed for Please cherry-pick the changes locally: git fetch origin release-21.05
git worktree add -d .worktree/backport-124888-to-release-21.05 origin/release-21.05
cd .worktree/backport-124888-to-release-21.05
git checkout -b backport-124888-to-release-21.05
ancref=$(git merge-base 16b157c3462f547e989faf7a74203bf0f44a9c94 5efbcf8d7eef8a6380dafb9fbfb6420b1e051da9)
git cherry-pick -x $ancref..5efbcf8d7eef8a6380dafb9fbfb6420b1e051da9 |
Backport failed for Please cherry-pick the changes locally: git fetch origin release-21.05
git worktree add -d .worktree/backport-124888-to-release-21.05 origin/release-21.05
cd .worktree/backport-124888-to-release-21.05
git checkout -b backport-124888-to-release-21.05
ancref=$(git merge-base 16b157c3462f547e989faf7a74203bf0f44a9c94 5efbcf8d7eef8a6380dafb9fbfb6420b1e051da9)
git cherry-pick -x $ancref..5efbcf8d7eef8a6380dafb9fbfb6420b1e051da9 |
Motivation for this change
Excited to get started with aarch64 but Emacs doesn't compile
as well does #124571 not fix the issue I have for me.
Things done
Felt lucky to have bumped into this commit emacs-mirror/emacs@868f513 so the work has been done for us.
As well I remove the osx upper limit, I think it's fair to say that we are ok making assumtions about recency of aarch64 apple m1 computers. But please correct me if I'm wrong.
Screen:
built with
nix-build -E 'with import <nixpkgs> { localSystem = "aarch64-darwin"; }; (import ./default.nix { localSystem = "aarch64-darwin"; }).emacs' -o result
built with
nix-build -E 'with import <nixpkgs> { localSystem = "x86_64-darwin"; }; (import ./default.nix { localSystem = "x86_64-darwin"; }).emacs' -o result
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)