tahoe-lafs / zfec

zfec -- an efficient, portable erasure coding tool
Other
373 stars 44 forks source link

"nix build" fails with a cabal error of some sort. stack trace attached #86

Closed pmarreck closed 1 year ago

pmarreck commented 1 year ago
pmarreck  master @ c4b09f30 ?   lts-5.2 🟒 471ms
20230209123948 ~/ /zfec bash> nix build
error: builder for '/nix/store/3h88n4l57na51lfbywab56zdlhsvdhzr-fec-0.1.1.drv' failed with exit code 1;
       last 10 log lines:
       >   $, called at libraries/Cabal/Cabal/Distribution/Fields/ParseResult.hs:185:13 in Cabal-3.2.1.0:Distribution.Fields.ParseResult
       >   parseString, called at libraries/Cabal/Cabal/Distribution/Fields/ParseResult.hs:170:5 in Cabal-3.2.1.0:Distribution.Fields.ParseResult
       >   readAndParseFile, called at libraries/Cabal/Cabal/Distribution/PackageDescription/Parsec.hs:94:33 in Cabal-3.2.1.0:Distribution.PackageDescription.Parsec
       >   readGenericPackageDescription, called at libraries/Cabal/Cabal/Distribution/Simple.hs:248:19 in Cabal-3.2.1.0:Distribution.Simple
       >   confPkgDescr, called at libraries/Cabal/Cabal/Distribution/Simple.hs:216:33 in Cabal-3.2.1.0:Distribution.Simple
       >   configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.2.1.0:Distribution.Simple
       >   defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.2.1.0:Distribution.Simple
       >   defaultMain, called at Setup.lhs:3:10 in main:Main
       > Setup: Failed parsing "./fec.cabal".
       >
       For full logs, run 'nix log /nix/store/3h88n4l57na51lfbywab56zdlhsvdhzr-fec-0.1.1.drv'.

pmarreck  master @ c4b09f30 ?   lts-5.2 ❌ERROR 28s663ms
20230209124032 ~/ /zfec bash> pull
Already up to date.

pmarreck  master @ c4b09f30 ?   lts-5.2 🟒 545ms
20230209124038 ~/ /zfec bash> nix log /nix/store/3h88n4l57na51lfbywab56zdlhsvdhzr-fec-0.1.1.drv
@nix { "action": "setPhase", "phase": "setupCompilerEnvironmentPhase" }
setupCompilerEnvironmentPhase
Build with /nix/store/zaj69ac946lkj14g4ggrf6gz39hig72z-ghc-8.10.7.
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/i3m8c9907bgqjsnmvnfhx3nyms1yqj0j-rhwcbxvj0kflk7q77w0xwmpdn9y3jjxg-source
source root is rhwcbxvj0kflk7q77w0xwmpdn9y3jjxg-source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "compileBuildDriverPhase" }
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/tmp.AfluUAQBeQ/setup-package.conf.d -j16 +RTS -A64M -RTS -threaded -rtsopts
[1 of 1] Compiling Main             ( Setup.lhs, /build/tmp.AfluUAQBeQ/Main.o )
Linking Setup ...
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
configureFlags: --verbose --prefix=/nix/store/1cy7krvg4zb2ayyqfwvpvcbagbl5ysg1-fec-0.1.1 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --docdir=/nix/store/v03l5hbsxj8f5hlqagxrrfcd49mg4ka4-fec-0.1.1-doc/share/doc/fec-0.1.1 --with-gcc=gcc --package-db=/build/tmp.AfluUAQBeQ/package.conf.d --ghc-options=-j16 +RTS -A64M -RTS --disable-split-objs --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-option=-split-sections --extra-lib-dirs=/nix/store/1i5ah27gxx3a3fyjyydfwwzqq8ni33i8-ncurses-6.3-p20220507/lib --extra-lib-dirs=/nix/store/xghl0l2f6byzqvy06ana2y4isqwa7blw-libffi-3.4.4/lib --extra-lib-dirs=/nix/store/ijz81p08bp812q2bvv77lz9qpfzncibd-gmp-with-cxx-6.2.1/lib
Using Parsec parser
Warning: fec.cabal:0:0: Unsupported cabal-version 3.4. See
https://github.com/haskell/cabal/issues/4899.
Warning: fec.cabal:0:0: Unsupported cabal-version. See
https://github.com/haskell/cabal/issues/4899.
CallStack (from HasCallStack):
  $, called at libraries/Cabal/Cabal/Distribution/Fields/ParseResult.hs:185:13 in Cabal-3.2.1.0:Distribution.Fields.ParseResult
  parseString, called at libraries/Cabal/Cabal/Distribution/Fields/ParseResult.hs:170:5 in Cabal-3.2.1.0:Distribution.Fields.ParseResult
  readAndParseFile, called at libraries/Cabal/Cabal/Distribution/PackageDescription/Parsec.hs:94:33 in Cabal-3.2.1.0:Distribution.PackageDescription.Parsec
  readGenericPackageDescription, called at libraries/Cabal/Cabal/Distribution/Simple.hs:248:19 in Cabal-3.2.1.0:Distribution.Simple
  confPkgDescr, called at libraries/Cabal/Cabal/Distribution/Simple.hs:216:33 in Cabal-3.2.1.0:Distribution.Simple
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.2.1.0:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.2.1.0:Distribution.Simple
  defaultMain, called at Setup.lhs:3:10 in main:Main
