haskell / haskell/cabal

Building a DLL causes cabal to build every module twice.

Open
#6,993 3 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Consider the following cabal file:
```
cabal-version: >=1.10
name: bug
version: 0.1.0.0
license-file: LICENSE
build-type: Simple
extra-source-files: CHANGELOG.md

foreign-library bug
type: native-shared
options: standalone
other-modules: Lib
build-depends: base
c-sources: wrapper.c
default-language: Haskell2010
```
This file is similar to the ones provided by the user guides.
By default, cabal first builds the modules, _builds the same modules again_, and then links.
Inserting `ghc-options: -fPIC` into the file mitigates this issue.

Tested with cabal 3.2.0.0 and ghc 8.10.1.

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.