commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
4k stars 843 forks source link

stack clean mypackage does not wipe git-based extra-dep #3152

Closed nh2 closed 5 years ago

nh2 commented 7 years ago

stack --version Version 1.4.1, Git revision 45e2ba52a08b235ef1a6421e73bbbe7255014796 (4759 commits) x86_64 hpack-0.17.0

In cardano-sl (commit e52b75523), we have:

- location:
    git: https://github.com/input-output-hk/plutus-prototype
    commit: e2e2711e6978002279b4d7c49cab1aff47a2fd43
  extra-dep: true

When trying to do a --profile build I got a linker error like this (full output here):

Preprocessing executable 'cardano-keygen' for cardano-sl-0.4.4...
Linking .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/cardano-keygen/cardano-keygen ...
/home/niklas/fpco/iohk/cardano-sl/.stack-work/install/x86_64-linux-nix/lts-8.5/8.0.2/lib/x86_64-linux-ghc-8.0.2/plutus-prototype-0.1.0.0-9SIrBSFzLivCcpGO8kdYUw/libHSplutus-prototype-0.1.0.0-9SIrBSFzLivCcpGO8kdYUw_p.a(Integration.p_o):(.text+0x293c): undefined reference to `plutuszmprototypezm0zi1zi0zi0zm9SIrBSFzzLivCcpGO8kdYUw_PlutusziParser_parseProgram_C1zfD_cc'
/home/niklas/fpco/iohk/cardano-sl/.stack-work/install/x86_64-linux-nix/lts-8.5/8.0.2/lib/x86_64-linux-ghc-8.0.2/plutus-prototype-0.1.0.0-9SIrBSFzLivCcpGO8kdYUw/libHSplutus-prototype-0.1.0.0-9SIrBSFzLivCcpGO8kdYUw_p.a(Integration.p_o):(.text+0x38af): undefined reference to `plutuszmprototypezm0zi1zi0zi0zm9SIrBSFzzLivCcpGO8kdYUw_PlutusziParser_parseProgram_C1zfD_cc'

So I'm trying to build plutus-prototype again. But I noticed that stack clean plutus-prorotype doesn't seem to wipe the cloned git directory; the

plutus-prototype-0.1.0.0: configure (lib)
plutus-prototype-0.1.0.0: build (lib)
plutus-prototype-0.1.0.0: copy/register

completes almost immediately (between build and register), hinting at an incremental compilation despite my clean.

Even more obviously, it didn't re-clone, so the directory was never removed.

Full example:

➤ time /home/niklas/src/haskell/stack/.stack-work/install/x86_64-linux/lts-8.5/8.0.2/bin/stack --nix clean plutus-prototype
0.12user 0.02system 0:00.14elapsed 109%CPU (0avgtext+0avgdata 94800maxresident)k
8inputs+0outputs (1major+16022minor)pagefaults 0swaps

➤ time /home/niklas/src/haskell/stack/.stack-work/install/x86_64-linux/lts-8.5/8.0.2/bin/stack --nix build '--ghc-options=-Wwarn +RTS -A2G -n4m -RTS' --test --no-haddock-deps --bench --jobs=4 --flag cardano-sl-core:-dev-mode --no-run-tests --no-run-benchmarks cardano-sl:cardano-node --profile
cardano-sl-core-0.4.4: unregistering
cardano-sl-db-0.4.4: unregistering
cardano-sl-infra-0.4.4: unregistering
cardano-sl-lrc-0.4.4: unregistering
cardano-sl-update-0.4.4: unregistering
plutus-prototype-0.1.0.0: configure (lib)
plutus-prototype-0.1.0.0: build (lib)
plutus-prototype-0.1.0.0: copy/register

➤ find . -name '*plutus-prototype*'
...
./.stack-work/downloaded/XNE9sXB7eSlZ/plutus-prototype.cabal
...

➤ mv ./.stack-work/downloaded/XNE9sXB7eSlZ ./.stack-work/downloaded/XNE9sXB7eSlZ.old

➤ time /home/niklas/src/haskell/stack/.stack-work/install/x86_64-linux/lts-8.5/8.0.2/bin/stack --nix build '--ghc-options=-Wwarn +RTS -A2G -n4m -RTS' --test --no-haddock-deps --bench --jobs=4 --flag cardano-sl-core:-dev-mode --no-run-tests --no-run-benchmarks cardano-sl:cardano-node --profile
Cloning into '/home/niklas/fpco/iohk/cardano-sl/.stack-work/downloaded/XNE9sXB7eSlZ'...

Above we can see that only after removing ./.stack-work/downloaded/XNE9sXB7eSlZ the re-clone happens, and then the build step takes longer, as expected. And it fixed my linker error.

nh2 commented 7 years ago

CC @neongreen

enolan commented 7 years ago

I'm seeing this as well.

snoyberg commented 5 years ago

With the Pantry code on master, this issue is no longer relevant. Git cloned directories are always temporary and deleted immediately.