Setup: Failed parsing "./fec.cabal".

pmarreck  master @ c4b09f30 ?   lts-5.2 🟒 1s940ms
pmarreck commented 1 year ago

I'm not familiar enough with Haskell to fix; was just trying to compile the commandline apps to play with zfec...

exarkun commented 1 year ago

Thank you - confirmed. I get the same build error. We should fix this (I suppose by downgrading our cabal format version).

Meanwhile, if anyone needs a workaround, this should work:

nix develop
cabal build

The Python bindings should be unaffected (since the Nix packaging doesn't even try to account for them - you just have to use pip, etc).

pmarreck commented 1 year ago

One nice thing about Nix is that the original dev being able to reproduce a build failure is highly probable instead of highly improbable, which seems to be the case in literally every other non-trivial example I've seen, lol. Glad you're reproducing it, at least. Thanks for the workaround. You may just need to pin cabal to an earlier version (or make it work with the later version, assuming that isn't too difficult)

pmarreck commented 1 year ago

silly question, how do I just get a commandline version to play with?

exarkun commented 1 year ago

The Python packaging comes with zfec and zunfec command line tools - does that help? You should also get these if you install a pre-build package (ie pip install zfec).

I'm not sure there are any command line tools that use the Haskell bindings (at least, fec.cabal doesn't seem to define any).

pmarreck commented 1 year ago

I'm running on NixOS, we declaratively install things, so pip install zfec is not really an option unfortunately, is there a way to build the python bits within the project directory using whatever tooling the flake.nix file provides?

exarkun commented 1 year ago

I'm running on NixOS, we declaratively install things, so pip install zfec is not really an option unfortunately,

Ah, indeed.

is there a way to build the python bits within the project directory using whatever tooling the flake.nix file provides?

Not currently, though this would be a nice addition to the flake, I think.

The Python bindings are actually in nixpkgs itself though, so if you install legacyPackages.x86_64-linux.python3.withPackages (ps: [ps.zfec]) then I think you'll get something usable - though it's whatever version is in your nixpkgs rather than master@HEAD. However, not much has changed in zfec in a while so unless you wanted to explore some specific recent change, maybe this is good enough?

Although, this also seems to work, if you did want master@HEAD:

legacyPackages.x86_64-linux.python3.withPackages (ps: [(ps.zfec.overrideAttrs (old: { 
    src = /path/to/zfec/checkout; 
}))])
pmarreck commented 1 year ago

Yep, got it in that way, thanks!