[GHC] #15425: GHC does not warn when two conflicting packages with same name are given via a dependent package and -package-db
GHC
ghc-devs at haskell.org
Fri Jul 20 13:37:49 UTC 2018
#15425: GHC does not warn when two conflicting packages with same name are given
via a dependent package and -package-db
-------------------------------------+-------------------------------------
Reporter: nh2 | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.8.1
Component: Build System | Version: 8.4.3
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
So I'm compiling a Setup.hs of `mypackage`, directly with `ghc` and
without use of `Cabal`.
It has a custom build type and imports `Distribution.Extra.Doctest` from
`cabal-doctest`.
For compiling `mypackage`'s Setup.hs I give a `-package-db` that contains
a custom `Cabal` package.
But when I compiled `doctest`, I did not give that custom `Cabal` package.
I compile with
{{{
ghc -package-db=/tmp/nix-build-hsyslog-5.0.1.drv-0/setup-package.conf.d
-package Cabal -j4 -threaded --make -o Setup -odir $TMPDIR -hidir $TMPDIR
$i -fforce-recomp -keep-tmp-files -v5
}}}
The given package db looks like this:
{{{
% ls -lah /tmp/nix-build-hsyslog-5.0.1.drv-0/setup-package.conf.d
total 56K
drwxr-xr-x 2 niklas niklas 4.0K Jul 20 03:14 ./
drwxr-xr-x 12 niklas niklas 4.0K Jul 20 03:49 ../
-r--r--r-- 1 niklas niklas 11K Jul 20 02:30
Cabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI.conf
-r--r--r-- 1 niklas niklas 2.3K Jul 20 02:30 cabal-
doctest-1.0.6-E57gwmEN5fa2uY0bq8bb44.conf
-rw-rw-r-- 1 niklas niklas 31K Jul 20 03:14 package.cache
-rw-r--r-- 1 niklas niklas 0 Jul 20 02:30 package.cache.lock
}}}
Full [https://pastebin.com/raw/HpVLbe4A ghc-pkg dump -f /tmp/nix-build-
hsyslog-5.0.1.drv-0/setup-package.conf.d output]
This results in the linker flags:
{{{
-L/nix/store/hfi080vzqqzfip6bd6x4cxc2jgj56xn3-ghc-8.4.3/lib/ghc-8.4.3/Cabal-2.2.0.1
-L/nix/store/6x9r3kqn8h961ilaw2nj474jrfyg28lp-
Cabal-2.2.0.1/ghc-8.4.3/Cabal-2.2.0.1
...
-lHSCabal-2.2.0.1
-lHSCabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI
}}}
When this happens, GHC will always prefer the `Cabal` version from the
global package db, and not the one I have given with `-package`.
This results in my compiled `Setup` file to not use the Cabal version I
desire.
I would expect GHC to warn me when two Cabal versions are at play, or
entirely refuse to compile, instead of picking the one that I have NOT
explicitly specified.
See full `-v5` ghc output here: https://pastebin.com/raw/jGbLPjxF
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15425>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list