haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.61k stars 691 forks source link

Cabal build targets erroneously depend on package library #7311

Open recursion-ninja opened 3 years ago

recursion-ninja commented 3 years ago

Describe the bug Cabal appears to be requiring an internal package erroneously.

The following warning is reported repeatedly for many build targets:

<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - phylogenetic-component-graph-0.3.0

To Reproduce Steps to reproduce the behavior:

$ git clone https://github.com/amnh/PCG
$ cd PCG
$ git checkout 041b803c4c9e22b95f96b13dbb89e2e3515d4ff0
$ cabal v2-build

Expected behavior No build target should depend on phylogenetic-component-graph as a dependency, however many build targets do tacitly depend on this package despite it not being specified in the build-depends stanza.

System information

Additional context I think that there is some erroneous behavior with the sub-library feature.

fgaz commented 3 years ago

Could you share a small example package that reproduces this? PCG looks pretty big

recursion-ninja commented 3 years ago

@fgaz you are correct that PCG is pretty big, but I'm unaware of what to prune while still replicating the issue.

emilypi commented 3 years ago

@fgaz for a little more context here, building exe:pcg, you get

<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - phylogenetic-component-graph-0.3.0

Where pcg depends on many internal libraries marked visibility: private that depend on sublibraries of other targets marked private as well. I would be interested to see whether it's interplay between the sublibrary feature and the visibility feature.

recursion-ninja commented 3 years ago

@fgaz I pruned about 2000 lines from the cabal file, including the exe:pcg build target. See this one-off commit f5e9793a4a75a9b293bff808bc211d557dd5e769.

To Reproduce Updated steps to reproduce the behavior:

$ git clone https://github.com/amnh/PCG
$ cd PCG
$ git checkout f5e9793a4a75a9b293bff808bc211d557dd5e769
$ cabal v2-build
fgaz commented 3 years ago

I still have to test this properly, but my guess is that the bug has been there even before visibility, but nobody used sublibraries + -Wunused-packages (and reported it) until now. I'll try a pre-visibility cabal and see if I can reproduce it

recursion-ninja commented 3 years ago

@fgaz I can attest that this behavior has been occurring for over a year with cabal-3.2. I didn't have the drive to report it until recently when I suspected that this behavior was causing a subtle, stochastic build failure. It appeared that sometimes when building, cabal tried to use a cached, older version of phylogenetic-component-graph and different build targets depended on different versions of the library (cached older, and rebuilt newer) causing "random" compilation failures when combined with CI caching.

fgaz commented 3 years ago

Can reproduce, though I had to add #include <cstdio> in lib/tcm-memo/ffi/memoized-tcm/costMatrix_{2,3}d.cpp.


When building lib:tcm with -v3 I get the following ghc invocation for Data.TCM:

