-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Starship prompt failing to build on MacOs #160876
Comments
I have the same issue. I played around with trying to fix it and it seems like this might be an |
I ran into the same problem yesterday too. I was able to work around it by overriding the version for now. It looks fairly innocuous (missing a header). |
@jdahm that's what I ended up doing, too. I tried hacking on |
@jdahm I noticed the starship version in the nix package is behind, did you overwrite/update this and it worked? |
@dannyknows I had trouble using the version on nixpkgs
but ran into other issues, since the The most straightforward solution I could come up with was to copy the derivation in |
I'm getting slightly different error output on my system, so I thought I'd drop what I'm getting here in case it would be helpful:
In my case I'd guess the main line of interest is:
I did a little exploration, and had a look at https://github.com/h4llow3En/mac-notification-sys and https://github.com/alexcrichton/cc-rs to try and understand what they are doing and why this issue is coming up on |
The library in question did not get updated in about 3 years. with macOS 11 there where some deprications, which are used by the library. Although I can get the library to build in a non nix environment. |
Every package that I could find that depends on |
(Partly) Upstream issue: h4llow3En/mac-notification-sys#28 |
This get's it from 17 to 15 errors. But really have to sleep now. patchdiff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix
index d61fd9ddda9..87c6c543c1a 100644
--- a/pkgs/tools/misc/starship/default.nix
+++ b/pkgs/tools/misc/starship/default.nix
@@ -9,6 +9,9 @@
, nixosTests
, Security
, Foundation
+, CoreServices
+, CoreFoundation
+, libdispatch
}:
rustPlatform.buildRustPackage rec {
@@ -25,7 +28,8 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [ installShellFiles ] ++ lib.optionals stdenv.isLinux [ pkg-config ];
buildInputs = lib.optionals stdenv.isLinux [ openssl ]
- ++ lib.optionals stdenv.isDarwin [ libiconv Security Foundation ];
+ ++ lib.optionals stdenv.isDarwin [ libiconv /*Security*/ Foundation libdispatch ];
+ #++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ CoreServices CoreFoundation ];
postInstall = ''
for shell in bash fish zsh; do
@@ -49,5 +53,6 @@ rustPlatform.buildRustPackage rec {
homepage = "https://starship.rs";
license = licenses.isc;
maintainers = with maintainers; [ bbigras danth davidtwco Br1ght0ne Frostman marsam ];
+ platforms = platforms.unix;
};
}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b69adcd4c52..375be67911b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24086,7 +24086,8 @@ with pkgs;
stdmanpages = callPackage ../data/documentation/std-man-pages { };
starship = callPackage ../tools/misc/starship {
- inherit (darwin.apple_sdk.frameworks) Security Foundation;
+ inherit (darwin.apple_sdk.frameworks) Security Foundation CoreServices CoreFoundation;
+ inherit (darwin) libdispatch;
};
stig = callPackage ../applications/networking/p2p/stig { }; |
So, got it down to 1 redefined error, everything else looks to me like an error resulting of that. But no clue how to fix that, as it's a leak from the stage 4 bootstrap. |
I'm facing the exact issue right now 😢 with a different package depending on mac-notification-sys |
@tami5 which one? I'm trying to fight the underlying cause, but it seems to be inside of stdenv, not really where I find myself at home :) |
@kloenk 😆 I started with 17 errors, then added few inputs, went up to 37 errors then became more selective and running the logging got down to 7. maybe I should've ran inside nix shell to avoid doing nix log ..drv. |
Maybe you can send me your work? I think I'm still at 13 errors. |
really 🙄, I'm back at 15 don't know what I added that raised those extra errors but I will work more it tom and share my findings. I build okay with cargo if I can point nix to my local environment 🤔 . bte package master repo has same errors not sure of the number of errors but I'll check further tom |
Okay Now I'm on 8 error with current master. with total ignorance of buildInputs. ... hacking :) |
Errors: warning: In file included from objc/notify.m:1:
warning: objc/notify.h:1:9:
fatal error: 'Cocoa/Cocoa.h' file not found
warning: #import <Cocoa/Cocoa.h>
warning: While building module 'CoreServices' imported from objc/notify.h:2:
warning: In file included from <module-includes>:1:
warning: $NIX_CoreServices/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:10:
fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning: While building module 'CoreServices' imported from objc/notify.h:2:
warning: While building module 'DiskArbitration' imported from
$NIX_CoreServices/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/File
s.h:56:
warning: In file included from <module-includes>:1:
warning: $NIX_DiskArbitration/Library/Frameworks/DiskArbitration.framework/Headers/DiskArbitration.h:27:10:
fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning: While building module 'CoreServices' imported from objc/notify.h:2:
warning: While building module 'DiskArbitration' imported from
$NIX_CoreServices/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/File
s.h:56:
warning: While building module 'IOKit' imported from $NIX_DiskArbitration/Library/Frameworks/DiskArbitration.framework/Headers/DADisk.h:28:
warning: In file included from <module-includes>:4:
warning: $NIX_IOKit/Library/Frameworks/IOKit.framework/Headers/IOCFBundle.h:26:10:
fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning: While building module 'CoreServices' imported from objc/notify.h:2:
warning: While building module 'CFNetwork' imported from $NIX_CoreServices/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:31:
warning: In file included from <module-includes>:1:
warning: $NIX_CFNetwork/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10:
fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning: While building module 'CoreServices' imported from objc/notify.h:2:
warning: While building module 'Security' imported from
$NIX_CoreServices/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentityB
ase.h:23:
warning: In file included from <module-includes>:1:
warning: In file included from $NIX_Security/Library/Frameworks/Security.framework/Headers/Security.h:27:
warning: $NIX_Security/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10:
fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CFBase.h>
warning: While building module 'CoreServices' imported from objc/notify.h:2:
warning: While building module 'Security' imported from
$NIX_CoreServices/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentityB
ase.h:23:
warning: While building module 'XPC' imported from $NIX_Security/Library/Frameworks/Security.framework/Headers/SecCode.h:35:
warning: $NIX_LIBOBJC/include/objc/module.modulemap:1:8:
error: redefinition of module 'ObjectiveC'
warning: module ObjectiveC [system] [extern_c] {
warning: /nix/store/s08r4iph68fdhvlc9fpniq1xi5k02w97-libobjc-11.0.0/include/objc/module.modulemap:1:8:
note: previously defined here
7 errors generated:
🤔 |
Did not saw cocoa on my end yet I believe. Can you send the diff on the nix files? |
hmmm I haven't add any anything other than Libsystem to my build inputs full log: https://pastebin.com/DCGsDFRh |
Hmm, libsystem should already be there as propagated input from Foundation. |
- Cherry picked NixOS/nixpkgs#159516 - Starship workaround: NixOS/nixpkgs#160876
I just managed to get { pkgs ? import <nixpkgs> {} }:
with pkgs;
rustPlatform.buildRustPackage {
pname = "mac-notification-sys";
version = "0.3.1";
src = ./.;
cargoSha256 = "sha256-HX84vkTIk/gI/40kfFKKW3ORgH+hKg18SxW0xQuLGSs=";
buildInputs = with darwin.apple_sdk.frameworks; [ Cocoa Foundation AppKit CoreServices ];
NIX_CFLAGS_COMPILE = [
# disable modules, otherwise we get redeclaration errors
"-fno-modules"
# link AppKit since we don't get it from modules now
"-framework" "AppKit"
];
} This is very hacky, especially using I'm also not sure offhand how to override cargo dependencies of packages, so I don't know how to take this hack and apply it to starship. I do wonder what the fundamental issue here is. The build script specifies |
I'm also very curious as to why this issue affects just aarch64 and not x86_64. |
Poking around at |
@lilyball, I thought the problem was some frameworks depend on XPC directly rather than depending on Libsystem, which in turn provides headers from various things, like XPC. So we end up with things getting declarations from both Libsystem and the underlying XPC at the same time. Is this incorrect? Issue I opened to track this. |
From what I concluded, yes. Both xpc and libobjc are there 2 times, which creates the error. My pr did fix xpc, but not libobjc. |
@toonn I haven't dug into this enough to understand what's going on, but I do wonder why x86_64-darwin and aarch64-darwin behave differently here. |
@lilyball, the difference is probably the stdenv. x86_64-darwin's stdenv is composed of the open source releases for version 10.12. Aarch64-darwin's stdenv uses SDK 10.14 built by Apple. |
Had to disable Starship for now, because it doesn't currently build on Apple Silicon NixOS/nixpkgs#160876
Still an issue on |
|
@Sciencentistguy do you have a PR up for that? |
I believe |
Be aware that my fork has a few breaking changes compared to |
This disables the notification feature. This is needed to support building on `aarch64-darwin` under Nix See: NixOS/nixpkgs#160876
I've cherry-picked the fix onto a different branch: https://github.com/Sciencentistguy/starship/tree/fix-aarch64-darwin-nix |
after the merge of rust 1.59, I tried updating starship to the latest version, and it breaks x86_64 darwin.
I've checked and the mac-notification library has been updated recently. |
also regarding the notification feature, starship has a couple of features, I wonder if we could just put it behind a feature flag and make a PR for that. |
@happysalada It looks like it used to be a feature that was removed and enabled by default in this PR. From the looks of this comment, it seems that it was tested in a non-Nix environment on macOS, hence why the change went through. So this appears to be a uniquely us/Nix problem that we have to sort through to get to work. |
I went ahead and asked upstream to make it optional again. They were cool about it. |
Thanks @happysalada, starship now successfully builds. I'm happy to close this off unless someone has an objection? |
The reason to keep this an optional dep was a portability issue that was fixed in Feb: NixOS/nixpkgs#160876
I'm new to Nix and the ecosystem and I'm trying to install all the packages I use in my dev environment.
When installing starship I get a build error which is still cryptic to me.
When I run
nix-env -iA nixpkgs.starship
attempting to install, the build fails and I get this output when I runnix log /nix/store/qmj9qb3z5r2qizswvx443xd4xyayzv0n-starship-1.3.0.drv --extra-experimental-features nix-command
Steps To Reproduce
Steps to reproduce the behavior:
nix-env -iA nixpkgs.starship
Expected behavior
Starship to install out-of-the-box
Notify maintainers
@bbigras @Frostman @marsam @davidtwco @Br1ght0ne
Sorry if you're not a maintainer I guessed your Github usernames from the starship package "maintainers" section here
Metadata
The text was updated successfully, but these errors were encountered: