haskell / haskell/cabal

Cabal fails to "properly" fetch and build dependencies from github when mentioned as `source-repository-package` in `cabal.project`

Open
#8,406 7 comments 0 reactions 0 assignees View on GitHub
cabal-install: source-repository-package type: user-question
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
A cabal project that fetches certain dependencies from github fails to compile with errors of the following kind.

**To Reproduce**

[composewell/streamly-process](https://github.com/composewell/streamly-process/) depends on [composewell/streamly](https://github.com/composewell/streamly). Here's streamly-process `cabal.project`. Building it with v2-build gives the error given below.

```
packages: streamly-process.cabal

source-repository-package
type: git
location: https://github.com/composewell/streamly.git
tag: master

source-repository-package
type: git
location: https://github.com/composewell/streamly.git
tag: master
subdir: core

jobs: 1
```

```
$ cabal v2-build ...

Cloning into '/home/twitu/Code/streamly-process/dist-newstyle/src/streamly-ec6df83dbd01b094'...
-- snip messages
In order, the following will be built (use -v for more details):
- streamly-core-0.1.0 (lib:streamly-core) (requires build)
- streamly-0.9.0 (lib:streamly) (requires build)
- streamly-process-0.2.0.1 (lib) (first run)
src/Streamly/Internal/Data/Parser/ParserD/Type.hs:211:2: error:
fatal error: assert.hs: No such file or directory
211 |
| ^
|
211 |
| ^
compilation terminated.

src/Streamly/Internal/Data/Array/Unboxed/Mut/Type.hs:214:2: error:
fatal error: assert.hs: No such file or directory
214 | #include "inline.hs"
| ^~~~~~~~~~~
|
214 | #include "inline.hs"
| ^
compilation terminated.

src/Streamly/Internal/Data/Parser/ParserD.hs:200:2: error:
fatal error: assert.hs: No such file or directory
200 |
| ^
|
200 |
| ^
compilation terminated.

src/Streamly/Internal/Data/Array/Unboxed/Mut/Type.hs:1:1: error:
`gcc' failed in phase `C pre-processor'. (Exit code: 1)
|
1 | {-# LANGUAGE UnboxedTuples #-}
| ^

src/Streamly/Internal/Data/Parser/ParserD.hs:1:1: error:
`gcc' failed in phase `C pre-processor'. (Exit code: 1)
|
1 | #include "inline.hs"
| ^

src/Streamly/Internal/Data/Parser/ParserD/Type.hs:1:1: error:
`gcc' failed in phase `C pre-processor'. (Exit code: 1)
|
1 | {-# LANGUAGE UndecidableInstances #-}
| ^

```

**Expected behavior**
The build should succeed.

**System information**
Ubuntu 20.04
```
haskell-language-server version: 1.7.0.0 (GHC: 9.2.2) (PATH: /home/twitu/.ghcup/hls/1.7.0.0/lib/haskell-language-server-1.7.0.0/bin/haskell-language-server-wrapper)
Tool versions found on the $PATH
cabal: 3.8.1.0
stack: 2.7.5
ghc: 8.10.7
```

**Additional context**
The build succeeds when I clone the dependencies and use the local paths as given below.

```
packages: streamly-process.cabal, ../streamly, ../streamly/core
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the supplied streamly-process cabal.project and cabal v2-build command, then trace Cabal's handling of the two source-repository-package entries and their subdir paths. Compare this with the working local packages configuration; done means the GitHub-based configuration builds successfully without missing included files.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github, haskell
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.