/nix/store/2hbvdy7mksj85pynf6qfcs2i409z4wsc-ghc-8.10.3-with-packages/bin/ghc-8.10.3 --make -fbuilding-cabal-package -O -static -dynamic-
too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir /home/fgaz/src/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-gra
ph-0.3.0/l/tcm/build/tcm -odir /home/fgaz/src/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/b
uild/tcm -hidir /home/fgaz/src/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/tcm -stubd
ir /home/fgaz/src/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/tcm -i -i/home/fgaz/src
/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/tcm -ilib/core/ffi -ilib/core/tcm/src -i
/home/fgaz/src/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/tcm/autogen -i/home/fgaz/s
rc/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/global-autogen -I/home/fgaz/src/PCG/di
st-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/tcm/autogen -I/home/fgaz/src/PCG/dist-newstyle/
build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/global-autogen -I/home/fgaz/src/PCG/dist-newstyle/build/x86
_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/tcm -Ilib/core/ffi/external-direct-optimization -I/home/fgaz/src/PCG
/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/lib/core/ffi/external-direct-optimization -o
ptP-include -optP/home/fgaz/src/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/build/tcm/autog
en/cabal_macros.h -this-unit-id phylogenetic-component-graph-0.3.0-inplace-tcm -hide-all-packages -Wmissing-home-modules -no-user-packag
e-db -package-db /home/fgaz/.cabal/store/ghc-8.10.3/package.db -package-db /home/fgaz/src/PCG/dist-newstyle/packagedb/ghc-8.10.3 -packag
e-db /home/fgaz/src/PCG/dist-newstyle/build/x86_64-linux/ghc-8.10.3/phylogenetic-component-graph-0.3.0/l/tcm/package.conf.inplace -packa
ge-id QuickCheck-2.14.2-emyW1cBTLx2Wxf2sOiMGt -package-id base-4.14.1.0 -package-id binary-0.8.8.0 -package-id containers-0.6.2.1 -packa
ge-id deepseq-1.4.4.0 -package-id mono-traversable-1.0.15.1-5eUG8bW0oxfC6mpkJ0j31e -package-id phylogenetic-component-graph-0.3.0-inplac
e-exportable -package-id phylogenetic-component-graph-0.3.0-inplace-serialize -package-id phylogenetic-component-graph-0.3.0-inplace-tcm
-memo -package-id phylogenetic-component-graph-0.3.0-inplace-utility -package-id vector-0.12.1.2-Er1osMTlX5h9hWLBm7Vdrw -package-id vect
or-binary-instances-0.2.5.1-Fei5GPUPJTvHmxCRFmSBMk -XHaskell2010 Data.MetricRepresentation Data.TCM Data.TCM.Dense Data.TCM.Internal Dat
a.TCM.Dense.FFI -O2 -fexcess-precision -fexpose-all-unfoldings -flate-specialise -foptimal-applicative-do -fspecialize-aggressively -fst
atic-argument-transformation '-fdiagnostics-color=always' -fhide-source-paths -j -Wall -Wcompat -Wdodgy-foreign-imports -Wduplicate-expo
rts -Wempty-enumerations -Widentities -Wincomplete-patterns -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissed-specialisatio
ns -Wmissing-deriving-strategies -Wmissing-fields -Wmissing-home-modules -Wmissing-monadfail-instances -Wmissing-signatures -Wnoncanonic
al-monad-instances -Wnoncanonical-monoid-instances -Woverflowed-literals -Woverlapping-patterns -Wredundant-constraints -Wsemigroup -Wta
bs -Wunrecognised-warning-flags -Wunused-binds -Wunused-do-bind -Wunused-foralls -Wunused-imports -Wunused-matches -Wwrong-do-bind -Wder
iving-defaults -Wunused-packages -hide-all-packages -fwrite-ide-info '-hiedir=.hie'

And I also get the warning

<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - phylogenetic-component-graph-0.3.0
      - phylogenetic-component-graph-0.3.0

But the -package-id flags are:

-package-id QuickCheck-2.14.2-emyW1cBTLx2Wxf2sOiMGt
-package-id base-4.14.1.0
-package-id binary-0.8.8.0
-package-id containers-0.6.2.1
-package-id deepseq-1.4.4.0
-package-id mono-traversable-1.0.15.1-5eUG8bW0oxfC6mpkJ0j31e
-package-id phylogenetic-component-graph-0.3.0-inplace-exportable
-package-id phylogenetic-component-graph-0.3.0-inplace-serialize
-package-id phylogenetic-component-graph-0.3.0-inplace-tcm-memo
-package-id phylogenetic-component-graph-0.3.0-inplace-utility
-package-id vector-0.12.1.2-Er1osMTlX5h9hWLBm7Vdrw
-package-id vector-binary-instances-0.2.5.1-Fei5GPUPJTvHmxCRFmSBMk

So to me it looks like this is a spurious warning from ghc, or the warning message cuts off a part of the id

recursion-ninja commented 3 years ago

@fgaz Would you recommend opening an GitLab issue on the GHC issue tracker and reference this GitHub issue?

Mikolaj commented 3 years ago

There are a couple at least related GHC issues opened already, e.g., https://gitlab.haskell.org/ghc/ghc/-/issues/19518

I've mentioned this issue there. Let's see what comes up from the investigation on the GHC side.

Mikolaj commented 3 years ago

@fgaz I can attest that this behavior has been occurring for over a year with cabal-3.2. I didn't have the drive to report it until recently when I suspected that this behavior was causing a subtle, stochastic build failure. It appeared that sometimes when building, cabal tried to use a cached, older version of phylogenetic-component-graph and different build targets depended on different versions of the library (cached older, and rebuilt newer) causing "random" compilation failures when combined with CI caching.

@recursion-ninja: are you sure the CI failures were with cabal 3.2? Did you perhaps see any with cabal 3.4? We suspect, in https://github.com/haskell/cabal/issues/5782#issuecomment-833866532, that the bug of depending on older build of an internal library was fixed in cabal 3.2, so your report is worrisome.

Mikolaj commented 3 years ago

Correction: I think only cabal 3.4 fixes the wrong cached compilation of internal libraries bug for good (not only prevents a build failure, but ensures old libraries are not being linked in). @recursion-ninja: if you find any build failure or wrong compilation results with cabal 3.4, please kindly report. This is most probably unrelated to the GHC bug and much more serious (but, I hope, fixed).

