Closed flip111 closed 4 months ago
» cabal build
Resolving dependencies...
Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
- tree-sitter-0.9.0.3 (lib) (requires download & build)
- tree-sitter-typescript-0.5.0.3 (lib) (first run)
Downloading tree-sitter-0.9.0.3
Downloaded tree-sitter-0.9.0.3
Starting tree-sitter-0.9.0.3 (lib)
Building tree-sitter-0.9.0.3 (lib)
Installing tree-sitter-0.9.0.3 (lib)
Completed tree-sitter-0.9.0.3 (lib)
Configuring library for tree-sitter-typescript-0.5.0.3..
Preprocessing library for tree-sitter-typescript-0.5.0.3..
Building library for tree-sitter-typescript-0.5.0.3..
[1 of 2] Compiling Paths_tree_sitter_typescript ( /home/flip111/haskell/bug/tree-sitter-typescript/dist-newstyle/build/x86_64-linux/ghc-9.4.8/tree-sitter-typescript-0.5.0.3/build/autogen/Paths_tree_sitter_typescript.hs, /home/flip111/haskell/bug/tree-sitter-typescript/dist-newstyle/build/x86_64-linux/ghc-9.4.8/tree-sitter-typescript-0.5.0.3/build/Paths_tree_sitter_typescript.o, /home/flip111/haskell/bug/tree-sitter-typescript/dist-newstyle/build/x86_64-linux/ghc-9.4.8/tree-sitter-typescript-0.5.0.3/build/Paths_tree_sitter_typescript.dyn_o )
[2 of 2] Compiling TreeSitter.TypeScript ( TreeSitter/TypeScript.hs, /home/flip111/haskell/bug/tree-sitter-typescript/dist-newstyle/build/x86_64-linux/ghc-9.4.8/tree-sitter-typescript-0.5.0.3/build/TreeSitter/TypeScript.o, /home/flip111/haskell/bug/tree-sitter-typescript/dist-newstyle/build/x86_64-linux/ghc-9.4.8/tree-sitter-typescript-0.5.0.3/build/TreeSitter/TypeScript.dyn_o )
cabal downloads tree-sitter which is not what i want ... but it also doesn't crash
@flip111, Stack 2.15.1 is intended to be built only against the set of package versions defined by the Strike that out - I did not read carefully what you were actually trying to build. Let me look again.stack.yaml
that is included in the package and with GHC 9.6.4. It is also intended to be built only with Stack, although I believe it can be built with Cabal (the tool). See the description:
field in the Cabal file and the Backwards Compatability
part of Contributing.md
- which I see now is a little out of date on the specifics.
@flip111, I see you have configured Stack not to try to use the GHC on the PATH and also not to try to install GHC if it is not available. That is a relatively unusual combination, but if you have customised Stack's GHC installation (you mention GHCup) - https://docs.haskellstack.org/en/stable/yaml_configuration/#ghc-installation-customisation - the install-ghc: false
will be ignored.
@mpilgrem i didn't want to use the system ghc (on PATH) that's why i set it to false. I want each project to use the ghc that matches the resolver. On this page https://www.haskell.org/ghcup/guide/#strategy-1-stack-hooks-new-recommended it says
By default, when the hook fails for whatever reason, stack will fall back to its own installation logic. To disable this, run stack config set install-ghc false --global.
I wanted to let ghcup download ghc and make sure stack doesn't do it, that's why i set this to false as per recommendation.
For debugging i added some tracing code between these two lines https://github.com/commercialhaskell/stack/blob/v2.15.1/src/Stack/Lock.hs#L164-L165 it looks like this
-- .. snip ..
(snap, slocCompleted, pliCompleted) <-
loadAndCompleteSnapshotRaw' debugRSL resolver slocCache pkgLocCache
let compiler = snapshotCompiler snap
snPkgs = Map.mapWithKey
(\n p h -> snapToDepPackage h n p)
(snapshotPackages snap)
traceM ">>>>>>>>>>>>>> lockCachedWanted"
traceM $ T.pack $ show $ pkgLocCache
traceM $ T.pack $ show $ compiler
traceM $ T.pack $ show $ resolver
traceM $ T.pack $ show $ slocCache
traceM $ T.pack $ show $ pkgLocCache
(wanted, prjCompleted) <- fillWanted pkgLocCache compiler snPkgs
-- .. snip ..
I get as output
>>>>>>>>>>>>>> lockCachedWanted
fromList []
WCGhc (mkVersion [9,6,4])
RSLUrl "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml" Nothing
fromList [(RSLUrl "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml" Nothing,SLUrl "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml" 2fdd7d3e54540062ef75ca0a73ca3a804c527dbf8a4cadafabf340e66ac4af40,712469)]
fromList []
I see that the used function loadAndCompleteSnapshotRaw' is in another package. I'm still trying to understand how come when i pass in 14/27.yaml
i get back version 9.6.4
. Though i have not downloaded the pantry package yet to have a look
@flip111, I don't have a full explanation yet, but something is weird with your stack.yaml.lock
file in tree-sitter-typescript
. I think if you delete it and try again with stack path
you get a different result.
When I deleted the stack.yaml.lock
file on my (Windows) system it worked as expected, and the stack.yaml.lock
file that was rebuild differed from the original. It started as:
packages: []
snapshots:
- completed:
sha256: 2fdd7d3e54540062ef75ca0a73ca3a804c527dbf8a4cadafabf340e66ac4af40
size: 712469
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml
original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml
and was rebuilt as:
packages: []
snapshots:
- completed:
sha256: 7ea31a280c56bf36ff591a7397cc384d0dff622e7f9e4225b47d8980f019a0f0
size: 524996
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml
original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml
Also, if I switch to LTS 22.11, the stack.yaml.lock
becomes:
packages: []
snapshots:
- completed:
sha256: 2fdd7d3e54540062ef75ca0a73ca3a804c527dbf8a4cadafabf340e66ac4af40
size: 712469
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/11.yaml
original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/11.yaml
So, somehow, your original stack.yaml.lock
was a mash up of the LTS 22.11 SHA256 and the LTS 14.27 URL.
@mpilgrem thanks deleting stack.yaml.lock
fixed problem 1 :smile: i think this happened because i did search and replace for the version wanting to alter stack.yaml
and also altered stack.yaml.lock
. Good to know that i shouldn't do that ^^
Problem 2 is still present. I'm debugging what could be the issue there
@flip111, I tried (a) removing the extra-include-dirs
from the stack.yaml
and (b) bumping the GHC to LTS-15.3/GHC 8.8.2. I did the latter because the **
wildcard seemed to be causing problems on my system and the current Cabal user guide says "**
wildcards are available starting in Cabal 2.4 and bug-free since Cabal 3.0". GHC 8.6.5 shipped with Cabal 2.4.0.1.
Doing that, I can stack build
without an error.
I found the cause of problem 2 (i'm not sure if it's the root cause though) in the cabal file i change
data-files: vendor/tree-sitter-typescript/typescript/src/node-types.json
, vendor/tree-sitter-typescript/typescript/corpus/**/*.txt
to
data-files: vendor/tree-sitter-typescript/typescript/src/node-types.json
, vendor/tree-sitter-typescript/typescript/corpus/common/declarations.txt
, vendor/tree-sitter-typescript/typescript/corpus/common/expressions.txt
, vendor/tree-sitter-typescript/typescript/corpus/common/functions.txt
, vendor/tree-sitter-typescript/typescript/corpus/common/types.txt
that fixes it. Cabal specifies that **
is allowed https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-data-files
Is problem 2 a cabal bug?
@mpilgrem thanks for all the help. All questions are answered i will close this
Info
~/.stack/config.yaml
(removed comments)Source code attached as zip tree-sitter.zip
stack.yaml
tree-sitter/stack.yaml
andtree-sitter-typescript/stack.yaml
have the same LTSProblem 1: ghc & lts version (ignoring stack.yaml)
Expected GHC 8.6.5 and LTS-14.27 Got GHC 9.6.4 and LTS-22.11
This also occurs while compiling (
stack build
) but i left out an example compilation for brevity.Problem 2: cabal include-dirs
CLI flags still work
from the paste above this is a relevant line
2024-02-21 19:18:35.407525: [warn] tree-sitter-typescript> /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/e004a6a055a73bff88433c5c8aa1d0ab58363032091825a12e506cf25bdc7546/8.6.5/share/x86_64-linux-ghc-8.6.5/tree-sitter-typescript-0.5.0.3/vendor/tree-sitter-typescript/typescript/corpus/common: copyFile: does not exist (No such file or directory)
**
is an empty directory. I tried to delete it and rebuild but it re-appears every time.