Repository navigation
Closed
Labels
cabal-install: cmd/installre: flagConcerning user-defined flags in cabal filesre: user experienceUser experience (UX) issuere: v1-installIssue demonstrating the current indispensability of `v1-install`
Description
cabal install does not reinstall when user flags (-f) change. In the wild:
$ cabal install -w ghc-9.0.1 cabal-plan
...((Success))...
$ cabal-plan license-report fix-whitespace
ERROR: `cabal-plan license-report` sub-command not available! Please recompile/reinstall `cabal-plan` with the `license-report` Cabal flag activated.
Oh, forgot the -f license-report flag. Ok, then:
$ cabal install -w ghc-9.0.1 -f license-report cabal-plan
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
- cabal-plan-0.7.2.1 (lib) (requires build)
Configuring library for cabal-plan-0.7.2.1..
Preprocessing library for cabal-plan-0.7.2.1..
Building library for cabal-plan-0.7.2.1..
[1 of 1] Compiling Cabal.Plan ( src/Cabal/Plan.hs, dist/build/Cabal/Plan.o, dist/build/Cabal/Plan.dyn_o )
Installing library in /Users/abel/.cabal/store/ghc-9.0.1/incoming/new-14995/Users/abel/.cabal/store/ghc-9.0.1/cbl-pln-0.7.2.1-9877695f/lib
Warning:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: Installation might not be completed as desired! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The command "cabal install [TARGETS]" doesn't expose libraries.
* You might have wanted to add them as dependencies to your package. In this
case add "cabal-plan" to the build-depends field(s) of your package's .cabal
file.
* You might have wanted to add them to a GHC environment. In this case use
"cabal install --lib cabal-plan". The "--lib" flag is provisional: see
https://github.com/haskell/cabal/issues/6481 for more information.
$ cabal-plan license-report fix-whitespace
ERROR: `cabal-plan license-report` sub-command not available! Please recompile/reinstall `cabal-plan` with the `license-report` Cabal flag activated.
Vad fan!
So, cabal install does not reinstall executables if the flags change. Somehow in its subconscious mind, cabal notices that maybe it did not satisfy the customer fully, and issues a warning, but confuses it with a --lib installation request.
Atm, I do not know how to proceed, because --reinstall is anyway ignored:
$ cabal install -w ghc-9.0.1 -f license-report --reinstall cabal-plan
Resolving dependencies...
Up to date
Warning:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: Installation might not be completed as desired! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The command "cabal install [TARGETS]" doesn't expose libraries.
...
Reacted by Mikolaj Konarski
Metadata
Metadata
Assignees
Labels
cabal-install: cmd/installre: flagConcerning user-defined flags in cabal filesre: user experienceUser experience (UX) issuere: v1-installIssue demonstrating the current indispensability of `v1-install`
Activity
andreasabel commentedon Nov 13, 2021
Thank God for
v1-install:phadej commentedon Nov 13, 2021
Clear up your language.
Note there is an (automatic)
+exeflag incabal-plan. If it cannot be (easily) satisfied, it is turned off. Try with-fexe(or--constraint='cabal-plan +exe).EDIT: The issue automatic
+exeflag tries to solve is that solver wouldn't be restricted by exe-dependencies whencabal-planis used as a library. There areCabalissues open about per-component solving.andreasabel commentedon Nov 13, 2021
@phadej: I am sorry, but this is not easily discoverable:

There is an
exeflag here but this is by defaultEnabled. So why should I worry about it?I am not getting an alert that this flag was automatically disabled, and what the consequences of this automatic choice are.
I also did not have to supply
-fexewhen I installed without-f license-report.Flag
license-reportadds a functionality to the executable, so why should adding this flag prevent installation of the executable? This makes no sense to me.v1-installdoes not suffer from this defective behavior (in this case).I already did, this is what remained.
andreasabel commentedon Nov 13, 2021
Following the discussion, this is maybe a
cabal-planissue.phadej commentedon Nov 13, 2021
hackage-serverdevelopers hide automatic flags. i don't like the folding myself. haskell/hackage-server#963You answered it yourself: it adds functionality, and for that it adds dependencies (probably
Cabal) which forces solver to work harder. It decides to turn off automaticexeflag.There are two solutions:
-fexehack (preferable)cabal-planinto separatecabal-plan-exepackage (not nice).phadej commentedon Nov 13, 2021
Another example is
yamlpackage. Which hasno-exeflag guardingyaml2jsonandjson2yamlexecutables.Maybe I should flip the
exeflag incabal-planto byFalseby default.