vscode-dev-containers icon indicating copy to clipboard operation
vscode-dev-containers copied to clipboard

Haskell - ghcup not installing correctly

Open PiotrJustyna opened this issue 1 year ago • 9 comments

Having problems using the Haskell community devcontainer. During the initial image build I'm getting the following error:

 > [dev_container_auto_added_stage_label 5/5] RUN ghcup install ghc "recommended" --set     && ghcup install cabal recommended --set     && ghcup install stack recommended --set     && ghcup install hls recommended --set     && cabal update:                             
#0 5.512 [ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /home/vscode/.ghcup/cache/ghcup-0.0.7.yaml
#0 5.660   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 5.660                                  Dload  Upload   Total   Spent    Left  Speed
100  191k  100  191k    0     0   600k      0 --:--:-- --:--:-- --:--:--  602k
#0 6.263 [ Info  ] downloading: https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-deb10-linux.tar.xz as file /home/vscode/.ghcup/tmp/ghcup-d56701088496e67c/ghc-9.2.5-x86_64-deb10-linux.tar.xz
#0 6.362   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 6.362                                  Dload  Upload   Total   Spent    Left  Speed
100  231M  100  231M    0     0  10.8M      0  0:00:21  0:00:21 --:--:-- 11.4M
#0 27.73 [ Info  ] verifying digest of: ghc-9.2.5-x86_64-deb10-linux.tar.xz
#0 30.52 [ Info  ] Unpacking: ghc-9.2.5-x86_64-deb10-linux.tar.xz to /home/vscode/.ghcup/tmp/ghcup-28fcb20a5ef12715
#0 106.2 [ Info  ] Installing GHC (this may take a while)

#0 108.6 
#0 108.6 
#0 108.6 
#0 108.6 
#0 108.6 
#0 111.6 [ Error ] Both installation and setting the tool failed. Install error was: Process "gmake" with arguments ["DESTDIR=/home/vscode/.ghcup/tmp/ghcup-625e9d3b6a1ae791",
#0 111.6 [ ...   ]                                                                                                   "install"] failed with exit code 2. 
#0 111.6 [ ...   ] Set error was: The version 9.2.5 of the tool ghc is not installed.
#0 111.6 [ Error ] Also check the logs in /home/vscode/.ghcup/logs
------
ERROR: failed to solve: executor failed running [/bin/sh -c ghcup install ghc "${GHC_VERSION}" --set     && ghcup install cabal recommended --set     && ghcup install stack recommended --set     && ghcup install hls recommended --set     && cabal update]: exit code: 3
[116203 ms] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/7n/brvdl9m17dd2v2j6xk495z3c0000gq/T/devcontainercli/container-features/0.23.2-1668525230577/Dockerfile-with-features -t vsc-haskell-sandbox-23279f8617b97768867d4d6fa0727610 --target dev_containers_target_stage --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer
[116203 ms]     at doe (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1888:1635)
[116203 ms]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[116203 ms]     at async pF (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:1973)
[116203 ms]     at async eT (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:901)
[116203 ms]     at async voe (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:2049)
[116203 ms]     at async Xf (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:3212)
[116203 ms]     at async Jae (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:15058)
[116203 ms]     at async Wae (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:14812)
[116205 ms] Exit code 1
[116207 ms] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/piotrjustyna/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/piotrjustyna/Documents/code/haskell-sandbox --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/piotrjustyna/Documents/code/haskell-sandbox --log-level debug --log-format json --config /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[116207 ms] Exit code 1

This command seems to be failing:

RUN ghcup install ghc "${GHC_VERSION}" --set \
    && ghcup install cabal recommended --set \
    && ghcup install stack recommended --set \
    && ghcup install hls recommended --set \
    && cabal update

Where "${GHC_VERSION}" is "recommended". I tried experimenting with:

  • removing the variable altogether
  • replacing it with a concrete version gf ghc (e.g. 9)

but getting errors in all scenarios.

  • VSCode Version: 1.73.1
  • Local OS Version: macOS 12.6.1
  • Local chip architecture: Apple Silicon
  • Reproduces in: Remote - Containers (only tried remote containers)
  • Name of Dev Container Definition with Issue: Haskell

