Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal-helper tries to configure a component named package:setup that does not exist. #95

Closed
flip111 opened this issue Feb 5, 2020 · 2 comments

Comments

@flip111
Copy link

flip111 commented Feb 5, 2020

Hello,

we ran into an issue in another project over here haskell/haskell-ide-engine#1638 (comment)

is this something that can be fixed in cabal-helper ?

@fendor
Copy link
Contributor

fendor commented Feb 5, 2020

To add more context:
When the build-type is Custom, then cabal-helper produces a build-command such as:

cabal v2-build --with-ghc=C:\Users\flip111\AppData\Local\Programs\stack\x86_64-windows\ghc-8.6.5\bin\ghc.exe --with-ghc-pkg=C:\Users\flip111\AppData\Local\Programs\stack\x86_64-windows\ghc-8.6.5\bin\ghc-pkg.exe --with-haddock=C:\Users\flip111\AppData\Local\Programs\stack\x86_64-windows\ghc-8.6.5\bin\haddock.exe --project-file=C:\Users\flip111\haskell\cabal\cabal.project --builddir=C:\Users\flip111\haskell\cabal\dist-newstyle --only-configure cabal-install:exe:cabal cabal-install:setup

Note the last target cabal-install:setup which does not seem to exist.
Call has been produced on cabal-install. You can also reproduce the issue on a basic cabal project and adding the following lines to your *.cabal file:

build-type: Custom
custom-setup
  setup-depends: base, Cabal

EDIT: Verbose output of cabal-helper (executed with hie) on a similar project (not cabal)

cd /home/baldr/Documents/haskell/fprog; cabal v2-build --with-ghc=/home/baldr/.nix-profile/bin/ghc --with-ghc-pkg=/home/baldr/.nix-profile/bin/ghc-pkg --with-haddock=/home/baldr/.nix-profile/bin/haddock --project-file=/home/baldr/Documents/haskell/fprog/cabal.project --builddir=/home/baldr/Documents/haskell/fprog/dist-newstyle --dry-run all
Build profile: -w ghc-8.6.5 -O1
In order, the following would be built (use -v for more details):
 - fprog-0.1.0.0 (lib:fprog, exe:fprog, exe:intcode) --enable-profiling (configuration changed)
cd /home/baldr/Documents/haskell/fprog; cabal v2-build --with-ghc=/home/baldr/.nix-profile/bin/ghc --with-ghc-pkg=/home/baldr/.nix-profile/bin/ghc-pkg --with-haddock=/home/baldr/.nix-profile/bin/haddock --project-file=/home/baldr/Documents/haskell/fprog/cabal.project --builddir=/home/baldr/Documents/haskell/fprog/dist-newstyle --only-configure fprog:lib:fprog fprog:exe:fprog fprog:exe:intcode fprog:test:fprog-test fprog:setup
cabal: Unknown target 'fprog:setup'.
The package fprog has no component 'setup'.

@fendor
Copy link
Contributor

fendor commented Feb 8, 2020

The package config looks like this:

Package {pPackageName = "fprog", pSourceDir = "D:\\Privat\\Documents\\programming\\haskell\\fprog\\.", pCabalFile = CabalFile "D:\\Privat\\Documents\\programming\\haskell\\fprog\\.\\fprog.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "fprog-0.1.0.0-inplace", uPackage = Package {pPackageName = "fprog", pSourceDir = "D:\\Privat\\Documents\\programming\\haskell\\fprog\\.", pCabalFile = CabalFile "D:\\Privat\\Documents\\programming\\haskell\\fprog\\.\\fprog.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "D:\\Privat\\Documents\\programming\\haskell\\fprog\\dist-newstyle\\build\\x86_64-windows\\ghc-8.6.5\\fprog-0.1.0.0", uImpl = UnitImplV2 {uiV2ComponentNames = [ChExeName "fprog",ChSetupHsName], uiV2Components = ["fprog:exe:fprog","fprog:setup"], uiV2OnlyDependencies = False}}

Note

UnitImplV2 {uiV2ComponentNames = [ChExeName "fprog",ChSetupHsName], uiV2Components = ["fprog:exe:fprog","fprog:setup"], uiV2OnlyDependencies = False}

which contains fprog:setup

DanielG added a commit that referenced this issue May 2, 2020
Previously we would pick up Stack's Cabal version with ghc-pkg on the
global package-db. This however ignores that Stack also supports custom
Setup.hs with the Cabal version from the snapshot instead.

In cabal v2-build we have a similar problem. We used to assume that
plan.json's cabal-lib-version is used uniformly across units but this is
similarly untrue.

To fix both of these we re-stage the cabal version query to after
reconfiguring a unit, then we can just lookup the Cabal version in
setup-config.

Fixes #95
DanielG added a commit that referenced this issue May 2, 2020
Previously we would pick up Stack's Cabal version with ghc-pkg on the
global package-db. This however ignores that Stack also supports custom
Setup.hs with the Cabal version from the snapshot instead.

In cabal v2-build we have a similar problem. We used to assume that
plan.json's cabal-lib-version is used uniformly across units but this is
similarly untrue.

To fix both of these we re-stage the cabal version query to after
reconfiguring a unit, then we can just lookup the Cabal version in
setup-config.

Fixes #95
DanielG added a commit that referenced this issue May 2, 2020
Previously we would pick up Stack's Cabal version with ghc-pkg on the
global package-db. This however ignores that Stack also supports custom
Setup.hs with the Cabal version from the snapshot instead.

In cabal v2-build we have a similar problem. We used to assume that
plan.json's cabal-lib-version is used uniformly across units but this is
similarly untrue.

To fix both of these we re-stage the cabal version query to after
reconfiguring a unit, then we can just lookup the Cabal version in
setup-config.

Fixes #95
@DanielG DanielG closed this as completed in 852dbc6 May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants