haskell / ghcup-hs

https://www.haskell.org/ghcup/
GNU Lesser General Public License v3.0
279 stars 83 forks source link

Failure to install old versions or integer-simple bindist with 0.1.18.0 #407

Open hasufell opened 2 years ago

hasufell commented 2 years ago

In GitLab by @tgiannak on Aug 2, 2022, 05:38

On an alpine:3.16 container I'm trying to use GHCup to install the bindist for the integer-simple version of GHC (since GHCup installs the GMP version by default for 8.10.7 on Alpine). I get an error about failing to merge the file tree. The same thing happens when trying to install GHC 8.10.4 and 8.10.5 (neither with a custom bindist), but not 8.10.6 or 8.10.7.

/ # ghcup install ghc -u 'https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-alpine3.10-linux-integer-simple.tar.xz' 8.10.7
[ Info  ] downloading: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-alpine3.10-linux-integer-simple.tar.xz as file /root/.ghcup/tmp/ghcup-cc6f536bf2072c93/ghc-8.10.7-x86_64-alpine3.10-linux-integer-simple.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  101M  100  101M    0     0  6402k      0  0:00:16  0:00:16 --:--:-- 6491k
[ Info  ] Unpacking: ghc-8.10.7-x86_64-alpine3.10-linux-integer-simple.tar.xz to /root/.ghcup/tmp/ghcup-d3206c824c814cc3
[ Info  ] Installing GHC (this may take a while)
[ Info  ] Merging file tree from "/root/.ghcup/tmp/ghcup-fbd7ba2384ba44af/root/.ghcup/ghc/8.10.7" to "/root/.ghcup/ghc/8.10.7"
[ Error ] Failed to merge file tree from /root/.ghcup/tmp/ghcup-fbd7ba2384ba44af/root/.ghcup/ghc/8.10.7 to /root/.ghcup/ghc/8.10.7 
[ ...   ] exception was: user error (mergeFileTree: source base directory /root/.ghcup/tmp/ghcup-fbd7ba2384ba44af/root/.ghcup/ghc/8.10.7 does not exist!) 
[ ...   ] ...you may need to delete /root/.ghcup/ghc/8.10.7 manually. Make sure it's gone.
[ Error ] Also check the logs in /root/.ghcup/logs
/ # ghcup debug-info
Debug Info
==========
GHCup base dir: /root/.ghcup
GHCup bin dir: /root/.ghcup/bin
GHCup GHC directory: /root/.ghcup/ghc
GHCup cache directory: /root/.ghcup/cache
Architecture: x86_64
Platform: Linux Alpine, 3.16.1
Version: v0.1.18.0
hasufell commented 2 years ago

In GitLab by @maerwald on Aug 2, 2022, 08:30

Yes, it's possible that these bindists are buggy and as such not supported anymore and need fixing.

The reason is that we rely on make DESTDIR=/tmp install to work, because we don't want makefile bugs cause damage to the target directory.

That obviously needs more work, but that's the way to go.

So this means those bindists don't respect DESTDIR.

You can still install them with old ghcup and newer ghcup won't have issues with that.

Ultimately, we need to fix them.

hasufell commented 2 years ago

In GitLab by @maerwald on Aug 2, 2022, 08:40

Those are usually hadrian bindists btw.

hasufell commented 2 years ago

In GitLab by @maerwald on Aug 4, 2022, 21:08

So. I checked.

Affected are 8.10.2, 8.10.3, 8.10.4 and 8.10.5 (x86_64 alpine).

8.10.7 is not affected. At least not the one in ghcup, which is https://downloads.haskell.org/~ghcup/unofficial-bindists/ghc/8.10.7/ghc-8.10.7-x86_64-alpine-linux-integer-gmp.tar.xz

So you used the "wrong" one.

I'm considering to simply remove 8.10.2-8.10.5 for alpine. It's not a major supported platform anyway. The main use case is to build static binaries. Whatever builds with 8.10.2 should build with 8.10.7 as well.

hasufell commented 2 years ago

In GitLab by @tgiannak on Aug 4, 2022, 23:52

Removing the broken builds seems reasonable (especially since the 8.10.2-8.10.5 Alpine builds claim to use integer-simple but actually use integer-gmp, according to the 8.10.6 release notes).

The 8.10.7 dist that is packaged for Alpine uses integer-gmp, and I would guess that most people compiling on Alpine need integer-simple. Can whatever process was used to create the 8.10.7 unofficial bindist with integer-gmp be repeated to create a bindist with integer-simple that respects DESTDIR as well? (I'm fine using -u to select it.)

hasufell commented 2 years ago

In GitLab by @maerwald on Aug 5, 2022, 11:43

and I would guess that most people compiling on Alpine need integer-simple.

Why? integer-simple causes many issues (I think you can't even build HLS with it) and is slow af.

We build static binaries with gmp just fine. People concerned with the licensing can build their own GHC.

hasufell commented 2 years ago

In GitLab by @maerwald on Aug 5, 2022, 11:51

There are official integer-simple bindists now, though: https://downloads.haskell.org/~ghc/9.2.4/ghc-9.2.4-x86_64-alpine3.12-linux-native.tar.xz

Called linux-native. Those are not the ones we put into ghcup though.

Supporting both variants would need a lot of thought on how to support this in the cli, with HLS etc.

jasagredo commented 1 month ago

For anyone arriving to this issue searching for that same error, the mergeFileTree exception, applying this patch to your GHC installation and re-building the bindist will make it installable in ghcup.