Steps to Reproduce:

  1. open an empty directory in vscode
  2. cmd+shift+p -> add dev container configuration files -> Haskell community -> recommended -> Install ZSH -> no additional packages -> ok

PiotrJustyna avatar Nov 15 '22 15:11 PiotrJustyna

Hm, ok, having tried the command after a while, I am now getting a different, much more descriptive error:

------
 > [dev_container_auto_added_stage_label 4/5] RUN mkdir -p "$HOME/.ghcup/bin"     && curl -LJ "https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup" -o "$HOME/.ghcup/bin/ghcup"     && chmod +x "$HOME/.ghcup/bin/ghcup":
#0 0.204   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 0.204                                  Dload  Upload   Total   S
[2022-11-22T23:36:45.188Z] pent    Left  Speed
#0 0.204 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
#0 0.421 curl: (60) SSL certificate problem: unable to get local issuer certificate
#0 0.421 More details here: https://curl.se/docs/sslcerts.html
#0 0.421 
#0 0.421 curl failed to verify the legitimacy of the server and therefore could not
#0 0.421 establish a secure connection to it. To learn more about this situation and
#0 0.421 how to fix it, please visit the web page mentioned above.
------
[2022-11-22T23:36:45.188Z] ERROR: failed to solve: executor failed running [/bin/sh -c mkdir -p "$HOME/.ghcup/bin"     && curl -LJ "https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup" -o "$HOME/.ghcup/bin/ghcup"     && chmod +x "$HOME/.ghcup/bin/ghcup"]: exit code: 60
[2022-11-22T23:36:45.198Z] Stop (42358 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/7n/brvdl9m17dd2v2j6xk495z3c0000gq/T/devcontainercli/container-features/0.23.2-1669160162812/Dockerfile-with-features -t vsc-haskell-sandbox-23279f8617b97768867d4d6fa0727610 --target dev_containers_target_stage --no-cache --pull --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer
[2022-11-22T23:36:45.198Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/7n/brvdl9m17dd2v2j6xk495z3c0000gq/T/devcontainercli/container-features/0.23.2-1669160162812/Dockerfile-with-features -t vsc-haskell-sandbox-23279f8617b97768867d4d6fa0727610 --target dev_containers_target_stage --no-cache --pull --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer
[2022-11-22T23:36:45.198Z]     at doe (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1888:1635)
[2022-11-22T23:36:45.198Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-11-22T23:36:45.199Z]     at async pF (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:1973)
[2022-11-22T23:36:45.199Z]     at async eT (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:901)
[2022-11-22T23:36:45.199Z]     at async voe (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:2049)
[2022-11-22T23:36:45.199Z]     at async Xf (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:3212)
[2022-11-22T23:36:45.199Z]     at async Jae (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:15058)
[2022-11-22T23:36:45.199Z]     at async Wae (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:14812)
[2022-11-22T23:36:45.200Z] Stop (44107 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/piotrjustyna/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/piotrjustyna/Documents/code/haskell-sandbox --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/piotrjustyna/Documents/code/haskell-sandbox --log-level debug --log-format json --config /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-11-22T23:36:45.201Z] Exit code 1
[2022-11-22T23:36:45.203Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/piotrjustyna/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/piotrjustyna/Documents/code/haskell-sandbox --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/piotrjustyna/Documents/code/haskell-sandbox --log-level debug --log-format json --config /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-11-22T23:36:45.203Z] Exit code 1

One quick and dirty fix I tried was to simply add a -k flag to the Dockerfile's curl: curl -kLJ "https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup" -o "$HOME/.ghcup/bin/ghcup"

Result:

[2022-11-22T23:43:14.590Z]      0 --:--:-- --:--:-- --:--:--  555k
#0 6.207 [ Info  ] downloading: https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-deb10-linux.tar.xz as file /home/vscode/.ghcup/tmp/ghcup-6096509f1890c256/ghc-9.2.5-x86_64-deb10-linux.tar.xz
#0 6.316   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 6.316                                  Dload  Upload   Total   Spent    Left  Speed
#0 6.316 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
#0 6.464 curl: (60) SSL certificate problem: unable to get local issuer certificate
#0 6.465 More details here: https://curl.se/docs/sslcerts.html
#0 6.465 
#0 6.465 curl failed to verify the legitimacy of the server and therefore could not
#0 6.465 establish a secure connection to it. To learn more about this situation and
#0 6.465 how to fix it, please visit the web page mentioned above.
#0 6.478 [
[2022-11-22T23:43:14.591Z]  Error ] Both installation and setting the tool failed. Install error was: Download failed: Process "curl" with arguments ["-fL",
[2022-11-22T23:43:14.591Z] #0 6.480 [ ...   ]                                                                                                                   "-o",
#0 6.483 [ ...   ]                                                                                                                   "/home/vscode/.ghcup/tmp/ghcup-6096509f1890c256/ghc-9.2.5-x86_64-deb10-linux.tar.xz.tmp",
#0 6.486 [ ...   ]                                                                                                                   "https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-deb10-linux.tar.xz"] failed with exit code 60. 
#0 6.488 [ ...   ] Set error was: The version 9.2.5 of the tool ghc is not installed.
#0 6.489 [ Error ] Also check the logs in /home/vscode/.ghcup/logs
------
[2022-11-22T23:43:14.593Z] ERROR: failed to solve: executor failed running [/bin/sh -c ghcup install ghc "${GHC_VERSION}" --set     && ghcup install cabal recommended --set     && ghcup install stack recommended --set     && ghcup install hls recommended --set     && cabal update]: exit code: 3
[2022-11-22T23:43:14.602Z] Stop (55971 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/7n/brvdl9m17dd2v2j6xk495z3c0000gq/T/devcontainercli/container-features/0.23.2-1669160538592/Dockerfile-with-features -t vsc-haskell-sandbox-23279f8617b97768867d4d6fa0727610 --target dev_containers_target_stage --no-cache --pull --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer
[2022-11-22T23:43:14.603Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/7n/brvdl9m17dd2v2j6xk495z3c0000gq/T/devcontainercli/container-features/0.23.2-1669160538592/Dockerfile-with-features -t vsc-haskell-sandbox-23279f8617b97768867d4d6fa0727610 --target dev_containers_target_stage --no-cache --pull --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer
[2022-11-22T23:43:14.603Z]     at doe (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1888:1635)
[2022-11-22T23:43:14.605Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-11-22T23:43:14.605Z]     at async pF (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:1973)
[2022-11-22T23:43:14.605Z]     at async eT (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:901)
[2022-11-22T23:43:14.605Z]     at async voe (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:2049)
[2022-11-22T23:43:14.605Z]     at async Xf (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:3212)
[2022-11-22T23:43:14.605Z]     at async Jae (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:15058)
[2022-11-22T23:43:14.605Z]     at async Wae (/Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:14812)
[2022-11-22T23:43:14.611Z] Stop (57737 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/piotrjustyna/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/piotrjustyna/Documents/code/haskell-sandbox --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/piotrjustyna/Documents/code/haskell-sandbox --log-level debug --log-format json --config /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-11-22T23:43:14.611Z] Exit code 1
[2022-11-22T23:43:14.613Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/piotrjustyna/.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/piotrjustyna/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/piotrjustyna/Documents/code/haskell-sandbox --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/piotrjustyna/Documents/code/haskell-sandbox --log-level debug --log-format json --config /Users/piotrjustyna/Documents/code/haskell-sandbox/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-11-22T23:43:14.613Z] Exit code 1

So now it looks to me that ghcup is also attempting to curl something and is failing for the same reason. Now the challenge will be to understand if we can mitigate the curl problem ghcup is having... Will keep digging.

PiotrJustyna avatar Nov 22 '22 23:11 PiotrJustyna

Hey @PiotrJustyna, I had a similar issue on my M1 mac, with "Both installation and setting the tool failed. Install error was: Process "gmake"". Below is some more log output:

 => [dev_container_auto_added_stage_label 4/5] RUN mkdir -p "$HOME/.ghcup  1.3s
 => ERROR [dev_container_auto_added_stage_label 5/5] RUN ghcup install   100.2s
------
 > [dev_container_auto_added_stage_label 5/5] RUN ghcup install ghc "9.2" --set     && ghcup install cabal recommended --set     && ghcup install stack recommended --set     && ghcup install hls recommended --set     && cabal update:
[2022-12-08T01:22:08.262Z] 
#0 6.122 [ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /home/vscode/.ghcup/cache/ghcup-0.0.7.yaml
#0 6.333   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 6.333                                  Dload  Upload   Total   Spent    Left  Speed
#0 6.333 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  191k  100  191k    0     0   670k      0 --:--:-- --:--:-- --:--:--  670k
#0 6.892 [ Warn  ] Assuming you meant version 9.2.5
#0 6.897 [ Info  ] downloading: https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-deb10-linux.tar.xz as file /home/vscode/.ghcup/tmp/ghcup-3a787e365fa67db2/ghc-9.2.5-x86_64-deb10-linux.tar.xz
#0 7.079   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 7.079                                  Dload  Upload   Total   Spent    Left  Speed
#0 7.079 
  0     0    0   
[2022-12-08T01:22:08.262Z]   0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  231M    0 1486k    0     0  8541k      0  0:00:27 --:--:--  0:00:27 8492k
  7  231M    7 16.5M    0     0  14.1M      0  0:00:16  0:00:01  0:00:15 14.1M
 13  231M   13 31.8M    0     0  14.6M      0  0:00:15  0:00:02  0:00:13 14.6M
 19  231M   19 46.1M    0     0  14.5M      0  0:00:15  0:00:03  0:00:12 14.5M
 26  231M   26 60.5M    0     0  14.4M      0  0:00:16  0:00:04  0:00:12 14.4M
 31  231M   31 73.7M    0     0  14.2M      0  0:00:16  0:00:05  0:00:11 14.4M
 38  231M   38 88.2M    0     0  14.2M      0  0:00:16  0:00:06  0:00:10 14.3M
 43  231M   43  101M    0     0  14.1M      0  0:00:16  0:00:07  0:00:09 13.9M
 49  231M   49  113M    0     0  13.9M      0  0:00:16  0:00:08  0:00:08 13.5M
 54  231M   54  127M    0     0  13.8M      0  0:00:16  0:00:09  0:00:07 13.3M
 60  231M   60  141M    0     0  13.8M      0  0:00:16  0:00:10  0:00:06 13.4M
 66  231M   66  154M    0     0  13.8M      0  0:00:16  0:00:11  0:00:05 13.2M
 72  231M   72
[2022-12-08T01:22:08.262Z]   168M    0     0  13.8M      0  0:00:16  0:00:12  0:00:04 13.2M
 78  231M   78  182M    0     0  13.8M      0  0:00:16  0:00:13  0:00:03 13.6M
 84  231M   84  195M    0     0  13.7M      0  0:00:16  0:00:14  0:00:02 13.5M
 89  231M   89  208M    0     0  13.7M      0  0:00:16  0:00:15  0:00:01 13.4M
 95  231M   95  221M    0     0  13.6M      0  0:00:16  0:00:16 --:--:-- 13.4M
100  231M  100  231M    0     0  13.6M      0  0:00:16  0:00:16 --:--:-- 13.2M
#0 24.07 [ Info  ] verifying digest of: ghc-9.2.5-x86_64-deb10-linux.tar.xz
#0 26.82 [ Info  ] Unpacking: ghc-9.2.5-x86_64-deb10-linux.tar.xz to /home/vscode/.ghcup/tmp/ghcup-d4ea0bf0d9f984d3
#0 93.59 [ Info  ] Installing GHC (this may take a while)
#0 93.67 
#0 93.67 
#0 93.67 
#0 93.67 
#0 93.67 
#0 93.67 
#0 95.46 

#0 95.54 
#0 95.54 
#0 95.54 
#0 95.54 
#0 95.54 
#0 98.86 [ Error ] Both installation and setting the tool failed. Install error was: Process "gmake" 
[2022-12-08T01:22:08.263Z] with arguments ["DESTDIR=/home/vscode/.ghcup/tmp/ghcup-1d4e61a6d8507174",
#0 98.86 [ ...   ]                                                                                                   "install"] failed with exit code 2. 
#0 98.86 [ ...   ] Set error was: The version 9.2.5 of the tool ghc is not installed.
#0 98.86 [ Error ] Also check the logs in /home/vscode/.ghcup/logs
------
[2022-12-08T01:22:08.268Z] Dockerfile-with-features:54
--------------------
  53 |     # comment out the lines below. In that case, you may need to manually run "cabal update""."
  54 | >>> RUN ghcup install ghc "${GHC_VERSION}" --set \
  55 | >>>     && ghcup install cabal recommended --set \
  56 | >>>     && ghcup install stack recommended --set \
  57 | >>>     && ghcup install hls recommended --set \
  58 | >>>     && cabal update
  59 |     
--------------------
[2022-12-08T01:22:08.268Z] ERROR: failed to solve: process "/bin/sh -c ghcup install ghc \"${GHC_VERSION}\" --set     && ghcup install cabal recommended --set     && ghcup install stack recommended --set     && ghcup install hls recommended --set     && cabal update" did not complete successfully: exit code: 3

The fix that worked for me was basically #1654, where we run the official ghcup installation. I think the error might have been pulling the x86_64 architecture build in "https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup", which would conflict with our m1 arm architecture.

  • VSCode Version: 1.74.0
  • Local OS Version: macOS 13.0.1
  • Local chip architecture: Apple Silicon (M1)

joshuanianji avatar Dec 08 '22 01:12 joshuanianji

Thanks @joshuanianji, tried that with good results and would be happy to use that instead of the community script where all components are installed individually (ghc, cabal, hls, stack). Glad the issue is open.

In the meantime, I think it would be worth discussing whether the current shape of the Haskell devcontainer makes sense these days... We have the ability to install/skip zsh but not to choose the ghcup version.

What I ended up doing is I wrote my own devcontainer based on alpine where I only install:

  • ghc
  • cabal
  • stack (from the testing repository)

Don't really need hls. That is good enough for me for the time being, but the state of Haskell in devcontainers community does need a bit of tlc...

PiotrJustyna avatar Dec 08 '22 13:12 PiotrJustyna

Hey @PiotrJustyna, glad it's working for you. I agree that the image would benefit from some more attention, although I think installing the latest ghcup version makes sense for most people since it's only an intermediary for installing other tools.

Nonetheless, I'm not involved in this community too much, so I'll stick with that's working for me lol.

joshuanianji avatar Dec 10 '22 00:12 joshuanianji

@joshuanianji I think we have the new image :) It should work for more people now. See my PR.

PiotrJustyna avatar Dec 20 '22 10:12 PiotrJustyna

Hey @PiotrJustyna, great to see your PR! Hope to have it merged soon

joshuanianji avatar Dec 20 '22 17:12 joshuanianji

I am curious as to why @PiotrJustyna's Pull Request has not been merged yet. The official version does not function properly on my M2 Mac, while his version does. I believe all arm64 Mac users would greatly benefit from it.

vincenteof avatar Aug 01 '23 02:08 vincenteof

I am curious as to why @PiotrJustyna's Pull Request has not been merged yet.

You maybe interested in devcontainers/features#470

I believe this repository is currently in maintenance mode and not actively maintained.

https://github.com/microsoft/vscode-dev-containers/blob/c4c22252ef095a111618d535a2201d7140cd7ae0/README.md?plain=1#L1-L11

eitsupi avatar Aug 01 '23 14:08 eitsupi

Tried a Dockerfile by @joshuanianji, but failed with the similar error. From the logs I found that g++ is not installed. Fixed it by intalling build-essential package.

fedor-ivn avatar Oct 28 '23 21:10 fedor-ivn