NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
11.45k stars 1.44k forks source link

Nix-shell always fails with CoreFoundation #5956

Open ziyincody opened 2 years ago

ziyincody commented 2 years ago

Describe the bug I'm trying to run nix-shell --pure for a project but it always fails with error

ld: file not found: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)

I wonder if anyone might have any idea what's going on? I'm using MacOS 12.0.1 with M1 chips running on Terminal Rosetta.

Here's the full log

  /nix/store/ph5n2kaiw6xg6icjnd06ywap0nhzckpg-dss-deploy-scripts-solidity-packages.drv
  /nix/store/la4r8a3wjyjjczzjcndfajbbm2j6j961-dss-deploy-scripts.drv
  /nix/store/s3w8s6f9rk59cs1z7gqb8d51kzg1s2rd-utillinux-1003.1-2008.drv
  /nix/store/mnnfkggvnrqn05c907vmdl0j5jsjxjvz-dapp2nix-2.1.7.drv
building '/nix/store/8nncdc6i3hav5i13lnqs1ydim0za0j41-ethsign-0.16.0.drv'...
unpacking sources
unpacking source archive /nix/store/a2j0995a4zpn888i4lx9yrd11k98i1r1-ethsign
source root is ethsign
patching sources
configuring
building
Building subPackage .
go: downloading gopkg.in/urfave/cli.v1 v1.20.0
go: downloading github.com/ethereum/go-ethereum v1.9.10
go: downloading golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: downloading golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7
go: downloading github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356
go: downloading github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c
go: downloading github.com/rjeczalik/notify v0.9.1
go: downloading github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea
go: downloading github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222
go: downloading github.com/go-stack/stack v1.8.0
go: downloading github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570
go: downloading github.com/VictoriaMetrics/fastcache v1.5.3
go: downloading github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa
go: downloading github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/golang/snappy v0.0.1
go: downloading github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3
go: downloading github.com/cespare/xxhash/v2 v2.1.1
github.com/ethereum/go-ethereum/common/hexutil
golang.org/x/crypto/sha3
github.com/ethereum/go-ethereum/common
github.com/ethereum/go-ethereum/common/math
runtime/cgo
# runtime/cgo
ld: file not found: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
github.com/ethereum/go-ethereum/rlp
github.com/cespare/xxhash/v2
github.com/golang/snappy
github.com/VictoriaMetrics/fastcache
github.com/aristanetworks/goarista/monotime
github.com/ethereum/go-ethereum/common/mclock
github.com/ethereum/go-ethereum/common/prque
github.com/ethereum/go-ethereum/ethdb
github.com/go-stack/stack
golang.org/x/sys/unix
github.com/steakknife/hamming
github.com/steakknife/bloomfilter
github.com/ethereum/go-ethereum/event
github.com/deckarep/golang-set
golang.org/x/crypto/pbkdf2
golang.org/x/crypto/scrypt
github.com/golang/protobuf/proto
github.com/golang/protobuf/protoc-gen-go/descriptor
github.com/ethereum/go-ethereum/accounts/usbwallet/trezor
golang.org/x/crypto/ssh/terminal
gopkg.in/urfave/cli.v1
error: builder for '/nix/store/8nncdc6i3hav5i13lnqs1ydim0za0j41-ethsign-0.16.0.drv' failed with exit code 1;
       last 10 log lines:
       > github.com/steakknife/bloomfilter
       > github.com/ethereum/go-ethereum/event
       > github.com/deckarep/golang-set
       > golang.org/x/crypto/pbkdf2
       > golang.org/x/crypto/scrypt
       > github.com/golang/protobuf/proto
       > github.com/golang/protobuf/protoc-gen-go/descriptor
       > github.com/ethereum/go-ethereum/accounts/usbwallet/trezor
       > golang.org/x/crypto/ssh/terminal
       > gopkg.in/urfave/cli.v1
       For full logs, run 'nix log /nix/store/8nncdc6i3hav5i13lnqs1ydim0za0j41-ethsign-0.16.0.drv'.
error: build of '/nix/store/8nncdc6i3hav5i13lnqs1ydim0za0j41-ethsign-0.16.0.drv', '/nix/store/ja6hi5qj3cbbvbwr92f37x504bmpy9yr-seth-0.9.4.drv', '/nix/store/jidx2wr3c1g9k53dc9avyhlxv0vp928v-dapp-0.31.1.drv', '/nix/store/la4r8a3wjyjjczzjcndfajbbm2j6j961-dss-deploy-scripts.drv', '/nix/store/mnnfkggvnrqn05c907vmdl0j5jsjxjvz-dapp2nix-2.1.7.drv', '/nix/store/pi1hdlwcr9wp4bna4j39fhm3vaw4ysld-solc-0.6.7.drv' failed
burdiyan commented 2 years ago

Similar problem here. Building from within nix-shell --pure fails for me when building with CGO with ld: framework not found CoreFoundation.

I DO have darwin.apple_sdk.frameworks.CoreFoundation specified as buildInputs in my mkShell derivation though. Also libiconv.

kkharji commented 1 year ago

Similar problem here. Building from within nix-shell --pure fails for me when building with CGO with ld: framework not found CoreFoundation.

I DO have darwin.apple_sdk.frameworks.CoreFoundation specified as buildInputs in my mkShell derivation though. Also libiconv.

Have you ever solved this?

idontgetoutmuch commented 1 year ago

I too have this problem.

budhilaw commented 1 year ago

Me too. I have this problem.

luxus commented 1 year ago

mhh its strange that nobody posted a answer yet :(

DolceTriade commented 1 year ago

I hacked this by adding -F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ to my linker flags (LDCONFIG might work...)

AtkinsChang commented 7 months ago

Add clang to your nix environment instead of using system clang