hackage-server icon indicating copy to clipboard operation
hackage-server copied to clipboard

flag minimal does not build

Open andreabedini opened this issue 2 years ago • 5 comments

Distribution.Server.Features.Browse brings in Distribution.Server.Features.Search which is gated by if !flag(minimal). Apparently GHC is happy with that and will keep loading those modules, but then build fails later on because of the tokenize dep and libstemmer_c which are brought in only if !flag(mimimal).

I tried defining a Distribution.Server.Features.Search.Stub but I still had issues elsewhere and in the end I gave up.

andreabedini avatar Jan 31 '23 06:01 andreabedini

❯ cabal configure --flags=minimal

❯ cat cabal.project.local 
ignore-project: False
flags: +minimal

❯ cabal build 
Resolving dependencies...
Build profile: -w ghc-9.2.5 -O1
In order, the following will be built (use -v for more details):
 - hackage-server-0.5.1 (lib:lib-server) (configuration changed)
 - hackage-server-0.5.1 (exe:hackage-server) (configuration changed)
 - hackage-server-0.5.1 (exe:hackage-mirror) (configuration changed)
 - hackage-server-0.5.1 (exe:hackage-build) (configuration changed)
Configuring library 'lib-server' for hackage-server-0.5.1..
Preprocessing library 'lib-server' for hackage-server-0.5.1..
Building library 'lib-server' for hackage-server-0.5.1..

<no location info>: warning: [-Wmissing-home-modules]
    These modules are needed for compilation but not listed in your .cabal file's other-modules: 
        Distribution.Server.Features.AdminLog
        Distribution.Server.Features.BuildReports
        Distribution.Server.Features.BuildReports.Backup
        Distribution.Server.Features.BuildReports.BuildReport
        Distribution.Server.Features.BuildReports.BuildReports
        Distribution.Server.Features.BuildReports.State
        Distribution.Server.Features.Distro
...
src/Distribution/Server/Features/Search/ExtractDescriptionTerms.hs:14:1: error:
    Could not load module ‘NLP.Tokenize’
    It is a member of the hidden package ‘tokenize-0.3.0’.
    Perhaps you need to add ‘tokenize’ to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
14 | import qualified NLP.Tokenize as NLP
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: cabal: Failed to build lib:lib-server from hackage-server-0.5.1 (which
is required by exe:hackage-server from hackage-server-0.5.1,
exe:hackage-mirror from hackage-server-0.5.1 and others).

andreabedini avatar Jan 31 '23 06:01 andreabedini

Thanks for the report! I think at this point we can consider removing those elements from behind the minimal flag, since they're no longer reliant on an additional system library being installed. Alternately, maybe we should remove the flag altogether? Not sure how important/useful it is anymore...

gbaz avatar Jan 31 '23 18:01 gbaz

Thanks @gbaz. I enabled the flag because I noticed HLS was lagging a bit with so many modules and I only needed to work on core features. I can submit a PR to remove the flag althogheter if you think it's the right thing to do.

andreabedini avatar Feb 01 '23 06:02 andreabedini