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

Starship prompt failing to build on MacOs #160876

Closed
work-in-progress-danny opened this issue Feb 19, 2022 · 39 comments
Closed

Starship prompt failing to build on MacOs #160876

work-in-progress-danny opened this issue Feb 19, 2022 · 39 comments
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin

Comments

@work-in-progress-danny
Copy link

work-in-progress-danny commented Feb 19, 2022

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 run nix log /nix/store/qmj9qb3z5r2qizswvx443xd4xyayzv0n-starship-1.3.0.drv --extra-experimental-features nix-command

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/dw6hqmr20l0niqs5kq112rzvxg8d58v2-source
source root is source
Executing cargoSetupPostUnpackHook
unpacking source archive /nix/store/rsi4ij6hhh53mzyhqwmkxhjjcl9qdxc9-starship-1.3.0-vendor.tar.gz
Finished cargoSetupPostUnpackHook
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
Executing cargoSetupPostPatchHook
Validating consistency between /private/tmp/nix-build-starship-1.3.0.drv-0/source//Cargo.lock and /private/tmp/nix-build-starship-1.3.0.drv-0/starship-1.3.0-vendor.tar.gz/Cargo.lock
Finished cargoSetupPostPatchHook
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Executing cargoBuildHook
++ env CC_aarch64-apple-darwin=/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/cc CXX_aarch64-apple-darwin=/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/c++ CC_aarc
   Compiling libc v0.2.102
   Compiling autocfg v1.0.1
   Compiling version_check v0.9.3
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.29
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.76
   Compiling pkg-config v0.3.19
   Compiling memchr v2.4.1
   Compiling serde_derive v1.0.136
   Compiling serde v1.0.136
   Compiling typenum v1.14.0
   Compiling lazy_static v1.4.0
   Compiling crossbeam-utils v0.8.5
   Compiling tinyvec_macros v0.1.0
   Compiling matches v0.1.9
   Compiling log v0.4.14
   Compiling unicode-bidi v0.3.6
   Compiling percent-encoding v2.1.0
   Compiling ppv-lite86 v0.2.10
   Compiling crossbeam-epoch v0.9.5
   Compiling either v1.6.1
   Compiling bitflags v1.3.2
   Compiling hashbrown v0.11.2
   Compiling core-foundation-sys v0.7.0
   Compiling unicode-segmentation v1.9.0
   Compiling ucd-trie v0.1.3
   Compiling scopeguard v1.1.0
   Compiling rayon-core v1.9.1
   Compiling block v0.1.6
   Compiling unicode-width v0.1.9
   Compiling ahash v0.4.7
   Compiling maplit v1.0.2
   Compiling is_debug v1.0.1
   Compiling ryu v1.0.5
   Compiling strsim v0.10.0
   Compiling semver v1.0.5
   Compiling termcolor v1.1.2
   Compiling minimal-lexical v0.2.1
   Compiling serde_json v1.0.78
   Compiling starship-battery v0.7.9
   Compiling bytes v1.1.0
   Compiling regex-syntax v0.6.25
   Compiling linked-hash-map v0.5.4
   Compiling utf8-width v0.1.5
   Compiling itoa v1.0.1
   Compiling pathdiff v0.2.0
   Compiling once_cell v1.9.0
   Compiling urlencoding v2.1.0
   Compiling shell-words v1.1.0
   Compiling path-slash v0.1.4
   Compiling ansi_term v0.12.1
   Compiling local_ipaddress v0.1.3
   Compiling generic-array v0.14.4
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling unicase v2.6.0
   Compiling nom v7.1.0
   Compiling num-integer v0.1.44
   Compiling num-traits v0.2.14
   Compiling memoffset v0.6.4
   Compiling indexmap v1.8.0
   Compiling rayon v1.5.1
   Compiling tinyvec v1.4.0
   Compiling form_urlencoded v1.0.1
   Compiling itertools v0.10.1
   Compiling pest v2.1.3
   Compiling heck v0.3.3
   Compiling textwrap v0.14.2
   Compiling hashbrown v0.9.1
   Compiling yaml-rust v0.4.5
   Compiling byte-unit v4.0.13
   Compiling open v2.0.2
   Compiling unicode-normalization v0.1.19
   Compiling pest_meta v2.1.3
   Compiling os_str_bytes v6.0.0
   Compiling aho-corasick v0.7.18
   Compiling combine v4.6.3
   Compiling quick-xml v0.22.0
   Compiling quote v1.0.9
   Compiling crossbeam-channel v0.5.1
   Compiling jobserver v0.1.24
   Compiling time v0.1.44
   Compiling getrandom v0.2.3
   Compiling malloc_buf v0.0.6
   Compiling num_cpus v1.13.0
   Compiling atty v0.2.14
   Compiling dirs v1.0.5
   Compiling cpufeatures v0.2.1
   Compiling dirs-sys-next v0.1.2
   Compiling mach v0.3.2
   Compiling core-foundation v0.7.0
   Compiling gethostname v0.2.2
   Compiling which v4.2.4
   Compiling terminal_size v0.1.17
   Compiling idna v0.2.3
   Compiling nix v0.23.1
   Compiling regex v1.5.4
   Compiling cc v1.0.70
   Compiling process_control v3.2.1
   Compiling uom v0.30.0
   Compiling rand_core v0.6.3
   Compiling objc v0.2.7
   Compiling directories-next v2.0.0
   Compiling versions v4.0.0
   Compiling crossbeam-deque v0.8.1
   Compiling block-buffer v0.10.0
   Compiling crypto-common v0.1.0
   Compiling url v2.2.2
   Compiling chrono v0.4.19
   Compiling rand_chacha v0.3.1
   Compiling objc_id v0.1.1
   Compiling libz-sys v1.1.3
   Compiling libgit2-sys v0.12.26+1.3.0
   Compiling mac-notification-sys v0.3.0
   Compiling sys-info v0.9.1
   Compiling digest v0.10.0
   Compiling pest_generator v2.1.3
   Compiling rand v0.8.4
   Compiling objc-foundation v0.1.1
   Compiling sha-1 v0.10.0
   Compiling dlv-list v0.2.3
   Compiling clap_derive v3.0.0
   Compiling starship_module_config_derive v0.2.1 (/private/tmp/nix-build-starship-1.3.0.drv-0/source/starship_module_config_derive)
   Compiling pest_derive v2.1.0
   Compiling ordered-multimap v0.3.1
   Compiling rust-ini v0.17.0
The following warnings were emitted during compilation:

warning: /nix/store/lfsd0c96b0ckaxgdchgdds5ixf0rpy44-libobjc-11.0.0/include/objc/module.modulemap:1:8: error: redefinition of module 'ObjectiveC'
warning: module ObjectiveC [system] [extern_c] {
warning:        ^
warning: /nix/store/s08r4iph68fdhvlc9fpniq1xi5k02w97-libobjc-11.0.0/include/objc/module.modulemap:1:8: note: previously defined here
warning: module ObjectiveC [system] [extern_c] {
warning:        ^
warning: /nix/store/kb9lrwksbcb2br2n5srgvwhnklqx2slk-libSystem-11.0.0/include/xpc/module.modulemap:1:8: error: redefinition of module 'XPC'
warning: module XPC [system] [extern_c] {
warning:        ^
warning: /nix/store/vb38d7pzcvp4h6w8bk7hwfckx20g9qgm-apple-lib-xpc/include/xpc/module.modulemap:1:8: note: previously defined here
warning: module XPC [system] [extern_c] {
warning:        ^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'CoreFoundation' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
warning: In file included from <module-includes>:1:
warning: In file included from /nix/store/01yba9h37hpw0z5s70pfplyd4ghmzjnv-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:60:
warning: In file included from /nix/store/01yba9h37hpw0z5s70pfplyd4ghmzjnv-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17:
warning: /nix/store/01yba9h37hpw0z5s70pfplyd4ghmzjnv-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:10: fatal error: could not build module 'Dispatch'
warning: #include <dispatch/dispatch.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: In file included from <module-includes>:1:
warning: /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'CoreGraphics' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
warning: In file included from <module-includes>:1:
warning: In file included from /nix/store/fiimlh3gj1sdr2n3khxqy99dvvzqg3pn-apple-framework-CoreGraphics-11.0.0/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:
warning: /nix/store/fiimlh3gj1sdr2n3khxqy99dvvzqg3pn-apple-framework-CoreGraphics-11.0.0/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CFBase.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'CoreGraphics' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
warning: While building module 'IOKit' imported from /nix/store/fiimlh3gj1sdr2n3khxqy99dvvzqg3pn-apple-framework-CoreGraphics-11.0.0/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:
warning: In file included from <module-includes>:4:
warning: /nix/store/vdwk5bz75dfk6rlkxns59vml7m49fs8b-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Headers/IOCFBundle.h:26:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'Security' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
warning: In file included from <module-includes>:1:
warning: In file included from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/Security.h:27:
warning: /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CFBase.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'Security' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
warning: While building module 'XPC' imported from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecCode.h:35:
warning: /nix/store/lfsd0c96b0ckaxgdchgdds5ixf0rpy44-libobjc-11.0.0/include/objc/module.modulemap:1:8: error: redefinition of module 'ObjectiveC'
warning: module ObjectiveC [system] [extern_c] {
warning:        ^
warning: /nix/store/s08r4iph68fdhvlc9fpniq1xi5k02w97-libobjc-11.0.0/include/objc/module.modulemap:1:8: note: previously defined here
warning: module ObjectiveC [system] [extern_c] {
warning:        ^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'Security' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
warning: While building module 'XPC' imported from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecCode.h:35:
warning: In file included from <module-includes>:1:
warning: /nix/store/vb38d7pzcvp4h6w8bk7hwfckx20g9qgm-apple-lib-xpc/include/xpc/xpc.h:7:10: fatal error: could not build module 'Dispatch'
warning: #include <dispatch/dispatch.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'CoreServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15:
warning: In file included from <module-includes>:1:
warning: /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:10: fatal error: could not build module 'CoreFounda
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'CoreServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15:
warning: While building module 'DiskArbitration' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.f
warning: In file included from <module-includes>:1:
warning: /nix/store/bx8h4bl5fh5f3a639paykpz50cr8nfj6-apple-framework-DiskArbitration-11.0.0/Library/Frameworks/DiskArbitration.framework/Headers/DiskArbitration.h:27:10: fatal error: could not build module 'C
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'CoreServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15:
warning: While building module 'CFNetwork' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:31:
warning: In file included from <module-includes>:1:
warning: /nix/store/dkr5w4p0pbrkvw9q1iamvq7f21sg779p-apple-framework-CFNetwork-11.0.0/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDes
warning: In file included from <module-includes>:1:
warning: /nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23:10: fatal error: could not bui
warning: #include <CoreServices/CoreServices.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDes
warning: While building module 'CoreText' imported from /nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.f
warning: In file included from <module-includes>:1:
warning: In file included from /nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CoreText.h:20:
warning: In file included from /nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CTFont.h:20:
warning: In file included from /nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h:20:
warning: /nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h:14:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDes
warning: While building module 'ColorSync' imported from /nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Headers/Applica
warning: In file included from <module-includes>:1:
warning: In file included from /nix/store/pb3jgfhwm06zaqy4566j5dn9qjgjg1nc-apple-framework-ColorSync-11.0.0/Library/Frameworks/ColorSync.framework/Headers/ColorSync.h:10:
warning: /nix/store/pb3jgfhwm06zaqy4566j5dn9qjgjg1nc-apple-framework-ColorSync-11.0.0/Library/Frameworks/ColorSync.framework/Headers/ColorSyncBase.h:12:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: While building module 'Foundation' imported from objc/notify.h:1:
warning: While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDes
warning: While building module 'ImageIO' imported from /nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Headers/Applicati
warning: In file included from <module-includes>:1:
warning: In file included from /nix/store/zhcbihlkixfg9cr53bsl6jyg07wy797m-apple-framework-ImageIO-11.0.0/Library/Frameworks/ImageIO.framework/Headers/ImageIO.h:10:
warning: /nix/store/zhcbihlkixfg9cr53bsl6jyg07wy797m-apple-framework-ImageIO-11.0.0/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h:16:10: fatal error: could not build module 'CoreFoundation'
warning: #include <CoreFoundation/CoreFoundation.h>
warning:  ~~~~~~~~^
warning: In file included from objc/notify.m:1:
warning: objc/notify.h:1:9: fatal error: could not build module 'Foundation'
warning: #import <Foundation/Foundation.h>
warning:  ~~~~~~~^
warning: 17 errors generated.

error: failed to run custom build command for `mac-notification-sys v0.3.0`

Caused by:
  process didn't exit successfully: `/private/tmp/nix-build-starship-1.3.0.drv-0/source/target/release/build/mac-notification-sys-00bbbf594b92f79f/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-apple-darwin")
  CC_aarch64-apple-darwin = Some("/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/cc")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = None
  running: "/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-fmodules" "-o" "/private/tmp/nix-build-starship-1.3
  cargo:warning=/nix/store/lfsd0c96b0ckaxgdchgdds5ixf0rpy44-libobjc-11.0.0/include/objc/module.modulemap:1:8: error: redefinition of module 'ObjectiveC'
  cargo:warning=module ObjectiveC [system] [extern_c] {
  cargo:warning=       ^
  cargo:warning=/nix/store/s08r4iph68fdhvlc9fpniq1xi5k02w97-libobjc-11.0.0/include/objc/module.modulemap:1:8: note: previously defined here
  cargo:warning=module ObjectiveC [system] [extern_c] {
  cargo:warning=       ^
  cargo:warning=/nix/store/kb9lrwksbcb2br2n5srgvwhnklqx2slk-libSystem-11.0.0/include/xpc/module.modulemap:1:8: error: redefinition of module 'XPC'
  cargo:warning=module XPC [system] [extern_c] {
  cargo:warning=       ^
  cargo:warning=/nix/store/vb38d7pzcvp4h6w8bk7hwfckx20g9qgm-apple-lib-xpc/include/xpc/module.modulemap:1:8: note: previously defined here
  cargo:warning=module XPC [system] [extern_c] {
  cargo:warning=       ^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'CoreFoundation' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=In file included from /nix/store/01yba9h37hpw0z5s70pfplyd4ghmzjnv-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:60:
  cargo:warning=In file included from /nix/store/01yba9h37hpw0z5s70pfplyd4ghmzjnv-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17:
  cargo:warning=/nix/store/01yba9h37hpw0z5s70pfplyd4ghmzjnv-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:10: fatal error: could not build module 'Dis
  cargo:warning=#include <dispatch/dispatch.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFounda
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'CoreGraphics' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=In file included from /nix/store/fiimlh3gj1sdr2n3khxqy99dvvzqg3pn-apple-framework-CoreGraphics-11.0.0/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:
  cargo:warning=/nix/store/fiimlh3gj1sdr2n3khxqy99dvvzqg3pn-apple-framework-CoreGraphics-11.0.0/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: fatal error: could not build module 'CoreFound
  cargo:warning=#include <CoreFoundation/CFBase.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'CoreGraphics' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
  cargo:warning=While building module 'IOKit' imported from /nix/store/fiimlh3gj1sdr2n3khxqy99dvvzqg3pn-apple-framework-CoreGraphics-11.0.0/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfigura
  cargo:warning=In file included from <module-includes>:4:
  cargo:warning=/nix/store/vdwk5bz75dfk6rlkxns59vml7m49fs8b-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Headers/IOCFBundle.h:26:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'Security' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=In file included from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/Security.h:27:
  cargo:warning=/nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CFBase.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'Security' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9
  cargo:warning=While building module 'XPC' imported from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecCode.h:35:
  cargo:warning=/nix/store/lfsd0c96b0ckaxgdchgdds5ixf0rpy44-libobjc-11.0.0/include/objc/module.modulemap:1:8: error: redefinition of module 'ObjectiveC'
  cargo:warning=module ObjectiveC [system] [extern_c] {
  cargo:warning=       ^
  cargo:warning=/nix/store/s08r4iph68fdhvlc9fpniq1xi5k02w97-libobjc-11.0.0/include/objc/module.modulemap:1:8: note: previously defined here
  cargo:warning=module ObjectiveC [system] [extern_c] {
  cargo:warning=       ^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'Security' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9
  cargo:warning=While building module 'XPC' imported from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecCode.h:35:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/vb38d7pzcvp4h6w8bk7hwfckx20g9qgm-apple-lib-xpc/include/xpc/xpc.h:7:10: fatal error: could not build module 'Dispatch'
  cargo:warning=#include <dispatch/dispatch.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'CoreServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:10: fatal error: could not build module 'Cor
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'CoreServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15
  cargo:warning=While building module 'DiskArbitration' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/Carbo
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/bx8h4bl5fh5f3a639paykpz50cr8nfj6-apple-framework-DiskArbitration-11.0.0/Library/Frameworks/DiskArbitration.framework/Headers/DiskArbitration.h:27:10: fatal error: could not build mo
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'CoreServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15
  cargo:warning=While building module 'CFNetwork' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/dkr5w4p0pbrkvw9q1iamvq7f21sg779p-apple-framework-CFNetwork-11.0.0/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: fatal error: could not build module 'CoreFoundati
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleE
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23:10: fatal error: could
  cargo:warning=#include <CoreServices/CoreServices.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleE
  cargo:warning=While building module 'CoreText' imported from /nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Framework
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=In file included from /nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CoreText.h:20:
  cargo:warning=In file included from /nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CTFont.h:20:
  cargo:warning=In file included from /nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h:20:
  cargo:warning=/nix/store/i5c7samchv65agdxgvzcx675n4xym6c2-apple-framework-CoreText-11.0.0/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h:14:10: fatal error: could not build module 'CoreFoundat
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleE
  cargo:warning=While building module 'ColorSync' imported from /nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Headers/
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=In file included from /nix/store/pb3jgfhwm06zaqy4566j5dn9qjgjg1nc-apple-framework-ColorSync-11.0.0/Library/Frameworks/ColorSync.framework/Headers/ColorSync.h:10:
  cargo:warning=/nix/store/pb3jgfhwm06zaqy4566j5dn9qjgjg1nc-apple-framework-ColorSync-11.0.0/Library/Frameworks/ColorSync.framework/Headers/ColorSyncBase.h:12:10: fatal error: could not build module 'CoreFoun
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=While building module 'ApplicationServices' imported from /nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSAppleE
  cargo:warning=While building module 'ImageIO' imported from /nix/store/fhbjgn2qsajqd6w1bb4b02y1mw88kviq-apple-framework-ApplicationServices-11.0.0/Library/Frameworks/ApplicationServices.framework/Headers/Ap
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=In file included from /nix/store/zhcbihlkixfg9cr53bsl6jyg07wy797m-apple-framework-ImageIO-11.0.0/Library/Frameworks/ImageIO.framework/Headers/ImageIO.h:10:
  cargo:warning=/nix/store/zhcbihlkixfg9cr53bsl6jyg07wy797m-apple-framework-ImageIO-11.0.0/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h:16:10: fatal error: could not build module 'CoreFoundation
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=In file included from objc/notify.m:1:
  cargo:warning=objc/notify.h:1:9: fatal error: could not build module 'Foundation'
  cargo:warning=#import <Foundation/Foundation.h>
  cargo:warning= ~~~~~~~^
  cargo:warning=17 errors generated.
  exit status: 1

  --- stderr


  error occurred: Command "/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-fmodules" "-o" "/private/tmp/nix-bui


warning: build failed, waiting for other jobs to finish...
error: build failed

Steps To Reproduce

Steps to reproduce the behavior:

  1. Run 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

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"

 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.1.0, macOS 12.0.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.6.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
@work-in-progress-danny work-in-progress-danny added the 0.kind: bug Something is broken label Feb 19, 2022
@veprbl veprbl added the 6.topic: darwin Running or building packages on Darwin label Feb 19, 2022
@ELD
Copy link

ELD commented Feb 20, 2022

I have the same issue. I played around with trying to fix it and it seems like this might be an aarch64-darwin specific problem. #159937 fixed this issue for x86_64-darwin, but not for aarch64-darwin.

@jdahm
Copy link
Contributor

jdahm commented Feb 20, 2022

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).

@ELD
Copy link

ELD commented Feb 20, 2022

@jdahm that's what I ended up doing, too. I tried hacking on nixpkgs to fix the issues, but I'm still too fuzzy on Nix, in general, to know how to solve the issue. Especially as it relates to including macOS libraries as build inputs. I'm perplexed why the x86_64-darwin fix was insufficient for aarch64-darwin.

@work-in-progress-danny
Copy link
Author

I ran into the same problem yesterday too. I was able to work around it by overriding the version for now, but it looks fairly innocuous (missing a header) so I'd like to try and fix.

@jdahm I noticed the starship version in the nix package is behind, did you overwrite/update this and it worked?

@jdahm
Copy link
Contributor

jdahm commented Feb 21, 2022

@dannyknows I had trouble using the version on nixpkgs master here. I tried simply overridding src using something like

pkgs.starship.overrideAttrs (oldAttrs: { src = ...; })

but ran into other issues, since the buildRustPackage function requires some other hashes be updated as well.

The most straightforward solution I could come up with was to copy the derivation in starship/default.nix from before the latest change. You can see how I did this on my starship.nix and import here. Hope that helps you work around it!

@malob
Copy link
Member

malob commented Feb 22, 2022

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:

error: failed to run custom build command for `mac-notification-sys v0.3.0`

Caused by:
  process didn't exit successfully: `/private/tmp/nix-build-starship-1.3.0.drv-2/source/target/release/build/mac-notification-sys-00bbbf594b92f79f/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-apple-darwin")
  CC_aarch64-apple-darwin = Some("/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/cc")
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = None
  running: "/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-fmodules" "-o" "/private/tmp/nix-build-starship-1.3.0.drv-2/source/target/aarch64-apple-darwin/release/build/mac-notification-sys-45fb4cd83161bb96/out/objc/notify.o" "-c" "objc/notify.m"
  cargo:warning=While building module 'Foundation' imported from objc/notify.h:1:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/04lkshfgbkask88qyijjla9kw7fcqn2s-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=In file included from objc/notify.m:1:
  cargo:warning=objc/notify.h:1:9: fatal error: could not build module 'Foundation'
  cargo:warning=#import <Foundation/Foundation.h>
  cargo:warning= ~~~~~~~^
  cargo:warning=While building module 'CoreServices' imported from objc/notify.h:3:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'CoreServices' imported from objc/notify.h:3:
  cargo:warning=While building module 'DiskArbitration' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h:56:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/bx8h4bl5fh5f3a639paykpz50cr8nfj6-apple-framework-DiskArbitration-11.0.0/Library/Frameworks/DiskArbitration.framework/Headers/DiskArbitration.h:27:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'CoreServices' imported from objc/notify.h:3:
  cargo:warning=While building module 'DiskArbitration' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h:56:
  cargo:warning=While building module 'IOKit' imported from /nix/store/bx8h4bl5fh5f3a639paykpz50cr8nfj6-apple-framework-DiskArbitration-11.0.0/Library/Frameworks/DiskArbitration.framework/Headers/DADisk.h:28:
  cargo:warning=In file included from <module-includes>:4:
  cargo:warning=/nix/store/vdwk5bz75dfk6rlkxns59vml7m49fs8b-apple-framework-IOKit-11.0.0/Library/Frameworks/IOKit.framework/Headers/IOCFBundle.h:26:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'CoreServices' imported from objc/notify.h:3:
  cargo:warning=While building module 'CFNetwork' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:31:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/dkr5w4p0pbrkvw9q1iamvq7f21sg779p-apple-framework-CFNetwork-11.0.0/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CoreFoundation.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'CoreServices' imported from objc/notify.h:3:
  cargo:warning=While building module 'Security' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentityBase.h:23:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=In file included from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/Security.h:27:
  cargo:warning=/nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: fatal error: could not build module 'CoreFoundation'
  cargo:warning=#include <CoreFoundation/CFBase.h>
  cargo:warning= ~~~~~~~~^
  cargo:warning=While building module 'CoreServices' imported from objc/notify.h:3:
  cargo:warning=While building module 'Security' imported from /nix/store/za8im9vfw13d73yfyxz50slga8hkp1kv-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentityBase.h:23:
  cargo:warning=While building module 'XPC' imported from /nix/store/46fa5qhxc3cafslfs10dqp3ab1vks55g-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecCode.h:35:
  cargo:warning=In file included from <module-includes>:1:
  cargo:warning=/nix/store/vb38d7pzcvp4h6w8bk7hwfckx20g9qgm-apple-lib-xpc/include/xpc/xpc.h:7:2: fatal error: module 'ObjectiveC' is defined in both '/var/folders/lv/5z88rmb15jg6zq_npz01191c00009d/C/clang/ModuleCache/1GJQEQ0BVFG7Q/ObjectiveC-Q4EHAR85586A.pcm' and '/var/folders/lv/5z88rmb15jg6zq_npz01191c00009d/C/clang/ModuleCache/1GJQEQ0BVFG7Q/ObjectiveC-ZHR6IEYWP36V.pcm'
  cargo:warning=#include <dispatch/dispatch.h>
  cargo:warning= ^
  cargo:warning=8 errors generated.
  exit status: 1

  --- stderr


  error occurred: Command "/nix/store/km02igh4pshp20d0wn89rf5jjfxcm8v5-clang-wrapper-11.1.0/bin/cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-fmodules" "-o" "/private/tmp/nix-build-starship-1.3.0.drv-2/source/target/aarch64-apple-darwin/release/build/mac-notification-sys-45fb4cd83161bb96/out/objc/notify.o" "-c" "objc/notify.m" with args "cc" did not execute successfully (status code exit status: 1).

In my case I'd guess the main line of interest is:

cargo:warning=/nix/store/vb38d7pzcvp4h6w8bk7hwfckx20g9qgm-apple-lib-xpc/include/xpc/xpc.h:7:2: fatal error: module 'ObjectiveC' is defined in both '/var/folders/lv/5z88rmb15jg6zq_npz01191c00009d/C/clang/ModuleCache/1GJQEQ0BVFG7Q/ObjectiveC-Q4EHAR85586A.pcm' and '/var/folders/lv/5z88rmb15jg6zq_npz01191c00009d/C/clang/ModuleCache/1GJQEQ0BVFG7Q/ObjectiveC-ZHR6IEYWP36V.pcm'

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 aarch64-darwin but didn't have much luck unfortunately. Maybe someone in @NixOS/darwin-maintainers, might be able to help?

@kloenk
Copy link
Member

kloenk commented Feb 22, 2022

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.

@kloenk
Copy link
Member

kloenk commented Feb 22, 2022

Every package that I could find that depends on mac-notification-sys that I could find (cargo-watch, topgrade, watchexec) does not build, all with the same error.

@kloenk
Copy link
Member

kloenk commented Feb 22, 2022

(Partly) Upstream issue: h4llow3En/mac-notification-sys#28

@kloenk
Copy link
Member

kloenk commented Feb 22, 2022

This get's it from 17 to 15 errors. But really have to sleep now.

patch
diff --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 { };

@kloenk
Copy link
Member

kloenk commented Feb 23, 2022

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.

@kkharji
Copy link
Member

kkharji commented Feb 23, 2022

I'm facing the exact issue right now 😢 with a different package depending on mac-notification-sys

@kloenk
Copy link
Member

kloenk commented Feb 23, 2022

@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 :)

@kkharji
Copy link
Member

kkharji commented Feb 23, 2022

@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.

@kloenk
Copy link
Member

kloenk commented Feb 23, 2022

Maybe you can send me your work? I think I'm still at 13 errors.

@kkharji
Copy link
Member

kkharji commented Feb 23, 2022

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

@kkharji
Copy link
Member

kkharji commented Feb 24, 2022

Okay Now I'm on 8 error with current master. with total ignorance of buildInputs. ... hacking :)

@kkharji
Copy link
Member

kkharji commented Feb 24, 2022

# Foundation # +5 errors
# CoreFoundation # No difference
# Cocoa # +15 errors
# CoreServices # No difference
Libsystem # -1 error less
# IOSurface # No difference
# Security # No difference
# CoreServices # No difference
# libiconv # No difference
# AppKit # +5 errors
# libdispatch # No difference

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:
  • 'Cocoa/Cocoa.h' file not found
  • could not build module 'CoreFoundation'
  • could not build module 'CoreFoundation'
  • could not build module 'CoreFoundation'
  • could not build module 'CoreFoundation'
  • could not build module 'CoreFoundation'
  • redefinition of module 'ObjectiveC'

🤔

@kloenk
Copy link
Member

kloenk commented Feb 24, 2022

Did not saw cocoa on my end yet I believe. Can you send the diff on the nix files?

@kkharji
Copy link
Member

kkharji commented Feb 24, 2022

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
edit: log after adding Cocoa: https://pastebin.com/nUyJmi9g

@kloenk
Copy link
Member

kloenk commented Feb 24, 2022

Hmm, libsystem should already be there as propagated input from Foundation.
Do we want to move this to matrix? (@kloenk:petabyte.dev)

jrolfs added a commit to jrolfs/macos that referenced this issue Feb 24, 2022
@lilyball
Copy link
Member

lilyball commented Mar 7, 2022

I just managed to get mac-notification-sys building as its own derivation from a checkout of the repo using the following derivation:

{ 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 NIX_CFLAGS_COMPILE to override the -fmodules in the build script. The build script could be patched instead to remove that, but I couldn't figure out how to use cc::Build::flag to link AppKit.

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 -fmodules, but surely this isn't the only package in Nix that enables Obj-C modules. I don't understand why using modules produces redeclaration errors, I'm guessing it has to do with the way stdenv is built in stages. I didn't dig too much into this but my guess at the moment is the various frameworks reference dependencies (like libobjc) from the previous stdenv stage. But again, I find it hard to believe that no other nixpkgs derivation builds Obj-C code with modules.

@lilyball
Copy link
Member

lilyball commented Mar 7, 2022

I'm also very curious as to why this issue affects just aarch64 and not x86_64.

@lilyball
Copy link
Member

lilyball commented Mar 7, 2022

Poking around at NIX_CFLAGS_COMPILE shows interesting differences on x86_64 and aarch64, but I'm not sure if these differences are meaningful. What might be meaningful though is that CoreFoundation.tbd on aarch64 references libobjc but on x86_64 it doesn't (which might be why libobjc shows up on aarch64 and not on x86_64).

@toonn
Copy link
Contributor

toonn commented Mar 10, 2022

@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.

@kloenk
Copy link
Member

kloenk commented Mar 11, 2022

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.

@lilyball
Copy link
Member

@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.

@toonn
Copy link
Contributor

toonn commented Mar 21, 2022

@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.

shrugalic added a commit to shrugalic/home-flake that referenced this issue Mar 27, 2022
Had to disable Starship for now, because it doesn't currently build on Apple Silicon
NixOS/nixpkgs#160876
@tasmo
Copy link
Contributor

tasmo commented Apr 8, 2022

Still an issue on aarch64-darwin.

@Sciencentistguy
Copy link
Member

Sciencentistguy commented Apr 8, 2022

notify-rust is actually an unused dependency of starship (afaict). Removing it allows it to build on macOS.

@nwjsmith
Copy link
Contributor

nwjsmith commented Apr 8, 2022

@Sciencentistguy do you have a PR up for that?

@lewiscowper
Copy link
Contributor

I believe notify-rust is used for the cmd_duration module, which has an option to show desktop notifications after particularly long running commands. so I doubt the maintainers would accept a PR removing it. However if you don't use that configuration option, you should be good to go with @Sciencentistguy's fork :)

Usage

@Sciencentistguy
Copy link
Member

Sciencentistguy commented Apr 8, 2022

Be aware that my fork has a few breaking changes compared to starship/starship.

Sciencentistguy added a commit to Sciencentistguy/starship that referenced this issue Apr 8, 2022
This disables the notification feature.

This is needed to support building on `aarch64-darwin` under Nix

See: NixOS/nixpkgs#160876
@Sciencentistguy
Copy link
Member

I've cherry-picked the fix onto a different branch: https://github.com/Sciencentistguy/starship/tree/fix-aarch64-darwin-nix

@happysalada
Copy link
Contributor

after the merge of rust 1.59, I tried updating starship to the latest version, and it breaks x86_64 darwin.
it needed a new framework, but the latest error is really puzzling to me

 = note: Undefined symbols for architecture x86_64:
            "_OBJC_CLASS_$_NSImage", referenced from:
                objc-class-ref in libmac_notification_sys-b1268c23b4664fa0.rlib(notify.o)
            "_LSCopyApplicationURLsForBundleIdentifier", referenced from:
                _setApplication in libmac_notification_sys-b1268c23b4664fa0.rlib(notify.o)
          ld: symbol(s) not found for architecture x86_64

#168014

I've checked and the mac-notification library has been updated recently.
Wondering if this PR fixes issues for the aarch64-darwin folks ?

@happysalada
Copy link
Contributor

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.

@ELD
Copy link

ELD commented Apr 9, 2022

@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.

@happysalada
Copy link
Contributor

I went ahead and asked upstream to make it optional again. They were cool about it.
I'm testing the build without the notify feature on my local.
you might want to check that all is good with #168558
happy to change things when we have found the problem (although I wouldn't personally spend too much time on it, it doesn't look like an easy solution).

@work-in-progress-danny
Copy link
Author

Thanks @happysalada, starship now successfully builds. I'm happy to close this off unless someone has an objection?

shrugalic added a commit to shrugalic/home-flake that referenced this issue Apr 20, 2022
work-in-progress-danny added a commit to work-in-progress-danny/dotfiles that referenced this issue Apr 21, 2022
zeenix added a commit to zeenix/starship that referenced this issue Jul 13, 2022
The reason to keep this an optional dep was a portability issue that was
fixed in Feb:

NixOS/nixpkgs#160876
@viraptor viraptor mentioned this issue Jul 26, 2022
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests