Skip to content

stack builds happy again and again #3151

@nh2

Description

@nh2

We found a situation where stack seems to build the same thing over and over again.

To reproduce, use this branch: https://github.com/input-output-hk/cardano-sl/tree/vanya (commit 9f57d759) and build with

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 --fast

The build should fail at the end with a linker error (expected), and building again will build happy again:

➤ time 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 --fast
cardano-sl-core-0.4.3: unregistering (missing dependencies: derive, node-sketch, serokell-util)
cardano-sl-db-0.4.3: unregistering (missing dependencies: cardano-sl-core, node-sketch, serokell-util)
cardano-sl-infra-0.4.3: unregistering (missing dependencies: cardano-sl-core, cardano-sl-db, node-sketch, serokell-util)
cardano-sl-lrc-0.4.3: unregistering (missing dependencies: cardano-sl-core, cardano-sl-db)
cardano-sl-update-0.4.3: unregistering (missing dependencies: cardano-sl-core, cardano-sl-db, cardano-sl-infra, cardano-sl-lrc, node-sketch, serokell-util)
data-msgpack-0.0.9: unregistering (missing dependencies: groom)
derive-2.6.2: unregistering (missing dependencies: haskell-src-exts)
groom-0.1.2.1: unregistering (missing dependencies: haskell-src-exts)
haskell-src-exts-1.18.2: unregistering (missing dependencies: happy)
node-sketch-0.1.1.0: unregistering (missing dependencies: serokell-util)
serokell-util-0.1.5.0: unregistering (missing dependencies: data-msgpack)
happy-1.19.5: configure
happy-1.19.5: build
happy-1.19.5: copy/register
haskell-src-exts-1.18.2: configure
haskell-src-exts-1.18.2: build
haskell-src-exts-1.18.2: copy/register
groom-0.1.2.1: configure
groom-0.1.2.1: build
derive-2.6.2: configure
Progress: 2/13
Linking .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/cardano-analyzer/cardano-analyzer ...
Preprocessing executable 'cardano-checks' for cardano-sl-0.4.3...
Preprocessing executable 'cardano-dht-keygen' for cardano-sl-0.4.3...
Linking .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/cardano-dht-keygen/cardano-dht-keygen ...
Preprocessing executable 'cardano-genupdate' for cardano-sl-0.4.3...
Preprocessing executable 'cardano-keygen' for cardano-sl-0.4.3...
Linking .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/cardano-keygen/cardano-keygen ...
Preprocessing executable 'cardano-launcher' for cardano-sl-0.4.3...
Linking .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/cardano-launcher/cardano-launcher ...
/nix/store/5pwz6vmsmg4phpfahs904fmn6ki2vp91-binutils-2.27/bin/ld.gold: --hash-size=31: unknown option
/nix/store/5pwz6vmsmg4phpfahs904fmn6ki2vp91-binutils-2.27/bin/ld.gold: use the --help option for usage information
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
Completed 13 action(s).

--  While building package cardano-sl-0.4.3 using:
      /raid/stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0 build lib:cardano-sl exe:cardano-analyzer exe:cardano-checks exe:cardano-dht-keygen exe:cardano-genupdate exe:cardano-keygen exe:cardano-launcher exe:cardano-node exe:cardano-smart-generator exe:cardano-swagger exe:cardano-wallet exe:cardano-wallet-hs2purs exe:cardano-wallet-web-docs exe:cardano-web-docs --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
➤ time 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 --fast
cardano-sl-core-0.4.3: unregistering (missing dependencies: derive, node-sketch, serokell-util)
cardano-sl-db-0.4.3: unregistering (missing dependencies: cardano-sl-core, node-sketch, serokell-util)
cardano-sl-infra-0.4.3: unregistering (missing dependencies: cardano-sl-core, cardano-sl-db, node-sketch, serokell-util)
cardano-sl-lrc-0.4.3: unregistering (missing dependencies: cardano-sl-core, cardano-sl-db)
cardano-sl-update-0.4.3: unregistering (missing dependencies: cardano-sl-core, cardano-sl-db, cardano-sl-infra, cardano-sl-lrc, node-sketch, serokell-util)
data-msgpack-0.0.9: unregistering (missing dependencies: groom)
derive-2.6.2: unregistering (missing dependencies: haskell-src-exts)
groom-0.1.2.1: unregistering (missing dependencies: haskell-src-exts)
haskell-src-exts-1.18.2: unregistering (missing dependencies: happy)
node-sketch-0.1.1.0: unregistering (missing dependencies: serokell-util)
serokell-util-0.1.5.0: unregistering (missing dependencies: data-msgpack)
happy-1.19.5: configure
happy-1.19.5: build
happy-1.19.5: copy/register
haskell-src-exts-1.18.2: configure

In particular, it says missing dependencies: happy even though it seems to have installed it just fine before.

I think the reason is that after happy-1.19.5: copy/register, I get this:

➤ stack --nix exec -- ghc-pkg list happy
/nix/store/shv5yba4ns4ax38gvrd36rfynm9yms4i-ghc-8.0.2/lib/ghc-8.0.2/package.conf.d
    (no packages)
/raid/stack/snapshots/x86_64-linux-nix/lts-8.12/8.0.2/pkgdb
    (no packages)
/.../cardano-sl-gold/.stack-work/install/x86_64-linux-nix/lts-8.12/8.0.2/pkgdb
    (no packages)

I even checked this with a Ctrl-Z directly after happy-1.19.5: copy/register, and still had it not appear in the ghc-pkg.

Somebody else reports:

The issue does not reproduce with an older version of Stack, specifically, with Stack 1.3.2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions