Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cabal does not compile with recent versions of GHC #7904

Closed
LiraOnGithub opened this issue Jan 12, 2022 · 32 comments
Closed

Cabal does not compile with recent versions of GHC #7904

LiraOnGithub opened this issue Jan 12, 2022 · 32 comments

Comments

@LiraOnGithub
Copy link

Describe the bug
When building cabal from source, ./Setup configure cannot find any packages

To Reproduce
Steps to reproduce the behavior:

$ tar -xf ghc-9.2.1-x86_64-deb10-linux.tar.xz
$ cd ghc-9.2.1
$ ./configure
$ sudo make install
$ cd ../
$ tar -xf cabal-install-3.6.2.0.tar.gz
$ cd cabal-install-3.6.2.0/
$ sudo apt install libnuma-dev
$ ghc --make Setup.hs
$ ./Setup configure --user --enable-library-profiling
Configuring cabal-install-3.6.2.0...
Setup: Encountered missing or private dependencies:
HTTP >=4000.1.5 && <4000.4,
async >=2.0 && <2.3,
base >=4.8 && <4.15,
base16-bytestring >=0.1.1 && <1.1.0.0,
cryptohash-sha256 >=0.11 && <0.12,
echo >=0.1.3 && <0.2,
edit-distance >=0.2.2 && <0.3,
hackage-security >=0.6.0.1 && <0.7,
hashable >=1.0 && <1.4,
network-uri >=2.6.0.2 && <2.7,
random >=1.2 && <1.3,
regex-base >=0.94.0.0 && <0.95,
regex-posix >=0.96.0.0 && <0.97,
resolv >=0.1.1 && <0.2,
tar >=0.5.0.3 && <0.6,
time >=1.5.0.1 && <1.11,
zlib >=0.5.3 && <0.7

$ ./Setup build
Run the 'configure' command first.

$ /usr/local/bin/ghc --print-libdir
/usr/local/lib/ghc-9.2.1

$ ls /usr/local/lib/ghc-9.2.1
array-0.5.4.0   bytestring-0.11.1.0  directory-1.3.6.2  ghc-bignum-1.2       ghc-heap-9.2.1  ghc-usage.txt    include          llvm-passes     parsec-3.1.14.0   settings                   terminfo-0.4.1.5      unix-2.7.2.2
base-4.16.0.0   Cabal-3.6.0.0        exceptions-0.10.4  ghc-boot-9.2.1       ghci-9.2.1      haskeline-0.8.2  integer-gmp-1.1  llvm-targets    pretty-1.1.3.6    stm-2.5.0.0                text-1.2.5.0          xhtml-3000.2.2.1
bin             containers-0.6.5.1   filepath-1.4.2.1   ghc-boot-th-9.2.1    ghci-usage.txt  hpc-0.6.1.0      latex            mtl-2.2.2       process-1.6.13.2  template-haskell-2.18.0.0  time-1.11.1.1
binary-0.8.9.0  deepseq-1.4.6.0      ghc-9.2.1          ghc-compact-0.1.0.0  ghc-prim-0.8.0  html             libiserv-9.2.1   package.conf.d  rts               template-hsc.h             transformers-0.5.6.2

Please use version-prefixed commands (e.g. v2-build or v1-build) to avoid ambiguity.

Expected behavior
./Setup to be configured and ready to be used as ./Setup build

System information

  • Ubuntu 20.04 LTS 64bit
  • cabal, ghc versions: cabal 3.6.2.0 and ghc 9.2.1

Additional context
No other versions of cabal or ghc are installed

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

Hi @PiJoKra,

So you are trying to boostrap cabal using only GHC? I'm afraid that's not trivial. Please look at the last line of https://github.com/haskell/cabal/blob/master/README.md and let us know if that works for you.

@LiraOnGithub
Copy link
Author

Hello @Mikolaj
Thank you for pointing me there!
I only see json's for ghcversions going up to 8.10.7, can I use cabal for ghcversion 9.2.1?

The reason for trying to bootstrap is me not getting cabal via the package-manager to work for ghc 9.2.1
After sudo apt install cabal-install, running cabal configure --with-compiler=/usr/local/bin/ghc yields:

Warning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports
'ghc' version < 8.7): /usr/local/bin/ghc is version 9.2.1

