NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.36k stars 14.32k forks source link

Recent changes break emacs-macport build #331583

Open jwiegley opened 4 months ago

jwiegley commented 4 months ago

In the last few days (specifically, this range: https://github.com/NixOS/nixpkgs/compare/038fb464fcfa79b4f08131b07f2d8c9a6bcc4160...c3392ad349a5227f4a3464dce87bcc5046692fce, between commits 038fb464fcfa79b4f08131b07f2d8c9a6bcc4160 and c3392ad349a5227f4a3464dce87bcc5046692fce), something changed in either the Emacs or Darwin build environments that has caused the emacs29-macport build to fail.

The first error in the build is this, followed by many others:

In file included from macappkit.m:41:
./macappkit.h:355:1: error: duplicate interface definition for class 'NSTouchBarItem'
@interface NSTouchBarItem : NSObject <NSCoding>
^
jwiegley commented 4 months ago

I will see if I can git bisect this down further, haven't tried doing that with flakes before...

jwiegley commented 4 months ago

Looks like I can do the bisect in a nixpkgs clone and then build at each step with:

nix build --override-input nixpkgs ~/Products/nixpkgs \
    --impure .#darwinConfigurations.vulcan.pkgs.emacs29-macport
jwiegley commented 4 months ago

Still bisecting. This will not be quick.

knl commented 3 months ago

I don't have issues on m1/m3 macs, so it could be a failure on x86 arch. Indeed, this upgrade that runs on x86 darwin failed for me: https://github.com/knl/dotskel/pull/875

On hydra, I found this build as the first one to break: https://hydra.nixos.org/build/267539199

jwiegley commented 3 months ago

Hmm.. the commit mentioned in that failing build represents a merge of 694 commits. There are a lot of changes to the darwin.stdenv in that set.

My bisect is going slowly enough that I doubt it will finish before my upcoming vacation, so I may not have anything more precise for you until mid-August. Until then, I'll just freeze my personal nixpkgs at 038fb464fcfa79b4f08131b07f2d8c9a6bcc4160.

jwiegley commented 2 months ago

In case anyone else is trying to build Emacs macport for macOS, this gets it building again:

configureFlags = [ "CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101201" ];
citrusmunch commented 2 months ago

The above worked for me! I also wanted to share the snippet from my config since it took me (nix amateur) quite a while to figure out where to actually set those flags. Using lix and nix-darwin with flakes.

nixpkgs.overlays = [
  (self: super: {
    emacs-macport = super.emacs-macport.overrideAttrs (oldAttrs: {
      configureFlags = oldAttrs.configureFlags
                       ++ [ "CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101201" ];
    });
  })
];

I don't know if this is all best practice, but I do have a working emacs installation at the moment!

jwiegley commented 2 months ago

@citrusmunch That's very similar to what I have in my own config:

emacs29MacPort = pkgs.emacs29-macport.overrideAttrs (o: {
  configureFlags = o.configureFlags ++ [
    "CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101201"
    "CFLAGS=-DMAC_OS_X_VERSION_MIN_REQUIRED=101201"
  ];
});

Note that I needed both MIN and MAX for this to work on both aarch64 and x86_64.