Closed jneira closed 2 years ago
can i see the stack.yaml
please and i presume the build compiler is 9.0.2? does adding
flags:
ghc-lib-parser-ex:
auto: false
no-ghc-lib: false
help?
thanks for the fast response
yeah we are using compiler: ghc-9.0.2
in our stack.yaml (https://github.com/jneira/haskell-language-server/blob/ghc-9.0.2/stack-9.0.2.yaml)
will try those flags, thanks for the tip!
i've reproduced it. the issue is having ghc-boot-9.0.1
in the extra-deps
. it conflicts perfectly with symbols in ghc-lib-parser-ex
Afair I had to use that cause I got errors with ghc-boot-9.2.1 and ghc-boot-9.0.2 was not available
Otoh in the error it mentions ghc-boot-9.0.2 (and originally defined in ‘ghc-boot-9.0.2:GHC.Platform’
) so I thought the build was using it somewhat
i expect (wrong - see below) but the point is the presence of this allow-newer:true
is why ghc-boot
is upgrading to ghc-9.0.2
extra-dep
is what is creating the problem.
(1) if you download https://hackage.haskell.org/package/ghc-lib-parser-ex-9.0.0.6/ghc-lib-parser-ex-9.0.0.6.tar.gz
(2) then stack build
with this stack.yaml
resolver: nightly-2022-01-10
packages:
- .
extra-deps:
- ghc-boot-9.0.1
allow-newer: true
this conflict results. if instead you write
resolver: nightly-2022-01-10
packages:
- .
it builds ok.
i think i get it. auto
is on by default and the build compiler is 9.0.2. so this stanza applies
if flag(auto) && impl(ghc >= 9.0.0) && impl(ghc < 9.1.0)
build-depends:
ghc == 9.0.*,
ghc-boot-th,
ghc-boot
ghc-boot-9.0.2 is shipped with ghc-9.0.2 and linked in. extra-deps is injecting ghc-9.0.1
from hackage into the mix and they are in conflict somehow? anyway removing ghc-boot-9.0.1 from extra-deps fixes it and since that library (actually, ghc-boot-9.0.2) ships with the build compiler it begs the question of why it is there (in extra-deps
) in the first place?
writing
flags:
ghc-lib-parser-ex:
auto: false
no-ghc-lib: false
"fixes" it because now this is the stanza involved,
build-depends:
ghc-lib-parser
ghc-boot is not linked. ghc-lib-parser-ex is forced to bind to ghc-lib-parser for all versions of build compiler and never ghc-boot
Hi, i am trying again all the steps i did before reach ghc-boot-9.0.1:
In the dependencies for ghc-lib-parser-ex-9.0.0.6:
ghc-boot needed, but this GHC boot package has been pruned (issue #4510); you need to add the
package explicitly to extra-deps (latest matching version is 9.2.1)
needed due to hls-hlint-plugin-1.0.2.1 -> ghc-lib-parser-ex-9.0.0.6
....
Some different approaches to resolving this:
* Recommended action: try adding the following to your extra-deps in D:\hls\stack-9.0.2.yaml:
- ghc-boot-9.2.1@sha256:a9360b160d72d567d06d0e4bac35f1d2866eeb4f13c83b61b02645dfbbf49848,2795
(stack asks me to add all boot packages, not only ghc-boot, also process, time,..)
now double checking add ghc-boot-9.2.1
as suggested (although does not make much sense imo):
remove ghc-boot from extra-deps as before & try:
flags:
hlint:
ghc-lib: true
ghc-lib-parser-ex:
auto: false
no-ghc-lib: false
this forces hlint & ghc-lib-parser-ex to not link ghc (ghc-boot) but rather ghc-lib-parser.
hls-hlint-plugin-1.0.2.1
i'm relying on its cabal file supporting this flag in the same way hlint does?
looks like we want to try
flags:
hls-hlint-plugin:
ghc-lib: true
ghc-lib-parser-ex:
auto: false
no-ghc-lib: false
this section of hls-hlint-plugin-1.0.2.1
if (flag(hlint33))
-- This mirrors the logic in hlint.cabal for hlint-3.3
-- https://github.com/ndmitchell/hlint/blob/d3576de4529d8df6cca5a345f5b7e04474ff7bff/hlint.cabal#L79-L88
-- so we can make sure that we do the same thing as hlint
build-depends: hlint ^>=3.3
if (!flag(ghc-lib) && impl(ghc >=9.0.1) && impl(ghc <9.1.0))
build-depends: ghc ==9.0.*
else
build-depends:
, ghc
, ghc-lib ^>=9.0
, ghc-lib-parser-ex ^>=9.0
cpp-options: -DHLINT_ON_GHC_LIB
else
-- This mirrors the logic in hlint.cabal for hlint-3.2
-- https://github.com/ndmitchell/hlint/blob/c7354e473c7d09213c8adc3dc94bf50a6eb4a42d/hlint.cabal#L79-L88
build-depends: hlint ^>=3.2
if (!flag(ghc-lib) && impl(ghc >=8.10.1) && impl(ghc < 8.11.0))
build-depends: ghc >=8.10 && <9.0
else
build-depends:
, ghc
, ghc-lib ^>=8.10.7.20210828
, ghc-lib-parser-ex ^>=8.10
cpp-options: -DHLINT_ON_GHC_LIB
looks off. all build paths seem to include ghc that seems wrong. also, the comment indicates that it's consistent with hlint's cabal. it doesn't look like that to me
to be clear, i think
build-depends:
, ghc
, ghc-lib ^>=9.0
, ghc-lib-parser-ex ^>=9.0
should read
build-depends:
ghc-lib ^>=9.0
, ghc-lib-parser-ex ^>=9.0
for example
update: on second thoughts, this is probably intentional and fine.
hmmm and we may need all of
flags:
hlint:
ghc-lib: true
hls-hlint-plugin:
ghc-lib: true
ghc-lib-parser-ex:
auto: false
no-ghc-lib: false
i think this should work. please let me know.
it's not very satisfying but with this patch ghc-lib-parser-ex builds
diff --git a/stack-9.0.2.yaml b/stack-9.0.2.yaml
index f5579777..e8c35cb1 100644
--- a/stack-9.0.2.yaml
+++ b/stack-9.0.2.yaml
@@ -69,6 +69,7 @@ extra-deps:
- process-1.6.13.2
- time-1.12.1
- unix-2.7.2.2
+- hpc-0.6.0.3
# currently needed for ghcide>extra, etc.
allow-newer: true
@@ -85,6 +86,7 @@ configure-options:
- --disable-library-for-ghci
flags:
+
haskell-language-server:
pedantic: true
@@ -97,7 +99,13 @@ flags:
BuildExecutable: false
# Stack doesn't support automatic flags.
hls-hlint-plugin:
+ ghc-lib: true
hlint33: true
+ hlint:
+ ghc-lib: true
+ ghc-lib-parser-ex:
+ auto: false
+ no-ghc-lib: false
hyphenation:
embed: true
which maybe unblocks you a bit for now. the build later fails on ormolu though.
i was able to build hs-lint-plugin
with no boot libraries in extra deps and no cabal flags using https://gist.github.com/shayne-fletcher/9c2d5c1b0dd21b31a67673a5df084800#file-stack-yaml
i think that indicates that ghc-lib-parser-ex & hlint are sound and the problems start somewhere else in the build.
the converse build with the cabal flags forcing ghc-lib was unsuccessful.
Thanks a lot for take a look and the suggestions, will try. I wonder why this did not happened with ghc-9.0.1 (Afair).
i think that indicates that ghc-lib-parser-ex & hlint are sound and the problems start somewhere else in the build.
I see, the fact that cabal works somewhat suggested it
you're welcome. i learned a lot. for the avoidance of doubt, please do not enable flags for hlint, ghc-lib-parser-ex, hls-hlint-plugin to use ghc-lib packages as i was suggesting above as a potential workaround. afaict, that it is not a valid build mode for this project. instead, i would start with the stack.yaml that builds hls-hlint-plugin and add back targets until you find the one that induces the breakage. good luck!
now double checking add ghc-boot-9.2.1 as suggested (although does not make much sense imo):
So it turns out that it throwed a Win32 related error locally which i get to fix using another version of the Win32 lib. So ghc-boot-9.2.1 seems to be the solution indeed 🤷
Well in any case it is clear it is not related with the lib itself, thanks again!
Hi, we are trying to add support for ghc-9.0.2 in hls here: https://github.com/haskell/haskell-language-server/pull/2567 The cabal build of
ghc-lib-parser-ex-9.0.0.6
is succesful but the stack one is failing with several errors like:Errors are all related with
platform*
definitions.It may be a error in out stack.yaml but i am not getting to identify it, thanks in advance