Skip to content
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: use llvmPackages_14 from apple_sdk_11_0 #253892

Merged
merged 1 commit into from
Sep 7, 2023
Merged

emacs: use llvmPackages_14 from apple_sdk_11_0 #253892

merged 1 commit into from
Sep 7, 2023

Conversation

tnytown
Copy link
Contributor

@tnytown tnytown commented Sep 7, 2023

Description of changes

Explicitly pull in llvmPackages_14 from apple_sdk_11_0 for Emacs. This should pull in the correct Libsystem headers and resolve the remaining compilation issues related to the new SDK.

Tested:

  • emacs28-macport.withPackages
    • Under a nix repl (nix repl --expr 'import ./.{system="x86_64-darwin";}'), evaluate :b emacs28-macport.pkgs.withPackages (epkgs: with epkgs.melpaStablePackages; [ magit ])
    • result/bin/emacs -nw --batch --eval '(print (progn (package-initialize) (magit-version)))' yields "3.3.0", indicating that Magit has been correctly installed
  • emacs28-macport
    • Builds correctly under Rosetta x86_64, result/Applications/Emacs.app contains an Info.plist
    • App bundle opens correctly

I've only tested this under Rosetta on an ARM Mac, so I'd appreciate any testing from those on Intel Macs.

Resolves #253502.

CC @sixtysecrun, @knl, @AndersonTorres

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Fixes issues with macport x86_64 build.

Signed-off-by: Andrew Pan <[email protected]>
@tnytown tnytown requested a review from adisbladis as a code owner September 7, 2023 18:17
@tnytown tnytown changed the title emacs: use llvmPackages_14 from apple_sdk_11_0 emacs: use llvmPackages_14 from apple_sdk_11_0 Sep 7, 2023
@github-actions github-actions bot added the 6.topic: emacs Text editor label Sep 7, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Sep 7, 2023
@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Sep 7, 2023
@wegank wegank merged commit 04942c5 into NixOS:master Sep 7, 2023
15 checks passed
@alienman5k
Copy link

Is there any plan to merge this to NixOS:23.05 as this is also failing in stable branch?

@AndersonTorres
Copy link
Member

I could possibly try, however I don't have Darwin.

@tnytown
Copy link
Contributor Author

tnytown commented Sep 12, 2023

Is there any plan to merge this to NixOS:23.05 as this is also failing in stable branch?

I believe the regression shouldn't be present on 23.05, as #252244 hasn't been backported. If you're referring to the build issues with Apple Silicon, the x86_64-darwin derivations on stable should work under Rosetta.

@quentinmit
Copy link
Contributor

quentinmit commented Dec 6, 2023

I believe this commit broke emacs on macOS 10.14. The resulting binaries fail with

dyld: Symbol not found: _aligned_alloc
  Referenced from: /nix/store/n6wnda0r2bi5wr0pr16rgd46l8pmgvvi-emacs-nox-28.2/bin/emacs
  Expected in: /usr/lib/libSystem.B.dylib

I presume because they are now linking with a newer SDK that has the aligned_alloc symbol. See upstream bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36172 and macports bug: https://trac.macports.org/ticket/61406

I was able to fix it with this overlay:

  emacs-nox = let
    inherit (final) lib stdenv;
  in prev.emacs-nox.overrideAttrs (old: {
    configureFlags = old.configureFlags ++ lib.optionals stdenv.isDarwin [
      "ac_cv_func_aligned_alloc=no"
      "ac_cv_have_decl_aligned_alloc=no"
      "ac_cv_func_posix_spawn_file_actions_addchdir_np=no"
    ];
  });

@tnytown
Copy link
Contributor Author

tnytown commented Dec 6, 2023

@quentinmit that's odd -- is it this specific commit that broke emacs-nox on 10.14 or could it have been earlier related commits (bdce9a2, f607a78)?

i believe this change should have only affected the emacs-macport variant, as llvmPackages_14 is only used there:

inherit (if variant == "macport"
then llvmPackages_14.stdenv
else stdenv) mkDerivation;

sorry for the breakage!

@quentinmit
Copy link
Contributor

@quentinmit that's odd -- is it this specific commit that broke emacs-nox on 10.14 or could it have been earlier related commits (bdce9a2, f607a78)?

i believe this change should have only affected the emacs-macport variant, as llvmPackages_14 is only used there:

inherit (if variant == "macport"
then llvmPackages_14.stdenv
else stdenv) mkDerivation;

sorry for the breakage!

It certainly could have been one of the earlier commits you listed; I assumed it was this one just based on the commit message about switching to a newer SDK. No worries!

@knl
Copy link
Contributor

knl commented Dec 14, 2023

I'm seeing the same problem on 10.14 with emacs-macport:

❯ emacs --version
dyld: lazy symbol binding failed: Symbol not found: _aligned_alloc
  Referenced from: /nix/store/4x0dxbc13m9q68pphx9lwl61n0h97m9p-emacs-mac-macport-29.1/bin/emacs
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _aligned_alloc
  Referenced from: /nix/store/4x0dxbc13m9q68pphx9lwl61n0h97m9p-emacs-mac-macport-29.1/bin/emacs
  Expected in: /usr/lib/libSystem.B.dylib

@tnytown
Copy link
Contributor Author

tnytown commented Dec 14, 2023

We might be able to fix this by removing the SDK hacks. It seems like the newly required libraries are gated on the 11.0 SDKs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: emacs Text editor 10.rebuild-darwin: 1-10 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build failure: emacs29-macport
6 participants