input-output-hk / haskell.nix

Alternative Haskell Infrastructure for Nixpkgs
https://input-output-hk.github.io/haskell.nix
Apache License 2.0
548 stars 237 forks source link

libraries that use backpack internally get mangled #244

Open chessai opened 4 years ago

chessai commented 4 years ago

reproducible (but not minimal) example: https://github.com/andrewthad/sockets

$ git clone git@github.com:andrewthad/sockets
$ cd sockets
$ sh generate_pkgs.sh
$ nix-build -A hsPkgs.sockets.components.library

...
Configure flags:
--prefix=/nix/store/ynlb2jb9nsliw1nk1nhz5qdcfv1vsr91-sockets-0.6.0.0-lib-sockets lib:sockets --package-db=clear --package-db=/nix/store/n4b8x84pljvn0nfjlx4j49iz89ql3s56-sockets-0.6.0.0-lib-sockets-config/package.conf.d --flags=-checked --flags=-debug --flags=-example --flags=-mmsg --flags=-verbose-errors --exact-configuration --dependency=byteslice=byteslice-0.1.2.0-F47Zfa9esofCXbo7PMnWCS --dependency=bytestring=bytestring-0.10.8.2-FM1ltxfHPHB5vqt1kxm9vy --dependency=error-codes=error-codes-0.1.0.1-BnwdWuNCJQYE0yWkiE9YyF --dependency=ip=ip-1.5.1-5B1berIP21pEHGn46hcCNH --dependency=posix-api=posix-api-0.3.2.0-Lh2vA3IDimt5U57KjhJBqv --dependency=primitive-addr=primitive-addr-0.1.0.2-8eCSalZV073F7UoGx0lkbx --dependency=primitive-offset=primitive-offset-0.2.0.0-CaQvdwxuML4C4tkeW2tFNX --dependency=primitive-unlifted=primitive-unlifted-0.1.2.0-6Q8B4uX96SG5ppG3ASyzsH --dependency=sockets-datagram-receive=sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive --dependency=sockets-datagram-receive-many=sockets-0.6.0.0-Eed5MYuqQk63lsKryP1IAM-sockets-datagram-receive-many --dependency=sockets-datagram-send=sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send --dependency=sockets-internal=sockets-0.6.0.0-7lBrNZRcWKtGVWLjAMYu9r-sockets-internal --dependency=sockets-stream-bidirectional=sockets-0.6.0.0-LlXEZf85dQP35kxC5OkKlC-sockets-stream-bidirectional --dependency=sockets-stream-send=sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-stream-send --dependency=sockets-stream-send-two=sockets-0.6.0.0-3exKp3Ntlw83vfEe57so9b-sockets-stream-send-two --dependency=stm=stm-2.5.0.0-2oKC33YEmw5FLGhjz9knXu --dependency=text=text-1.2.3.1-GCSbsQArgWY8ErCWIXJbi2 --dependency=primitive=primitive-0.7.0.0-1dnnn3geFS2ay4OHCeh1E --dependency=rts=rts --dependency=ghc-heap=ghc-heap-8.6.5 --dependency=ghc-prim=ghc-prim-0.5.3 --dependency=integer-gmp=integer-gmp-1.0.2.0 --dependency=base=base-4.12.0.0 --dependency=deepseq=deepseq-1.4.4.0 --dependency=array=array-0.5.3.0 --dependency=ghc-boot=ghc-boot-8.6.5 --dependency=ghc-boot-th=ghc-boot-th-8.6.5 --dependency=pretty=pretty-1.1.3.6 --dependency=template-haskell=template-haskell-2.14.0.0 --dependency=ghc=ghc-8.6.5 --with-ghc=ghc --with-ghc-pkg=ghc-pkg --with-hsc2hs=hsc2hs --with-gcc=cc --with-ld=ld --with-ar=ar --with-strip=strip --disable-executable-stripping --disable-library-stripping --disable-library-profiling --disable-executable-profiling --docdir=/nix/store/3bil13wxddjpqwhhsh6xrkf1cy7adx8c-sockets-0.6.0.0-lib-sockets-doc/share/doc/sockets --enable-split-sections
Configuring library for sockets-0.6.0.0..
Warning: The flag --disable-executable-profiling is deprecated. Please use
--disable-profiling instead.
Error:
    The following packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used.
planned package sockets-0.6.0.0 is broken due to missing package sockets-0.6.0.0-Eed5MYuqQk63lsKryP1IAM-sockets-datagram-receive-many+IumuyKfOrTaJQGfVqjPJGW, sockets-0.6.0.0-Eed5MYuqQk63lsKryP1IAM-sockets-datagram-receive-many+FI9Cj2xkKXbFxY0roTUqDS, sockets-0.6.0.0-Eed5MYuqQk63lsKryP1IAM-sockets-datagram-receive-many+2kB0ayzUF3KFGQ2ZcAGAB6, sockets-0.6.0.0-Eed5MYuqQk63lsKryP1IAM-sockets-datagram-receive-many+30kSbT4Ai5AD1xiycCrsvY, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+GcS2F6jaw63Ij8G80ZrLbz, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+6jS7qL9RX7aCoXO2isUZcs, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+AgdiBLSE0LrHn1ealQpj1v, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+7WDPAdWJleE3cPtuD0l5H, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+6rogFyh6TiY3ZbNClkvvRT, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+6sTAU5p4a7zJ1ylYuHxa31, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+KJT5c4EcVoF8PoTIhfzR9I, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+2JnFcvfTqJFKTtJqIFTnZH, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+BMbD0mQydcwAZyA5GsmHPP, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-datagram-send+Il2HrqZAkVhGk9IelezSpe, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+B8Q5UNpguab547kektakVv, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+DVUYWwKbkh2o7IufHW02U, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+16QEoUoaHvr2x0QtyEMJLk, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+9iBbkpe9kAPE1QRFPqC6A7, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+GFO3PX9RYgY7TpzlXzXilJ, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+5l64AV4vtkCP7H2dQ3Mi2, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+DDgkT8jY73c3UOje2mEIN9, sockets-0.6.0.0-HUoO45w58b7G3wUCKj5YSi-sockets-datagram-receive+BJlKe3fl1z75gEM4mnFViH, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-stream-send+GyJZnO5K8vN1JZSIz24swX, sockets-0.6.0.0-FbulDRjY307HDat7AsOiWl-sockets-stream-send+AlGb1rwT80LLqRM0OpsSHP, sockets-0.6.0.0-LlXEZf85dQP35kxC5OkKlC-sockets-stream-bidirectional+AVNT8Qu2Qyx7CygeQuheyH, sockets-0.6.0.0-LlXEZf85dQP35kxC5OkKlC-sockets-stream-bidirectional+Bs5uizsIL3nB07817fx3Vh, sockets-0.6.0.0-LlXEZf85dQP35kxC5OkKlC-sockets-stream-bidirectional+5lXDLetrGVLCn8Of4JhCgE, sockets-0.6.0.0-LlXEZf85dQP35kxC5OkKlC-sockets-stream-bidirectional+Gf7GxrvE1H3K3eCuC195z3, sockets-0.6.0.0-3exKp3Ntlw83vfEe57so9b-sockets-stream-send-two+Gb0y0LvIpIVEizssMePBVY, sockets-0.6.0.0-3exKp3Ntlw83vfEe57so9b-sockets-stream-send-two+1nOqSkbEsz0J4k5xCICGMB

builder for '/nix/store/z4bqx92nwckzf6zy58sl5yn4b7rbc4v9-sockets-0.6.0.0-lib-sockets.drv' failed with exit code 1
error: build of '/nix/store/z4bqx92nwckzf6zy58sl5yn4b7rbc4v9-sockets-0.6.0.0-lib-sockets.drv' failed

The library builds fine with just nix-shell -p haskell.compiler.ghc865 cabal-install --run "cabal new-build".

It's also important to note that the library does build with nixpkgs' haskell infrastructure, although the dependencies end up mangled; cabal (new-)configure fails, but runhaskell succeeds.

angerman commented 4 years ago

@chessai thanks for the report.

I believe there is some loop logic missing in haskell.nix to get the right packages into the store. We had a similar issue with sub libraries; I would hope backpack is just a similar issue, and with the sub library logic in place should be rectifiable.

chessai commented 4 years ago

@angerman Your description of what's happening makes sense to me based on the error message.

Currently this is the only thing blocking me from switching to haskell.nix at work. Though, my experience with haskell.nix thus far has been extremely positive as an alternative to the default nixpkgs infrastructure, so thanks to you and everyone working on it. My coworkers (who are less nix-inclined) are very excited after I've mentioned to them its benefits over the currently painful nixpkgs situation.