awakesecurity / proto3-suite

Haskell Protobuf Implementation

Home Page:https://hackage.haskell.org/package/proto3-suite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nix-shell and stack build failed on macOS >= BigSur

ACJustPlay opened this issue · comments

commented

I've got the following error message when using nix-shell and stack $anyCommand.

building '/nix/store/jp3aifzklr3828kicakbxvs2xh4rfk3x-language-haskell-extract-0.2.4.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/44ifii5d1ppvq25ds63k0pw2vpsd4pj1-ghc-8.6.5.
unpacking sources
unpacking source archive /nix/store/xxwcl13sib66v7bf96gn94qp61jbvn7p-language-haskell-extract-0.2.4.tar.gz
source root is language-haskell-extract-0.2.4
setting SOURCE_DATE_EPOCH to timestamp 1359190809 of file language-haskell-extract-0.2.4/src/Language/Haskell/Extract.hs
patching sources
Run jailbreak-cabal to lift version restrictions on build inputs.
compileBuildDriverPhase
setupCompileFlags: -package-db=/private/tmp/nix-build-language-haskell-extract-0.2.4.drv-0/setup-package.conf.d -j4 -threaded
[1 of 1] Compiling Main             ( Setup.lhs, /private/tmp/nix-build-language-haskell-extract-0.2.4.drv-0/Main.o )
Linking Setup ...
ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/jp3aifzklr3828kicakbxvs2xh4rfk3x-language-haskell-extract-0.2.4.drv' failed with exit code 1
building '/nix/store/7fy2g58fw12wdhs0nmhzkh8i3y6z52rs-network-uri-2.6.2.0.drv'...
cannot build derivation '/nix/store/gq7p90yg6244p0d1w3d9jzxqv4mzlz9w-test-framework-th-0.2.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/kfblyrwdk37ahggnnvds8jdfj4cyiqbh-lens-4.17.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/9yplzxdaylrw6s0kfrn1al16s4214zl4-cabal2nix-2.15.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/v3zr7jvnw8xf8jrapnhsmwcj91qcsa4l-cabal2nix-proto3-suite.drv': 1 dependencies couldn't be built
error: build of '/nix/store/v3zr7jvnw8xf8jrapnhsmwcj91qcsa4l-cabal2nix-proto3-suite.drv' failed
(use '--show-trace' to show detailed location information)

I am using macOS 12.0.1 (Monterey) and can reproduce this error on BigSur, and it works well on Catalina. So I guess it's a problem on macOS >= BigSur?

I've also tried to update the revision to the latest commit but it's not helped :(

commented

I'm not able to reproduce. I'm also using macOS Monterey (12.2.1)

That derivation that failed should have been cached, but to double-check I forced the equivalent derivation on my system to be rebuilt:

$ nix-instantiate shell.nix --system x86_64-darwin
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/hknhnpylbfjp8vxysj4jmwah0pk3qa9i-ghc-shell-for-proto3-suite-0.5.0.drv

$ nix-store --query --requisites /nix/store/hknhnpylbfjp8vxysj4jmwah0pk3qa9i-ghc-shell-for-proto3-suite-0.5.0.drv | grep language-haskell-extract
/nix/store/3x6xmsclkrlxbv7iwh22ys7rdpn9awl8-language-haskell-extract-0.2.4-r1.cabal.drv
/nix/store/bb22b783jcs8w29lrbh1y78338bdmf2g-language-haskell-extract-0.2.4.patch.drv
/nix/store/mxa1wxkr0lzlaxxbkjrlz6cpivy3rvxj-language-haskell-extract-0.2.4.tar.gz.drv
/nix/store/5h6yldb1c56yi0bvykr17wdd7l8113xy-language-haskell-extract-0.2.4.drv

$ nix-store --realise /nix/store/5h6yldb1c56yi0bvykr17wdd7l8113xy-language-haskell-extract-0.2.4.drv
these 2 paths will be fetched (0.05 MiB download, 0.32 MiB unpacked):
  /nix/store/g8w90169li1adxsgspanb725jrkg2cyh-language-haskell-extract-0.2.4
  /nix/store/sjzbh37bljzpm8cc86v22n5vf0qpx5bf-language-haskell-extract-0.2.4-doc
copying path '/nix/store/sjzbh37bljzpm8cc86v22n5vf0qpx5bf-language-haskell-extract-0.2.4-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/g8w90169li1adxsgspanb725jrkg2cyh-language-haskell-extract-0.2.4' from 'https://cache.nixos.org'...
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/g8w90169li1adxsgspanb725jrkg2cyh-language-haskell-extract-0.2.4
/nix/store/sjzbh37bljzpm8cc86v22n5vf0qpx5bf-language-haskell-extract-0.2.4-doc

$ nix-store --realise /nix/store/5h6yldb1c56yi0bvykr17wdd7l8113xy-language-haskell-extract-0.2.4.drv --check
… # Build succeeds

On macOS 12.5 using nix (Nix) 2.10.3 with commit d002df8 I get an error on zlib not being installed:

I ran nix-shell and then stack build inside that.

......
zlib                     > Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4: Missing dependency on a foreign
zlib                     > library:                                                          
zlib                     > * Missing (or bad) header file: zlib.h                            
zlib                     > * Missing (or bad) C library: z                                   
zlib                     > This problem can usually be solved by installing the system package that
zlib                     > provides this library (you may need the "-dev" version). If the library is
zlib                     > already installed but in a non-standard location then you can use the flags
zlib                     > --extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
zlib                     > library file does exist, it may contain errors that are caught by the C
zlib                     > compiler at the preprocessing stage. In this case you can re-run configure
zlib                     > with the verbosity flag -v3 to see the error messages.            
zlib                     > If the header file does exist, it may contain errors that are caught by the C
zlib                     > compiler at the preprocessing stage. In this case you can re-run configure
zlib                     > with the verbosity flag -v3 to see the error messages.            
zlib                     >            
...
Progress 78/103        

--  While building package zlib-0.6.2.3 (scroll up to its section to see the error) using:
      /Users/tsmc/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.2.1.0 configure --with-ghc=/Users/tsmc/.stack/programs/x86_64-osx/ghc-8.10.4/bin/ghc-8.10.4 --with-ghc-pkg=/Users/tsmc/.stack/programs/x86_64-osx/ghc-8.10.4/bin/ghc-pkg-8.10.4 --user --package-db=clear --package-db=global --package-db=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/pkgdb --libdir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/lib --bindir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/bin --datadir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/share --libexecdir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/libexec --sysconfdir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/etc --docdir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/doc/zlib-0.6.2.3 --htmldir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/doc/zlib-0.6.2.3 --haddockdir=/Users/tsmc/.stack/snapshots/x86_64-osx/470dbc54ae06f9ab39b0d470291d273c44954bdad2ebb864125b733ad600e547/8.10.4/doc/zlib-0.6.2.3 --dependency=base=base-4.14.1.0 --dependency=bytestring=bytestring-0.10.12.0 -f-bundled-c-zlib -f-non-blocking-ffi -f-pkg-config --exact-configuration --ghc-option=-fhide-source-paths
    Process exited with code: ExitFailure 1                                             

I could not reproduce the issue mentioned above, perhaps I didn't get far enough through the build.