haskell / haskell/cabal

Weird problem: cabal-3.6.0.0 fails to build shared executables with `Assertion failed`

Open
#7,690 17 comments 0 reactions 0 assignees View on GitHub
blocked: needs reproducer cabal-install: cmd/install type: assertion-fail type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

### Description

When `~/.cabal/config` contains
```yaml

```
build fails in a weird way:
```
$ cabal install happy
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
Assertion failed
CallStack (from HasCallStack):
assert, called at src/Distribution/Client/ProjectPlanning.hs:238:5 in main:Distribution.Client.ProjectPlanning
```

### To Reproduce
Steps to reproduce the behavior:

Edit `~/.cabal/config` as shown above, and try to install anything reasonable from Hackage - like above.

**Expected behavior**

Something like this
```
$ cabal install happy
Resolving dependencies...
Up to date
Symlinking 'happy' to '/Users/ur20980/.cabal/bin/happy'
```
or a real build, like
```
$ cabal install hlint hoogle hpack hscolour
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
- blaze-builder-0.4.2.1 (lib) (requires download & build)
- base-compat-0.12.0 (lib) (requires download & build)
- base-orphans-0.8.5 (lib) (requires download & build)
- base64-bytestring-1.2.1.0 (lib) (requires download & build)
- bsb-http-chunked-0.0.0.4 (lib) (requires download & build)
- basement-0.0.12 (lib) (requires download & build)
- byteorder-1.0.4 (lib:byteorder) (requires download & build)
- cabal-doctest-1.0.8 (lib) (requires download & build)
- clock-0.8.2 (lib) (requires download & build)
- colour-2.3.6 (lib) (requires download & build)
- cmdargs-0.10.21 (lib) (requires download & build)
- cereal-0.5.8.1 (lib) (requires download & build)
- data-default-class-0.1.2.0 (lib:data-default-class) (requires download & build)
- file-embed-0.0.15.0 (lib) (requires download & build)
. . . . .
- hpack-0.34.4 (exe:hpack) (requires download & build)
- hoogle-5.0.18.2 (exe:hoogle) (requires download & build)
Downloading base-orphans-0.8.5
Downloaded base-orphans-0.8.5
Downloading basement-0.0.12
Starting base-orphans-0.8.5 (lib)
Building base-orphans-0.8.5 (lib)
Downloaded basement-0.0.12
Downloading byteorder-1.0.4
Starting basement-0.0.12 (lib)
Installing base-orphans-0.8.5 (lib)
Building basement-0.0.12 (lib)
. . . . .
Installing hoogle-5.0.18.2 (lib)
Completed hoogle-5.0.18.2 (lib)
Starting hoogle-5.0.18.2 (exe:hoogle)
Building hoogle-5.0.18.2 (exe:hoogle)
Installing hoogle-5.0.18.2 (exe:hoogle)
Completed hoogle-5.0.18.2 (exe:hoogle)
Symlinking 'hoogle' to '/Users/ur20980/.cabal/bin/hoogle'
Symlinking 'hlint' to '/Users/ur20980/.cabal/bin/hlint'
Symlinking 'hpack' to '/Users/ur20980/.cabal/bin/hpack'
Symlinking 'HsColour' to '/Users/ur20980/.cabal/bin/HsColour'
```

### System information
- Operating system: macOS Big Sur 11.6
- Xcode-13
- `cabal-3.6.0.0`, `ghc-9.0.1` and `ghc-8.10.7` (same problem with both)

### Additional context
Everything (GHC, Cabal, Stack) is installed via `ghcup`, which is now 0.1.17.1.
It used to work until a couple of days ago. Completely uninstalling (and removing the directories of) Cabal and both GHC's did not help.

Removing custom config and leaving the builds/installs to be static works, but it's not an acceptable workaround because of hugely increased consumption of disk space.

My "desired" `~/.cabal/config`: [cabal-config.txt](https://github.com/haskell/cabal/files/7246051/cabal-config.txt)

~~Note: there's a problem with `jobs: $ncpus` in the `~/.cabal/config` - it simply does no work on MacOS, as `$ncpus` value is nothing.~~ _Turned out false alarm for $ncpus._

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.