And running `cabal install cabal-install yields:

cabal v2-install cabal-install
Warning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports
'ghc' version < 8.7): /usr/local/bin/ghc is version 9.2.1
Warning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports
'ghc' version < 8.7): /usr/local/bin/ghc is version 9.2.1
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: cabal-install-3.6.2.0 (user goal)
[__1] trying: cabal-install:+native-dns
[__2] trying: resolv-0.1.2.0 (dependency of cabal-install +native-dns)
[__3] next goal: time (dependency of cabal-install)
[__3] rejecting: time-1.11.1.1/installed-1.1... (conflict: cabal-install =>
time>=1.5.0.1 && <1.11)
[__3] rejecting: time-1.12.1, time-1.12 (unsupported spec-version 3.0)
[__3] rejecting: time-1.11.1.2, time-1.11.1.1, time-1.11.1, time-1.11
(conflict: cabal-install => time>=1.5.0.1 && <1.11)
[__3] trying: time-1.10
[__4] next goal: process (dependency of cabal-install)
[__4] rejecting: process-1.6.13.2/installed-1.6... (conflict: cabal-install =>
base>=4.8 && <4.15, process => base==4.16.0.0/installed-4.1...)
[__4] trying: process-1.6.13.2
[__5] next goal: pretty (dependency of cabal-install)
[__5] rejecting: pretty-1.1.3.6/installed-1.1... (conflict: cabal-install =>
base>=4.8 && <4.15, pretty => base==4.16.0.0/installed-4.1...)
[__5] trying: pretty-1.1.3.6
[__6] trying: hackage-security-0.6.0.1 (dependency of cabal-install)
[__7] next goal: template-haskell (dependency of hackage-security)
[__7] rejecting: template-haskell-2.18.0.0/installed-2.1... (conflict:
cabal-install => base>=4.8 && <4.15, template-haskell =>
base==4.16.0.0/installed-4.1...)
[__7] rejecting: template-haskell-2.18.0.0, template-haskell-2.17.0.0,
template-haskell-2.16.0.0, template-haskell-2.15.0.0,
template-haskell-2.14.0.0, template-haskell-2.13.0.0,
template-haskell-2.12.0.0, template-haskell-2.11.1.0,
template-haskell-2.11.0.0, template-haskell-2.10.0.0,
template-haskell-2.9.0.0, template-haskell-2.8.0.0, template-haskell-2.7.0.0,
template-haskell-2.6.0.0, template-haskell-2.5.0.0, template-haskell-2.4.0.1,
template-haskell-2.4.0.0, template-haskell-2.3.0.1, template-haskell-2.3.0.0,
template-haskell-2.2.0.0 (constraint from non-upgradeable package requires
installed instance)
[__7] fail (backjumping, conflict set: cabal-install, hackage-security,
template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cabal-install, base, template-haskell,
directory, process, time, pretty, network, hackage-security, HTTP, resolv,
cabal-install:lib, cabal-install:native-dns

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

I only see json's for ghcversions going up to 8.10.7, can I use cabal for ghcversion 9.2.1?

OOI, did you try the newest one and it didn't work?

I wouldn't worry about the warning. Which point of https://github.com/haskell/cabal/blob/master/README.md are you following now? If the "Installing cabal-install (preferred, with cabal-install)" one, did you do cabal update?

@LiraOnGithub
Copy link
Author

OOI, did you try the newest one and it didn't work?

It did not work. This is was the result:

$ ./bootstrap/bootstrap.py -d ./bootstrap/linux-8.10.7.json -w /usr/local/bin/ghc
bootstrap: running /usr/local/bin/ghc-9.2.1 --info
Bootstrapping cabal-install with GHC 9.2.1 at /usr/local/bin/ghc-9.2.1...

DO NOT use this script if you have another recent cabal-install available.
This script is intended only for bootstrapping cabal-install on new
architectures.

Creating package database _build/packages.conf
bootstrap: running /usr/local/bin/ghc-pkg-9.2.1 init _build/packages.conf
bootstrap: running /usr/local/bin/ghc-pkg-9.2.1 describe rts-1.0.1
ghc-pkg: cannot find package rts-1.0.1
Traceback (most recent call last):
  File "./bootstrap/bootstrap.py", line 391, in <module>
    main()
  File "./bootstrap/bootstrap.py", line 359, in main
    bootstrap(info, ghc)
  File "./bootstrap/bootstrap.py", line 251, in bootstrap
    check_builtin(dep, ghc)
  File "./bootstrap/bootstrap.py", line 167, in check_builtin
    subprocess_run([str(ghc.ghc_pkg_path), 'describe', f'{dep.package}-{dep.version}'],
  File "./bootstrap/bootstrap.py", line 388, in subprocess_run
    return subprocess.run(args, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/bin/ghc-pkg-9.2.1', 'describe', 'rts-1.0.1']' returned non-zero exit status 1.

I wouldn't worry about the warning. Which point of https://github.com/haskell/cabal/blob/master/README.md are you following now? If the "Installing cabal-install (preferred, with cabal-install)" one, did you do cabal update?
I did a sudo apt install cabal-install followed by point "Installing cabal-install (preferred, with cabal-install)". I also tried cabal update

$ cabal v2-update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
    cabal new-update 'hackage.haskell.org,2022-01-13T10:14:09Z'
$ cabal --version
cabal-install version 2.4.0.0
compiled using version 2.4.0.1 of the Cabal library 
$ cabal v2-install cabal-install
Warning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports
'ghc' version < 8.7): /usr/local/bin/ghc is version 9.2.1
Warning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports
'ghc' version < 8.7): /usr/local/bin/ghc is version 9.2.1
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: cabal-install-3.6.2.0 (user goal)
[__1] trying: cabal-install:+native-dns
[__2] trying: resolv-0.1.2.0 (dependency of cabal-install +native-dns)
[__3] next goal: time (dependency of cabal-install)
[__3] rejecting: time-1.11.1.1/installed-1.1... (conflict: cabal-install =>
time>=1.5.0.1 && <1.11)
[__3] rejecting: time-1.12.1, time-1.12 (unsupported spec-version 3.0)
[__3] rejecting: time-1.11.1.2, time-1.11.1.1, time-1.11.1, time-1.11
(conflict: cabal-install => time>=1.5.0.1 && <1.11)
[__3] trying: time-1.10
[__4] next goal: process (dependency of cabal-install)
[__4] rejecting: process-1.6.13.2/installed-1.6... (conflict: cabal-install =>
base>=4.8 && <4.15, process => base==4.16.0.0/installed-4.1...)
[__4] trying: process-1.6.13.2
[__5] next goal: pretty (dependency of cabal-install)
[__5] rejecting: pretty-1.1.3.6/installed-1.1... (conflict: cabal-install =>
base>=4.8 && <4.15, pretty => base==4.16.0.0/installed-4.1...)
[__5] trying: pretty-1.1.3.6
[__6] trying: hackage-security-0.6.0.1 (dependency of cabal-install)
[__7] next goal: template-haskell (dependency of hackage-security)
[__7] rejecting: template-haskell-2.18.0.0/installed-2.1... (conflict:
cabal-install => base>=4.8 && <4.15, template-haskell =>
base==4.16.0.0/installed-4.1...)
[__7] rejecting: template-haskell-2.18.0.0, template-haskell-2.17.0.0,
template-haskell-2.16.0.0, template-haskell-2.15.0.0,
template-haskell-2.14.0.0, template-haskell-2.13.0.0,
template-haskell-2.12.0.0, template-haskell-2.11.1.0,
template-haskell-2.11.0.0, template-haskell-2.10.0.0,
template-haskell-2.9.0.0, template-haskell-2.8.0.0, template-haskell-2.7.0.0,
template-haskell-2.6.0.0, template-haskell-2.5.0.0, template-haskell-2.4.0.1,
template-haskell-2.4.0.0, template-haskell-2.3.0.1, template-haskell-2.3.0.0,
template-haskell-2.2.0.0 (constraint from non-upgradeable package requires
installed instance)
[__7] fail (backjumping, conflict set: cabal-install, hackage-security,
template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cabal-install, base, template-haskell,
directory, process, time, pretty, network, hackage-security, HTTP, resolv,
cabal-install:lib, cabal-install:native-dns

I also find it strange there are packages in both /usr/local/lib/ghc-9.2.1 and in ~/.cabal/packages/hackage.haskell.org, but not sure if it has anything to do with it.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

Thank you for the details about bootstrapping. Good to know.

Two locations for packages is fine --- one comes with the GHC, another stores user-downloaded packages.

Reading your log, it seems cabal 3.6.2 indeed rules out newer GHCs. Even GHC 9.0.2 is off-limits. The version in the repo probably accepts 9.0.2, but not 9.2.*.

I'm afraid, the only remaining options are downloading the binary, either via ghcup or as told in the README. Cabal doesn't mind being compiled with one GHC and used with different ones.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

I guess we should amend the README to say "but not with bleeding edge GHC" or something to that effect, so that others don't need to repeat our investigation. What text would help you, initially?

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

Especially that the way that doesn't work two last versions of GHC is marked as "preferred".

@LiraOnGithub
Copy link
Author

I think the "but not with bleeding edge GHC" would be good enough, or maybe state that the json-files with the ghcversion-naming dictate the last version you can use or something like that.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

Good idea, thank you.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

@fendor also suggests to add to the .cabal file (I'd say, the minimum would be cabal-install.cabal) the "tested-with section to indicate with which GHC version you are supposed to be able to build". That'd require some maintenance though, from both ends; in particular removing GHCs we no longer support.

@LiraOnGithub
Copy link
Author

Seems like a good idea! Should I rename this issue to something to reflect cabal not working with recent GHC-versions?

I decided to try my luck with ghcup and now have cabal-install version 3.6.2.0, but now I always get the following when using cabal install PACKAGENAME:

Resolving dependencies...
cabal: Cannot build the executables in the package PACKAGENAME because it
does not contain any executables. Check the .cabal file for the package and
make sure that it properly declares the components that you expect.

I tried multiple packages. Is this related to the previous problem, or is this something I should create a new issue for?

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

Seems like a good idea! Should I rename this issue to something to reflect cabal not working with recent GHC-versions?

That would make sense.

I tried multiple packages. Is this related to the previous problem, or is this something I should create a new issue for?

I think this works as expected. You normally don't install packages by hand, unless they have an exe you need. Cabal installs everything it needs automatically when you cabal build a package you are working with. Unless you have some special needs that require installing packages manually, in which case, please describe them.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 13, 2022

Again, if dev version of cabal docs is misleading in this respect, let's fix them: https://cabal.readthedocs.io/en/latest/

@LiraOnGithub
Copy link
Author

LiraOnGithub commented Jan 13, 2022

Oh, I had a .cabal with the package in it, but removed and started over. Now the package was no longer in the .cabal and cabal complained it could not load a module. I got a bit confused :')
It works now, thank you!

@LiraOnGithub LiraOnGithub changed the title Encountered missing or private dependencies when configuring cabal Setup Cabal does not compile with recent versions of GHC Jan 13, 2022
@gbaz
Copy link
Collaborator

gbaz commented Jan 13, 2022

#7907

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Jan 13, 2022

I'm afraid, the only remaining options are downloading the binary, either via ghcup or as told in the README. Cabal doesn't mind being compiled with one GHC and used with different ones.

Yes. ghcup.

Nix is also always an option.

After the Nix installation & restarting the terminal - run the nix-env -iA nixpkgs.cabal-install. To be honest - if that does not work - it is easier to direct towards learning Nix than explaining/debugging.

Overall the good rule of thumb - is not to use package managers to install other package managers. Most often, having each package manager/management installed in the official package management way, or at least as a separate custom deployment / structural dependency tree with independent root (package manager) - the more comfortable & stable usage is.

@LiraOnGithub
Copy link
Author

I have another bug and want to check if it has to do with this one. If not I can make a new issue.
When I try to run the project it cannot determine the version of /usr/local/bin/hsc2hs-ghc-9.2.1.

$ cat tafels.cabal 
name:                tafels
version:             1.0
build-type:          Simple
cabal-version:       >=1.10
executable tafels
  main-is:             ./Server.hs
  build-depends:       base >=4.16 && <4.17, text >=1.2 && <1.3, websockets
  hs-source-dirs:      ./
  default-language:    Haskell2010
$ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library 
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.1
$ cabal run
Build profile: -w ghc-9.2.1 -O1
In order, the following will be built (use -v for more details):
 - clock-0.8.2 (lib) (requires build)
 - network-3.1.2.5 (lib:network) (requires build)
 - zlib-0.6.2.3 (lib) (requires build)
 - streaming-commons-0.2.2.3 (lib) (requires build)
 - websockets-0.12.7.3 (lib) (requires build)
 - tafels-1.0 (exe:tafels) (configuration changed)
Starting     clock-0.8.2 (lib)
Starting     zlib-0.6.2.3 (lib)
Starting     network-3.1.2.5 (all, legacy fallback)
Building     clock-0.8.2 (lib)
Building     zlib-0.6.2.3 (lib)
Building     network-3.1.2.5 (all, legacy fallback)

Failed to build clock-0.8.2.
Build log (
/home/lira/.cabal/logs/ghc-9.2.1/clock-0.8.2-3807a18e9e92be35d466530caf0b1cfdc2225b27f24d803acdb4b20e1fb49ecb.log
):
Configuring library for clock-0.8.2..
Preprocessing library for clock-0.8.2..
cabal-3.6.2.0: The program 'hsc2hs' is required but the version of
/usr/local/bin/hsc2hs-ghc-9.2.1 could not be determined.


Failed to build network-3.1.2.5.
Build log (
/home/lira/.cabal/logs/ghc-9.2.1/network-3.1.2.5-beb8e4e20ac734069254fbb769a02c0a8716ca09e6c4b4f957b11ae312c25fc4.log
):
Configuring network-3.1.2.5...
configure: WARNING: unrecognized options: --with-compiler
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to accept ISO C89... none needed
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... /usr/bin/gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/types.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking net/if.h usability... yes
checking net/if.h presence... yes
checking for net/if.h... yes
checking netioapi.h usability... no
checking netioapi.h presence... no
checking for netioapi.h... no
checking for struct ucred... yes
checking for gai_strerror... yes
checking for gethostent... yes
checking for accept4... yes
checking for getpeereid... no
checking whether AI_ADDRCONFIG is declared... yes
checking whether AI_ALL is declared... yes
checking whether AI_NUMERICSERV is declared... yes
checking whether AI_V4MAPPED is declared... yes
checking whether IPV6_V6ONLY is declared... yes
checking whether IPPROTO_IP is declared... yes
checking whether IPPROTO_TCP is declared... yes
checking whether IPPROTO_IPV6 is declared... yes
checking whether SO_PEERCRED is declared... yes
checking for struct msghdr.msg_control... yes
checking for struct msghdr.msg_accrights... no
checking for struct sockaddr.sa_len... no
configure: creating ./network.buildinfo
configure: creating ./config.status
config.status: creating include/HsNetworkConfig.h
configure: WARNING: unrecognized options: --with-compiler
Preprocessing library for network-3.1.2.5..
cabal-3.6.2.0: The program 'hsc2hs' is required but the version of
/usr/local/bin/hsc2hs-ghc-9.2.1 could not be determined.


Failed to build zlib-0.6.2.3.
Build log (
/home/lira/.cabal/logs/ghc-9.2.1/zlib-0.6.2.3-ca8e64f0ebe81a3a382ed3764aaad197e972173572503da016e1bfb1eb8f9559.log
):
Configuring library for zlib-0.6.2.3..
Preprocessing library for zlib-0.6.2.3..
cabal-3.6.2.0: The program 'hsc2hs' is required but the version of
/usr/local/bin/hsc2hs-ghc-9.2.1 could not be determined.

cabal: Failed to build clock-0.8.2 (which is required by exe:tafels from
tafels-1.0). See the build log above for details.
Failed to build network-3.1.2.5 (which is required by exe:tafels from
tafels-1.0). See the build log above for details.
Failed to build zlib-0.6.2.3 (which is required by exe:tafels from
tafels-1.0). See the build log above for details.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 20, 2022

And is there /usr/local/bin/hsc2hs-ghc-9.2.1?

Is that installed with ghcup? If so, is 9.2.1 the only version installed with ghcup or is it made the default version by command "set"?

@LiraOnGithub
Copy link
Author

LiraOnGithub commented Jan 20, 2022

Mmm, that is strange... It expects the version number in the name...

$ ls /usr/local/bin/ | grep hsc
hsc2hs
hsc2hs-ghc-9.2.1
$ /usr/local/bin/hsc2hs --version
hsc2hs version 0.68.8
$ /usr/local/bin/hsc2hs-ghc-9.2.1 --version
/usr/local/bin/hsc2hs-ghc-9.2.1: line 37: /usr/local/lib/ghc-9.2.1/bin/hsc2hs-ghc-9.2.1: No such file or directory
$ ls /usr/local/lib/ghc-9.2.1/bin | grep hsc
hsc2hs

Seems to not be an issue with cabal though... Thanks anyway ^^'

@Mikolaj
Copy link
Member

Mikolaj commented Jan 20, 2022

Looks like scripts left over from previous installation?

@LiraOnGithub
Copy link
Author

Could be the reason. Renaming /usr/local/bin/hsc2hs-ghc-9.2.1 to /usr/local/bin/__hsc2hs-ghc-9.2.1 fixed it. Now everything seems to work as expected. Thanks :)

@slotThe
Copy link

slotThe commented Mar 19, 2022

FWIW, while looking to upgrade Void to GHC 9.0.2 (not 9.2.2) I did manage to create a linux-9.0.2.json for Cabal-3.6.3.0 by following this, which then bootstrapped cabal correctly for 9.0.2. All I had to do was relax the bounds in cabal-bootstrap-gen.cabal a little and apply

--- a/bootstrap/src/Main.hs
+++ b/bootstrap/src/Main.hs
@@ -34,5 +34,5 @@ main = do

 main1 :: FilePath -> IO ()
 main1 planPath = do
-    meta <- I.cachedHackageMetadata
+    (_, meta) <- I.cachedHackageMetadata
     plan <- P.decodePlanJson planPath
     main2 meta plan
The finished json file
{"builtin":[{"package":"rts","version":"1.0.2"},{"package":"ghc-prim","version":"0.7.0"},{"package":"ghc-bignum","version":"1.1"},{"package":"base","version":"4.15.1.0"},{"package":"array","version":"0.5.4.0"},{"package":"deepseq","version":"1.4.5.0"},{"package":"bytestring","version":"0.10.12.1"},{"package":"containers","version":"0.6.4.1"},{"package":"binary","version":"0.8.8.0"},{"package":"filepath","version":"1.4.2.1"},{"package":"time","version":"1.9.3"},{"package":"unix","version":"2.7.2.2"},{"package":"directory","version":"1.3.6.2"},{"package":"transformers","version":"0.5.6.2"},{"package":"mtl","version":"2.2.2"},{"package":"ghc-boot-th","version":"9.0.2"},{"package":"pretty","version":"1.1.3.6"},{"package":"template-haskell","version":"2.17.0.0"},{"package":"text","version":"1.2.5.0"},{"package":"parsec","version":"3.1.14.0"},{"package":"process","version":"1.6.13.2"},{"package":"stm","version":"2.5.0.0"}],"dependencies":[{"cabal_sha256":null,"flags":["-bundled-binary-generic"],"package":"Cabal","revision":null,"source":"local","src_sha256":null,"version":"3.6.3.0"},{"cabal_sha256":"714a55fd28d3e2533bd5b49e74f604ef8e5d7b06f249c8816f6c54aed431dcf1","flags":["-optimised-mixer"],"package":"splitmix","revision":0,"source":"hackage","src_sha256":"6d065402394e7a9117093dbb4530a21342c9b1e2ec509516c8a8d0ffed98ecaa","version":"0.1.0.4"},{"cabal_sha256":"8bee24dc0c985a90ee78d94c61f8aed21c49633686f0f1c14c5078d818ee43a2","flags":[],"package":"random","revision":0,"source":"hackage","src_sha256":"265c768fc5f2ca53cde6a87e706b4448cad474c3deece933c103f24453661457","version":"1.2.1"},{"cabal_sha256":"3a2beeafb220f9de706568a7e4a5b3c762cc4c9f25c94d7ef795b8c2d6a691d7","flags":["+integer-gmp","-random-initial-seed"],"package":"hashable","revision":1,"source":"hackage","src_sha256":"baaad82cd4271b197016bdbe76f22d5c3d3913fe38534cec7d817db9bae19886","version":"1.3.5.0"},{"cabal_sha256":"b83dec34a53520de84c6dd3dc7aae45d22409b46eb471c478b98108215a370f0","flags":["-bench"],"package":"async","revision":1,"source":"hackage","src_sha256":"484df85be0e76c4fed9376451e48e1d0c6e97952ce79735b72d54297e7e0a725","version":"2.2.4"},{"cabal_sha256":"037d70bb091c49f68726dde920f6a003b646835a86cdcb5b5ad58ad9af3207d9","flags":[],"package":"Cabal-syntax","revision":0,"source":"hackage","src_sha256":"ca25e5fc601397565fa857f1aa477740fac7f43d659e77c4d9b1485dca239251","version":"3.6.0.0"},{"cabal_sha256":"d8699f46b485f105eea9c7158f3d432ca578e6bbe5d68751184e9899a41d430d","flags":["-old-bytestring","-old-time"],"package":"tar","revision":4,"source":"hackage","src_sha256":"b384449f62b2b0aa3e6d2cb1004b8060b01f21ec93e7b63e7af6d8fad8a9f1de","version":"0.5.1.1"},{"cabal_sha256":"e3d78b13db9512aeb106e44a334ab42b7aa48d26c097299084084cb8be5c5568","flags":["-devel"],"package":"network","revision":0,"source":"hackage","src_sha256":"7f7620fef1a1af3d3d6747f510e73223a5c600e7d7fd9ace073d1222bdc63d85","version":"3.1.2.7"},{"cabal_sha256":"a16dd922947a6877defe52c4c38d1ab48ed3f85a826930f5d1a568741d619993","flags":[],"package":"th-compat","revision":0,"source":"hackage","src_sha256":"6b5059caf6714f47da92953badf2f556119877e09708c14e206b3ae98b8681c6","version":"0.1.3"},{"cabal_sha256":"a4765164ed0a2d1668446eb2e03460ce98645fbf083598c690846af79b7de10d","flags":[],"package":"network-uri","revision":0,"source":"hackage","src_sha256":"57856db93608a4d419f681b881c9b8d4448800d5a687587dc37e8a9e0b223584","version":"2.6.4.1"},{"cabal_sha256":"6042643c15a0b43e522a6693f1e322f05000d519543a84149cb80aeffee34f71","flags":["-conduit10","-mtl1","+network-uri","-warn-as-error","-warp-tests"],"package":"HTTP","revision":1,"source":"hackage","src_sha256":"d6091c037871ac3d08d021c906206174567499d5a26a6cb804cf530cd590fe2d","version":"4000.3.16"},{"cabal_sha256":"64abad7816ab8cabed8489e29f807b3a6f828e0b2cec0eae404323d69d36df9a","flags":[],"package":"base16-bytestring","revision":0,"source":"hackage","src_sha256":"1d5a91143ef0e22157536093ec8e59d226a68220ec89378d5dcaeea86472c784","version":"1.0.2.0"},{"cabal_sha256":"50ec0e229255d4c45cbdd568da011311b8887f304b931564886016f4984334d8","flags":[],"package":"base64-bytestring","revision":0,"source":"hackage","src_sha256":"fbf8ed30edde271eb605352021431d8f1b055f95a56af31fe2eacf6bdfdc49c9","version":"1.2.1.0"},{"cabal_sha256":"188d0b5a0491e8b686b32d9b144c9287760ba333d2509bf3f17e3d846fbc2332","flags":["-exe","+use-cbits"],"package":"cryptohash-sha256","revision":0,"source":"hackage","src_sha256":"73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6","version":"0.11.102.1"},{"cabal_sha256":"ccce771562c49a2b29a52046ca68c62179e97e8fbeacdae32ca84a85445e8f42","flags":["-example"],"package":"echo","revision":0,"source":"hackage","src_sha256":"c9fe1bf2904825a65b667251ec644f197b71dc5c209d2d254be5de3d496b0e43","version":"0.1.4"},{"cabal_sha256":"4d33a49cd383d50af090f1b888642d10116e43809f9da6023d9fc6f67d2656ee","flags":[],"package":"edit-distance","revision":1,"source":"hackage","src_sha256":"3e8885ee2f56ad4da940f043ae8f981ee2fe336b5e8e4ba3f7436cff4f526c4a","version":"0.2.2.1"},{"cabal_sha256":"24ac7b5f3d9fa3c2f70262b329f2a75f24e7fd829f88c189b388efa1bcd67eb2","flags":["+no-donna","+test-doctests","+test-hlint","+test-properties"],"package":"ed25519","revision":5,"source":"hackage","src_sha256":"d8a5958ebfa9309790efade64275dc5c441b568645c45ceed1b0c6ff36d6156d","version":"0.0.5.0"},{"cabal_sha256":"c084c043a40632d3cafcac50fb5eeff84d91edb070a54baa94945f1c976f97c0","flags":["+ofd-locking"],"package":"lukko","revision":2,"source":"hackage","src_sha256":"a80efb60cfa3dae18682c01980d76d5f7e413e191cd186992e1bf7388d48ab1f","version":"0.1.1.3"},{"cabal_sha256":"262a93dbf370be59f4ee57f3b1a51b338bc2c309797daa37c14f2262ae61dae4","flags":["-bundled-c-zlib","-non-blocking-ffi","-pkg-config"],"package":"zlib","revision":1,"source":"hackage","src_sha256":"807f6bddf9cb3c517ce5757d991dde3c7e319953a22c86ee03d74534bd5abc88","version":"0.6.2.3"},{"cabal_sha256":"eb34c3e2fa39f9819293045c03e56148a7125573c1de265cdfe5d967f1d71c6e","flags":["+base48","-cabal-syntax","+lukko","-mtl21","-old-directory","+use-network-uri"],"package":"hackage-security","revision":1,"source":"hackage","src_sha256":"bf22cd16dde7d6b7130463f4d7324b64a2964d9ef3f523df97d7cb98544d64a8","version":"0.6.2.1"},{"cabal_sha256":"2561adac8ce373910948066debe090a22b336b129ba5af18c0332524d16e72ce","flags":[],"package":"regex-base","revision":0,"source":"hackage","src_sha256":"7b99408f580f5bb67a1c413e0bc735886608251331ad36322020f2169aea2ef1","version":"0.94.0.2"},{"cabal_sha256":"b6421e5356766b0c0a78b6094ae2e3a6259b42c147b717283c03c1cb09163dca","flags":["-_regex-posix-clib"],"package":"regex-posix","revision":0,"source":"hackage","src_sha256":"c7827c391919227711e1cff0a762b1678fd8739f9c902fc183041ff34f59259c","version":"0.96.0.1"},{"cabal_sha256":"2088eb9368b920f80bbe4e3b03c3b8484090208f5c3b31645bd67a9ef7d26db4","flags":[],"package":"resolv","revision":4,"source":"hackage","src_sha256":"81a2bafad484db123cf8d17a02d98bb388a127fd0f822fa022589468a0e64671","version":"0.1.2.0"},{"cabal_sha256":null,"flags":["-debug-conflict-sets","-debug-expensive-assertions","-debug-tracetree","+lukko","+native-dns"],"package":"cabal-install","revision":null,"source":"local","src_sha256":null,"version":"3.6.2.0"}]}

(I know that this post was originally about 9.2.1., but the title says "recent versions of GHC" so perhaps this will still help someone)

@okeuday
Copy link

okeuday commented Aug 4, 2022

@Mikolaj From what I have seen, the cabal-install releases 3.2.0.0, 3.4.0.0, 3.4.1.0 and 3.6.2.0 have source downloads that are unable to bootstrap. The 3.6.2.0 also does not have a valid checksum in https://downloads.haskell.org/~cabal/cabal-install-3.6.2.0/SHA256SUMS . Will the cabal-install source code release be able to be built in isolation in the future?

@Mikolaj
Copy link
Member

Mikolaj commented Aug 4, 2022

@okeuday, thank you for your comments.

From what I have seen, the cabal-install releases 3.2.0.0, 3.4.0.0, 3.4.1.0 and 3.6.2.0 have source downloads that are unable to bootstrap.

I think the instruction for bootstrapping

https://github.com/haskell/cabal/tree/master/bootstrap

involve manually copying boostrap files from the repo. There is #7289 about including the files somewhere, but is downloading them really such a burden? It's not supposed to be a streamlined process, anyway --- for comfort you use cabal. Nor is it supposed to be exhaustive, since the person porting cabal may have yet another version of GHC or other special circumstances that we can't predict in advance.

The 3.6.2.0 also does not have a valid checksum in https://downloads.haskell.org/~cabal/cabal-install-3.6.2.0/SHA256SUMS.

Well spotted. If you that's crucial for you, please open a ticket. Is https://downloads.haskell.org/~cabal/cabal-install-3.8.1.0-rc1 OK in this respect? This should be the same in 3.8.1.0, to be released RSN.

Will the cabal-install source code release be able to be built in isolation in the future?

We don't have such plans, but we welcome discussion and contributions.

okeuday added a commit to CloudI/CloudI that referenced this issue Aug 10, 2022
…ox functionality was removed (cabal-install >= 3.4) without replacement functionality (haskell/cabal#6445).  cabal-install source code releases are unable to bootstrap with local dependencies due to undependable releases that promote opaque binaries (haskell/cabal#7904).  Manually create a Cabal sandbox without cabal-install for Haskell GHC compilation.
@ulysses4ever
Copy link
Collaborator

Should this be closed due to inactivity and no clear goal?

@andreabedini
Copy link
Collaborator

👍 I am keen to make sure everything mentioned in this thread works but I am not sure what does not (or did not).

@okeuday
Copy link

okeuday commented Oct 18, 2023

The clear goal was to have cabal-install compile from source. What is unclear is why cabal-install is unable to have a source code release that always compiles correctly from source (i.e., bootstrapping). Releasing opaque binaries isn't a valid solution.

@gbaz
Copy link
Collaborator

gbaz commented Oct 18, 2023

cabal-install can compile from source and bootstrap. It just requires that it be compiled with the versions of ghc it is targeted for, and not other versions. I don't think there is an actionable issue here.

@gbaz gbaz closed this as completed Oct 18, 2023
@okeuday
Copy link

okeuday commented Oct 18, 2023

@gbaz Other compilation would make the version dependency explicit in the build process, so it is clear. I see no reason why cabal-install is unable to do that for its dependency on ghc. Adding the explicit version dependency would be an actionable change that is possible.

@ulysses4ever
Copy link
Collaborator

All right, let's inspect more. @okeuday could you, please, update the issue description (the top post) with your current problem? We need a precise description of your environment, i.e. versions of tools you're using, and what you're trying to achieve, i.e. whethere you're bootstrapping or trying to cabal install cabal-install. If you're bootstrapping, don't hesitate to first consult with https://github.com/haskell/cabal/blob/master/bootstrap/README.md first.

@ulysses4ever ulysses4ever reopened this Oct 18, 2023
@okeuday
Copy link

okeuday commented Oct 18, 2023

@ulysses4ever It has been more than 1 year since I checked cabal-install compilation of various versions, so I don't remember all the details. It looks like I was using GHC 9.2.4 for cabal-install 3.6.2.0, GHC 9.0.2 for cabal-install 3.4.0.0, GHC 8.10.7 for cabal-install 3.2.0.0, at that time (each of those cabal-install source code compilations failed). I don't have more time to spend on cabal-install at this point in time. The removal of sandboxes helped me to avoid it as a dependency, so I don't use cabal-install as much now.

@ulysses4ever
Copy link
Collaborator

Thank you for explaining your case. I'm afraid we can't move forward with this issue without a clear explanation what the goal was and where it failed.

If the issue raises again, please feel free to open a new ticket with a clear reproducer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants