commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.95k stars 842 forks source link

Problems compiling with ghcup and older GHC #6490

Closed flip111 closed 4 months ago

flip111 commented 4 months ago

Info

» stack config set install-ghc false --global
» stack config set system-ghc false --global
» stack --version
Version 2.15.1, Git revision 427cc21fc723a039e2eefad02fa92e54f5e414f7 x86_64 hpack-0.36.0
» which stack
/home/flip111/.ghcup/bin/stack
» cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=23.10
DISTRIB_CODENAME=mantic
DISTRIB_DESCRIPTION="Ubuntu 23.10"

~/.stack/config.yaml (removed comments)

templates:
  params:

system-ghc: false
install-ghc: false

Source code attached as zip tree-sitter.zip

stack.yaml

tree-sitter/stack.yaml and tree-sitter-typescript/stack.yaml have the same LTS

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml

Problem 1: ghc & lts version (ignoring stack.yaml)

» cd tree-sitter-typescript
» stack path --verbose
2024-02-21 19:19:38.743353: [debug] Checking for project config at: /home/flip111/haskell/bug/tree-sitter-typescript/stack.yaml
2024-02-21 19:19:38.743691: [debug] Loading project config file stack.yaml
2024-02-21 19:19:38.745526: [debug] Use of Casa server enabled: (CasaRepoPrefix "https://casa.stackage.org", 1280).
2024-02-21 19:19:38.748870: [debug] (SQL) SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2024-02-20 18:19:38.748828722 UTC]
2024-02-21 19:19:38.749362: [debug] Using package location completions from a lock file
2024-02-21 19:19:38.751319: [debug] Loaded snapshot from Pantry database.
2024-02-21 19:19:38.906398: [debug] Prefetching git repos: []
2024-02-21 19:19:38.906455: [debug] []
2024-02-21 19:19:38.908398: [debug] Asking for a supported GHC version
2024-02-21 19:19:38.908451: [debug] Getting hook installed compiler version
2024-02-21 19:19:38.908586: [debug] Run process: /usr/bin/sh /home/flip111/.stack/hooks/ghc-install.sh
2024-02-21 19:19:38.920680: [debug] Process finished in 12ms: /usr/bin/sh /home/flip111/.stack/hooks/ghc-install.sh
2024-02-21 19:19:38.920739: [debug] Using GHC compiler at: /home/flip111/.ghcup/ghc/9.6.4/bin/ghc
2024-02-21 19:19:38.920795: [debug] (SQL) SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/home/flip111/.ghcup/ghc/9.6.4/bin/ghc"]
2024-02-21 19:19:38.950689: [debug] Loaded compiler information from cache
2024-02-21 19:19:38.950773: [debug] Asking for a supported GHC version
2024-02-21 19:19:38.950810: [debug] Resolving package entries
2024-02-21 19:19:38.950844: [debug] Parsing the targets
2024-02-21 19:19:38.953503: [debug] Checking flags
2024-02-21 19:19:38.953543: [debug] SourceMap constructed
2024-02-21 19:19:38.959010: [debug] Starting to execute command inside EnvConfig
snapshot-doc-root: /home/flip111/.stack/snapshots/x86_64-linux/3573b7235716f6dbfe787cb295d576e46c6a4a1ede938c3cde080129f6cbeb81/9.6.4/doc
local-doc-root: /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/3573b7235716f6dbfe787cb295d576e46c6a4a1ede938c3cde080129f6cbeb81/9.6.4/doc
local-hoogle-root: /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/hoogle/x86_64-linux/3573b7235716f6dbfe787cb295d576e46c6a4a1ede938c3cde080129f6cbeb81/9.6.4
2024-02-21 19:19:38.959819: [debug] Checking for project config at: /home/flip111/haskell/bug/tree-sitter-typescript/stack.yaml
2024-02-21 19:19:38.959867: [debug] Loading project config file stack.yaml
2024-02-21 19:19:38.960657: [debug] Use of Casa server enabled: (CasaRepoPrefix "https://casa.stackage.org", 1280).
2024-02-21 19:19:38.962656: [debug] (SQL) SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2024-02-20 18:19:38.962633423 UTC]
2024-02-21 19:19:38.963070: [debug] Using package location completions from a lock file
2024-02-21 19:19:38.965051: [debug] Loaded snapshot from Pantry database.
2024-02-21 19:19:39.111781: [debug] Prefetching git repos: []
2024-02-21 19:19:39.111840: [debug] []
2024-02-21 19:19:39.113092: [debug] Asking for a supported GHC version
2024-02-21 19:19:39.113143: [debug] Getting hook installed compiler version
2024-02-21 19:19:39.113262: [debug] Run process: /usr/bin/sh /home/flip111/.stack/hooks/ghc-install.sh
2024-02-21 19:19:39.125384: [debug] Process finished in 12ms: /usr/bin/sh /home/flip111/.stack/hooks/ghc-install.sh
2024-02-21 19:19:39.125448: [debug] Using GHC compiler at: /home/flip111/.ghcup/ghc/9.6.4/bin/ghc
2024-02-21 19:19:39.125510: [debug] (SQL) SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/home/flip111/.ghcup/ghc/9.6.4/bin/ghc"]
2024-02-21 19:19:39.155408: [debug] Loaded compiler information from cache
2024-02-21 19:19:39.155487: [debug] Asking for a supported GHC version
2024-02-21 19:19:39.155524: [debug] Resolving package entries
2024-02-21 19:19:39.155556: [debug] Parsing the targets
2024-02-21 19:19:39.157923: [debug] Checking flags
2024-02-21 19:19:39.157961: [debug] SourceMap constructed
2024-02-21 19:19:39.171294: [debug] Starting to execute command inside EnvConfig
stack-root: /home/flip111/.stack
global-config: /home/flip111/.stack/config.yaml
project-root: /home/flip111/haskell/bug/tree-sitter-typescript
config-location: /home/flip111/haskell/bug/tree-sitter-typescript/stack.yaml
bin-path: /home/flip111/.stack/snapshots/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4/bin:/home/flip111/.stack/compiler-tools/x86_64-linux/ghc-9.6.4/bin:/home/flip111/.ghcup/ghc/9.6.4/bin:/home/flip111/.nvm/versions/node/v21.6.2/bin:/home/flip111/.cargo/bin:/home/flip111/.config/composer/vendor/bin:/home/flip111/.local/bin:/home/flip111/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/flip111/.cabal/bin:/home/flip111/.ghcup/bin
programs: /home/flip111/.stack/programs/x86_64-linux
compiler-exe: /home/flip111/.ghcup/ghc/9.6.4/bin/ghc
compiler-bin: /home/flip111/.ghcup/ghc/9.6.4/bin
compiler-tools-bin: /home/flip111/.stack/compiler-tools/x86_64-linux/ghc-9.6.4/bin
local-bin: /home/flip111/.local/bin
extra-include-dirs: /home/flip111/haskell/bug/tree-sitter-typescript/vendor/tree-sitter-typescript/typescript/src, /home/flip111/haskell/bug/tree-sitter-typescript/vendor/tree-sitter-typescript/common
extra-library-dirs:
snapshot-pkg-db: /home/flip111/.stack/snapshots/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4/pkgdb
local-pkg-db: /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4/pkgdb
global-pkg-db: /home/flip111/.ghcup/ghc/9.6.4/lib/ghc-9.6.4/lib/package.conf.d
ghc-package-path: /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4/pkgdb:/home/flip111/.stack/snapshots/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4/pkgdb:/home/flip111/.ghcup/ghc/9.6.4/lib/ghc-9.6.4/lib/package.conf.d
snapshot-install-root: /home/flip111/.stack/snapshots/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4
local-install-root: /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4
dist-dir: .stack-work/dist/x86_64-linux/ghc-9.6.4
local-hpc-root: /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/ae33a97e08024a0be9b4b71a6510d0605aca9063f936e6ae7e9e1f06b158b23d/9.6.4/hpc

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