recursion-ninja commented 3 years ago

@Mikolaj There were some stochastic failures in cabal-install-3.2 but I haven't observed any in cabal-install-3.4. Only the persistent, and annoying warnings about the unused library from the original issue message has lingered on to cabal-install-3.4 from my observations.

Mikolaj commented 3 years ago

@recursion-ninja: thank you for the details, it matches our latest experiments (3.2 can cause a build failure, rarely, when the old compiled version of the library erroneously linked in has different types than the new one; also, it leads to wrong results even more easily if the types agree, but values don't).

Nevertheless, let's keep the issue open until the GHC bug is fixed that causes the wrong warnings.

recursion-ninja commented 3 years ago

I may have spoken too soon regarding the stochastic build failures.

I have recently been having trouble reliably building text-show when it is a dependency of my bv-little library which uses internal libraries extensively.

Steps to reproduce (stochastically):

~$ git clone https://github.com/recursion-ninja/bv-little/ build-failure-example
~$ cd build-failure-example
~$ git checkout 62d9d4408f0942284e009e994303455c6f033940
~$ cabal build --with-compiler=ghc-9.0.1 --verbose=3

Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
 - bv-little-1.2.0 (lib:core) (first run)
 - text-show-3.9 (lib) (requires build)
 - bv-little-1.2.0 (lib:instances-quickcheck) (first run)
 - bv-little-1.2.0 (lib:instances-mono-traversable) (first run)
 - bv-little-1.2.0 (lib:instances-binary) (first run)
 - bv-little-1.2.0 (lib) (first run)
 - bv-little-1.2.0 (lib:instances-text-show) (first run)
 - bv-little-1.2.0 (lib:instances-mono-traversable-keys) (first run)
 - bv-little-1.2.0 (lib:instances) (first run)

< ... snip ... >

Preprocessing library 'instances-mono-traversable-keys' for bv-little-1.2.0..
Building library 'instances-mono-traversable-keys' for bv-little-1.2.0..
[1 of 1] Compiling Data.BitVector.LittleEndian.MonoKeyed ( src/keys/Data/BitVector/LittleEndian/MonoKeyed.hs, /home/washburn/Code/build-failure-example/dist-newstyle/build/x86_64-linux/ghc-9.0.1/bv-little-1.2.0/l/instances-mono-traversable-keys/build/instances-mono-traversable-keys/Data/BitVector/LittleEndian/MonoKeyed.o, /home/washburn/Code/build-failure-example/dist-newstyle/build/x86_64-linux/ghc-9.0.1/bv-little-1.2.0/l/instances-mono-traversable-keys/build/instances-mono-traversable-keys/Data/BitVector/LittleEndian/MonoKeyed.dyn_o )
cabal: Failed to build text-show-3.9 (which is required by lib:instances from
bv-little-1.2.0). The build process terminated with exit code -6
Mikolaj commented 3 years ago

Minus six, you say? At least that looks different than the failures from #5782, so I'm not reopening that (yet). Will try to reproduce and look at -v2, etc.

Mikolaj commented 3 years ago

Can't repro with cabal 3.5 from master branch. Which cabal is this? Can you reproduce with freshly built cabal?

recursion-ninja commented 3 years ago
~$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
~$ cabal build --with-compiler=ghc-9.0.1 --verbose=2
this build was affected by the following (project) config files:
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built:
 - text-show-3.9 (lib) (requires build)
 - bv-little-1.2.0 (lib:instances-text-show) (first run)
 - bv-little-1.2.0 (lib:instances) (first run)
creating /home/washburn/Code/build-failure-example/dist-newstyle/build
creating /home/washburn/Code/build-failure-example/dist-newstyle/tmp
Extracting
/home/washburn/.cabal/packages/hackage.haskell.org/text-show/3.9/text-show-3.9.tar.gz
to /home/washburn/Code/build-failure-example/dist-newstyle/tmp/src-809937...
Updating text-show.cabal with the latest revision from the index.
creating
/home/washburn/Code/build-failure-example/dist-newstyle/tmp/src-809937/text-show-3.9/dist
Starting     text-show-3.9 (lib)
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","configure","--verbose=2","--builddir=dist","--ghc","--prefix=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1","--bindir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/bin","--libdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/lib","--libsubdir=","--dynlibdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/lib","--libexecdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/libexec","--libexecsubdir=","--datadir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share","--datasubdir=","--docdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share/doc","--htmldir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share/doc/html","--haddockdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share/doc/html","--sysconfdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/etc","--enable-library-vanilla","--disable-library-profiling","--enable-shared","--disable-static","--disable-executable-dynamic","--disable-executable-static","--disable-profiling","--profiling-detail=default","--library-profiling-detail=default","--enable-optimization","--disable-debug-info","--disable-library-for-ghci","--disable-split-sections","--disable-split-objs","--disable-executable-stripping","--disable-library-stripping","--package-db=clear","--package-db=global","--package-db=/home/washburn/.cabal/store/ghc-9.0.1/package.db","--flags=base-4-9","--flags=new-functor-classes","--flags=template-haskell-2-11","--cid=text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1","--extra-prog-path=/home/washburn/.cabal/bin","--dependency=array=array-0.5.4.0","--dependency=base=base-4.15.0.0","--dependency=base-compat-batteries=base-compat-batteries-0.11.2-3668f05977e9f28af807b0b0ce703398b4ed8e38dba77c2db5c0abf39b120f8c","--dependency=bifunctors=bifunctors-5.5.11-2a3841d53457ffc1384c87930764a68d23b0847db853b89257d3078136df7f30","--dependency=bytestring=bytestring-0.10.12.1","--dependency=bytestring-builder=bytestring-builder-0.10.8.2.0-f1fc0db34ded57ac80a7a16014cd0244372b73c4501aa1b8f94948da8ee98daa","--dependency=containers=containers-0.6.4.1","--dependency=generic-deriving=generic-deriving-1.14-60cf634e0d5e72a427899f654aec208994b91f68d01fb801568599238e6072e6","--dependency=ghc-boot-th=ghc-boot-th-9.0.1","--dependency=ghc-prim=ghc-prim-0.7.0","--dependency=integer-gmp=integer-gmp-1.1","--dependency=template-haskell=template-haskell-2.17.0.0","--dependency=text=text-1.2.4.1","--dependency=th-abstraction=th-abstraction-0.4.2.0-97bfd77d8a680b19c286c078730c0f3ae84c5d9a6ac20db1acc36cdd9250e6d4","--dependency=th-lift=th-lift-0.8.2-0fa84c263173fc179670fe14cfd1a7e9068a8c3619afca23dfafbdaecc45d44b","--dependency=transformers=transformers-0.5.6.2","--dependency=transformers-compat=transformers-compat-0.6.6-5b8dcd1799d8b869b303cd54c9e5f8e0e781d80c42b5cdde1476265310540ee2","--disable-coverage","--exact-configuration","--with-ghc=/opt/ghc/bin/ghc-9.0.1","--with-ghc-pkg=/opt/ghc/bin/ghc-pkg-9.0.1","--ghc-option=-hide-all-packages","lib:text-show"]
/opt/cabal/3.4/bin/cabal act-as-setup --build-type=Simple -- configure
--verbose=2 --builddir=dist --ghc
--prefix=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1
--bindir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/bin
--libdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/lib
--libsubdir=
--dynlibdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/lib
--libexecdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/libexec
--libexecsubdir=
--datadir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share
--datasubdir=
--docdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share/doc
--htmldir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share/doc/html
--haddockdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/share/doc/html
--sysconfdir=/home/washburn/.cabal/store/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1/etc
--enable-library-vanilla --disable-library-profiling --enable-shared
--disable-static --disable-executable-dynamic --disable-executable-static
--disable-profiling --profiling-detail=default
--library-profiling-detail=default --enable-optimization --disable-debug-info
--disable-library-for-ghci --disable-split-sections --disable-split-objs
--disable-executable-stripping --disable-library-stripping --package-db=clear
--package-db=global
--package-db=/home/washburn/.cabal/store/ghc-9.0.1/package.db --flags=base-4-9
--flags=new-functor-classes --flags=template-haskell-2-11
--cid=text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1
--extra-prog-path=/home/washburn/.cabal/bin --dependency=array=array-0.5.4.0
--dependency=base=base-4.15.0.0
--dependency=base-compat-batteries=base-compat-batteries-0.11.2-3668f05977e9f28af807b0b0ce703398b4ed8e38dba77c2db5c0abf39b120f8c
--dependency=bifunctors=bifunctors-5.5.11-2a3841d53457ffc1384c87930764a68d23b0847db853b89257d3078136df7f30
--dependency=bytestring=bytestring-0.10.12.1
--dependency=bytestring-builder=bytestring-builder-0.10.8.2.0-f1fc0db34ded57ac80a7a16014cd0244372b73c4501aa1b8f94948da8ee98daa
--dependency=containers=containers-0.6.4.1
--dependency=generic-deriving=generic-deriving-1.14-60cf634e0d5e72a427899f654aec208994b91f68d01fb801568599238e6072e6
--dependency=ghc-boot-th=ghc-boot-th-9.0.1
--dependency=ghc-prim=ghc-prim-0.7.0 --dependency=integer-gmp=integer-gmp-1.1
--dependency=template-haskell=template-haskell-2.17.0.0
--dependency=text=text-1.2.4.1
--dependency=th-abstraction=th-abstraction-0.4.2.0-97bfd77d8a680b19c286c078730c0f3ae84c5d9a6ac20db1acc36cdd9250e6d4
--dependency=th-lift=th-lift-0.8.2-0fa84c263173fc179670fe14cfd1a7e9068a8c3619afca23dfafbdaecc45d44b
--dependency=transformers=transformers-0.5.6.2
--dependency=transformers-compat=transformers-compat-0.6.6-5b8dcd1799d8b869b303cd54c9e5f8e0e781d80c42b5cdde1476265310540ee2
--disable-coverage --exact-configuration --with-ghc=/opt/ghc/bin/ghc-9.0.1
--with-ghc-pkg=/opt/ghc/bin/ghc-pkg-9.0.1 --ghc-option=-hide-all-packages
lib:text-show
Redirecting build log to {handle:
/home/washburn/.cabal/logs/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1.log}
Building     text-show-3.9 (lib)
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","build","--verbose=2","--builddir=dist"]
/opt/cabal/3.4/bin/cabal act-as-setup --build-type=Simple -- build --verbose=2
--builddir=dist
Redirecting build log to {handle:
/home/washburn/.cabal/logs/ghc-9.0.1/text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1.log}

cabal: Failed to build bv-little-1.2.0 because it depends on bv-little-1.2.0
which itself failed to build.
Failed to build bv-little-1.2.0 because it depends on bv-little-1.2.0 which
itself failed to build.
Failed to build
text-show-3.9-1c0b77428d674d55ebab618604083c67131ca43d62e921be59552424959ef7c1.
The build process terminated with exit code -6
recursion-ninja commented 3 years ago

Can you reproduce with freshly built cabal?

@Mikolaj I can try rebuilding with a freshly built version of cabal-install. Should I try version cabal-install-3.5 by cloning this repository and building cabal-install?

Mikolaj commented 3 years ago

Great. Yes, master branch is fine. And yes, building cabal-install is enough, just as it says in https://github.com/haskell/cabal/blob/master/README.md.

recursion-ninja commented 3 years ago

Same -6 error code with cabal-install-3.5.0.0. I didn't read through the -v2 logs to see if there was any noticeable difference.

Here is a Gist transcript of the -v2 output when running the replication instructions above.

Mikolaj commented 3 years ago

I've repeated the build, with newest cabal and again, I can't find any "Failure" or "Error" when running with --verbose=3 nor with normal settings. Perhaps there is something wrong in your ~/.cabal/config or your store? Here's log from normal verbosity run with a fresh store, cabal --upgrade-dependencies --store-dir=/home/mikolaj/r/test2/st243 -j6 build >& logS

https://gist.github.com/Mikolaj/4ab6deaf65c0906df6163592bf50a5ce

recursion-ninja commented 3 years ago

@Mikolaj Is there some way I could attempt to debug a potential problem with in my cabal store or ~/.cabal/config? I deleted my ~/.cabal/{log,package,store} directories and tried to rebuild which resulted in the same -6 error code when building with cabal-3.4 and cabal-3.5.

Mikolaj commented 3 years ago

@recursion-ninja: running with an external store, as in my example command (--store-dir), is enough to rule out store problems. As for the config, try backing it up and moving away, cabal will tell you it's generating the default ~/.cabal/config and this is the one I use. I'm running this on Linux (ancient Ubuntu 16.04), in case it's a linker error. But quick googling for -6 with GHC hints it may be OOM or something else low level. Does your VM have enough RAM?

recursion-ninja commented 3 years ago

@Mikolaj Definately not running out of memory when building. However, after some digging, I found that it appears that "stack smashing" is occuring. I created a more specialized ticket as the problem does not seem to be related to the original issue.

See #7456.

Mikolaj commented 3 years ago

The erroneous "were not needed for compilation" warning from the start of this ticket is most probably fixed in GHC HEAD in https://gitlab.haskell.org/ghc/ghc/-/commit/aef7d51350feebfb29a011361d03b249049a2a0b