» stack build --verbose --compiler ghc-8.6.5 --resolver lts-14.27
Version 2.15.1, Git revision 427cc21fc723a039e2eefad02fa92e54f5e414f7 x86_64 hpack-0.36.0
2024-02-21 19:18:34.716454: [debug] Checking for project config at: /home/flip111/haskell/bug/tree-sitter-typescript/stack.yaml
2024-02-21 19:18:34.716671: [debug] Loading project config file stack.yaml
2024-02-21 19:18:34.717704: [debug] Use of Casa server enabled: (CasaRepoPrefix "https://casa.stackage.org", 1280).
2024-02-21 19:18:34.719857: [debug] (SQL) SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2024-02-20 18:18:34.719815829 UTC]
2024-02-21 19:18:34.726172: [debug] Using resolver: lts-14.27 specified on command line
2024-02-21 19:18:34.726220: [debug] Using package location completions from a lock file
2024-02-21 19:18:34.845325: [debug] Prefetching git repos: []
2024-02-21 19:18:34.845383: [debug] []
2024-02-21 19:18:34.846596: [debug] Asking for a supported GHC version
2024-02-21 19:18:34.846642: [debug] Getting hook installed compiler version
2024-02-21 19:18:34.846770: [debug] Run process: /usr/bin/sh /home/flip111/.stack/hooks/ghc-install.sh
2024-02-21 19:18:34.858889: [debug] Process finished in 12ms: /usr/bin/sh /home/flip111/.stack/hooks/ghc-install.sh
2024-02-21 19:18:34.858952: [debug] Using GHC compiler at: /home/flip111/.ghcup/ghc/8.6.5/bin/ghc
2024-02-21 19:18:34.859012: [debug] (SQL) SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/home/flip111/.ghcup/ghc/8.6.5/bin/ghc"]
2024-02-21 19:18:34.873568: [debug] Loaded compiler information from cache
2024-02-21 19:18:34.873646: [debug] Asking for a supported GHC version
2024-02-21 19:18:34.873681: [debug] Resolving package entries
2024-02-21 19:18:34.873716: [debug] Parsing the targets
2024-02-21 19:18:34.881133: [debug] Checking flags
2024-02-21 19:18:34.881177: [debug] SourceMap constructed
2024-02-21 19:18:34.884719: [debug] Starting to execute command inside EnvConfig
2024-02-21 19:18:34.887294: [debug] Finding out which packages are already installed
2024-02-21 19:18:34.887391: [debug] Run process: /home/flip111/.ghcup/ghc/8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2024-02-21 19:18:34.913966: [debug] Process finished in 27ms: /home/flip111/.ghcup/ghc/8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2024-02-21 19:18:34.916838: [debug] Ignoring package parsec due to wanting version 3.1.14.0 instead of 3.1.13.0
2024-02-21 19:18:34.918214: [debug] Ignoring package Cabal due to wanting version 2.4.1.0 instead of 2.4.0.1
2024-02-21 19:18:34.918623: [debug] Ignoring package haskeline due to wanting version 0.7.5.0 instead of 0.7.4.3
2024-02-21 19:18:34.919852: [debug] Run process: /home/flip111/.ghcup/ghc/8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/flip111/.stack/snapshots/x86_64-linux/e004a6a055a73bff88433c5c8aa1d0ab58363032091825a12e506cf25bdc7546/8.6.5/pkgdb dump --expand-pkgroot
2024-02-21 19:18:34.967924: [debug] Process finished in 48ms: /home/flip111/.ghcup/ghc/8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/flip111/.stack/snapshots/x86_64-linux/e004a6a055a73bff88433c5c8aa1d0ab58363032091825a12e506cf25bdc7546/8.6.5/pkgdb dump --expand-pkgroot
2024-02-21 19:18:34.973255: [debug] Run process: /home/flip111/.ghcup/ghc/8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/e004a6a055a73bff88433c5c8aa1d0ab58363032091825a12e506cf25bdc7546/8.6.5/pkgdb dump --expand-pkgroot
2024-02-21 19:18:34.992332: [debug] Process finished in 19ms: /home/flip111/.ghcup/ghc/8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/e004a6a055a73bff88433c5c8aa1d0ab58363032091825a12e506cf25bdc7546/8.6.5/pkgdb dump --expand-pkgroot
2024-02-21 19:18:34.992667: [debug] Constructing the build plan
2024-02-21 19:18:35.007776: [debug] (SQL) SELECT "id","directory","type","pkg_src","active","path_env_var","haddock" FROM "config_cache" WHERE "directory"=? AND "type"=?; [PersistText "/home/flip111/haskell/bug/tree-sitter-typescript/.stack-work/install/x86_64-linux/e004a6a055a73bff88433c5c8aa1d0ab58363032091825a12e506cf25bdc7546/8.6.5/",PersistText "lib:tree-sitter-0.9.0.3-CjT3CIE0XbuD9h5tEyOwnC"]
2024-02-21 19:18:35.008063: [debug] (SQL) SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 5]
2024-02-21 19:18:35.008204: [debug] (SQL) SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_no_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 5]
2024-02-21 19:18:35.008327: [debug] (SQL) SELECT "id", "config_cache_id", "ghc_pkg_id" FROM "config_cache_dep" WHERE ("config_cache_id"=?); [PersistInt64 5]
2024-02-21 19:18:35.008416: [debug] (SQL) SELECT "id", "config_cache_id", "component" FROM "config_cache_component" WHERE ("config_cache_id"=?); [PersistInt64 5]
2024-02-21 19:18:35.008689: [debug] Start: getPackageFiles /home/flip111/haskell/bug/tree-sitter/tree-sitter.cabal
2024-02-21 19:18:35.015802: [debug] Finished in 7ms: getPackageFiles /home/flip111/haskell/bug/tree-sitter/tree-sitter.cabal
2024-02-21 19:18:35.021420: [debug] Checking if we are going to build multiple executables with the same name
2024-02-21 19:18:35.021465: [debug] Executing the build plan
2024-02-21 19:18:35.022116: [debug] (SQL) SELECT "id","directory","type","pkg_src","active","path_env_var","haddock" FROM "config_cache" WHERE "directory"=? AND "type"=?; [PersistText "/home/flip111/haskell/bug/tree-sitter-typescript/",PersistText "config"]
2024-02-21 19:18:35.022202: [debug] (SQL) SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 6]
2024-02-21 19:18:35.022292: [debug] (SQL) SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_no_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 6]
2024-02-21 19:18:35.022349: [debug] (SQL) SELECT "id", "config_cache_id", "ghc_pkg_id" FROM "config_cache_dep" WHERE ("config_cache_id"=?); [PersistInt64 6]
2024-02-21 19:18:35.022385: [debug] (SQL) SELECT "id", "config_cache_id", "component" FROM "config_cache_component" WHERE ("config_cache_id"=?); [PersistInt64 6]
2024-02-21 19:18:35.022784: [debug] Start: getPackageFiles /home/flip111/haskell/bug/tree-sitter-typescript/tree-sitter-typescript.cabal
2024-02-21 19:18:35.024995: [debug] Finished in 2ms: getPackageFiles /home/flip111/haskell/bug/tree-sitter-typescript/tree-sitter-typescript.cabal
2024-02-21 19:18:35.042266: [info] tree-sitter-typescript> build (lib) with ghc-8.6.5
2024-02-21 19:18:35.042401: [debug] Run process within /home/flip111/haskell/bug/tree-sitter-typescript/: /home/flip111/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_6HauvNHV_2.4.0.1_ghc-8.6.5 --verbose=1 --builddir=.stack-work/dist/x86_64-linux/ghc-8.6.5 build lib:tree-sitter-typescript --ghc-options " -fdiagnostics-color=always"
2024-02-21 19:18:35.073266: [info] tree-sitter-typescript> Preprocessing library for tree-sitter-typescript-0.5.0.3..
2024-02-21 19:18:35.073360: [info] tree-sitter-typescript> Building library for tree-sitter-typescript-0.5.0.3..
2024-02-21 19:18:35.386402: [debug] Process finished in 344ms: /home/flip111/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_6HauvNHV_2.4.0.1_ghc-8.6.5 --verbose=1 --builddir=.stack-work/dist/x86_64-linux/ghc-8.6.5 build lib:tree-sitter-typescript --ghc-options " -fdiagnostics-color=always"
2024-02-21 19:18:35.386493: [debug] Start: getPackageFiles /home/flip111/haskell/bug/tree-sitter-typescript/tree-sitter-typescript.cabal
2024-02-21 19:18:35.389323: [debug] Finished in 3ms: getPackageFiles /home/flip111/haskell/bug/tree-sitter-typescript/tree-sitter-typescript.cabal
2024-02-21 19:18:35.389630: [info] tree-sitter-typescript> copy/register
2024-02-21 19:18:35.389702: [debug] Run process within /home/flip111/haskell/bug/tree-sitter-typescript/: /home/flip111/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_6HauvNHV_2.4.0.1_ghc-8.6.5 --verbose=1 --builddir=.stack-work/dist/x86_64-linux/ghc-8.6.5 copy lib:tree-sitter-typescript
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)
2024-02-21 19:18:35.413491: [debug] Checking for project config at: /home/flip111/haskell/bug/tree-sitter-typescript/stack.yaml
2024-02-21 19:18:35.413542: [debug] Loading project config file stack.yaml
2024-02-21 19:18:35.414187: [debug] Use of Casa server enabled: (CasaRepoPrefix "https://casa.stackage.org", 1280).
2024-02-21 19:18:35.415710: [debug] (SQL) SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2024-02-20 18:18:35.415693883 UTC]
2024-02-21 19:18:35.415907: [error]
Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the error:

       [S-7011]
       While building package tree-sitter-typescript-0.5.0.3 (scroll up to its section to see the error) using:
       /home/flip111/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_6HauvNHV_2.4.0.1_ghc-8.6.5 --verbose=1 --builddir=.stack-work/dist/x86_64-linux/ghc-8.6.5 copy lib:tree-sitter-typescript
       Process exited with code: ExitFailure 1

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)

» cd /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
» la
drwxr-xr-x   - flip111 21 Feb 18:48 **
.rw-r--r-- 416 flip111 21 Feb 18:48 expressions.txt

** is an empty directory. I tried to delete it and rebuild but it re-appears every time.

flip111 commented 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

mpilgrem commented 4 months ago

@flip111, Stack 2.15.1 is intended to be built only against the set of package versions defined by the 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. Strike that out - I did not read carefully what you were actually trying to build. Let me look again.

mpilgrem commented 4 months ago

@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.

flip111 commented 4 months ago

@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

mpilgrem commented 4 months ago

@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.

mpilgrem commented 4 months ago

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
mpilgrem commented 4 months ago

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.

flip111 commented 4 months ago

@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

mpilgrem commented 4 months ago

@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.

flip111 commented 4 months ago

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?

flip111 commented 4 months ago

@mpilgrem thanks for all the help. All questions are answered i will close this