Closed
Description
In MinGW, pkgconf
(at least 2.1.0) offers /mingw64/include
as an include-dirs
. This is rejected by saying the following:
data-dir: C:\Users\Javier\aa\.
hs-libraries: HSaa-0.1.0.0-inplace
extra-libraries: tcl86 tclstub86 tre intl
extra-libraries-static: tcl86 tclstub86 tre intl z
include-dirs:
C:/msys64/mingw64/include /mingw64/include /mingw64/include
...
'C:\ghcup\bin\ghc-pkg.exe' exited with an error:
aa-0.1.0.0: Warning: haddock-interfaces: C:\Users\Javier\aa\dist-newstyle\build\x86_64-windows\ghc-9.6.3\aa-0.1.0.0\doc\html\aa\aa.haddock doesn't exist or isn't a file
aa-0.1.0.0: Warning: haddock-html: C:\Users\Javier\aa\dist-newstyle\build\x86_64-windows\ghc-9.6.3\aa-0.1.0.0\doc\html\aa doesn't exist or isn't a directory
aa-0.1.0.0: include-dirs: /mingw64/include is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (use --force to override)
aa-0.1.0.0: include-dirs: /mingw64/include is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (use --force to override)
CallStack (from HasCallStack):
dieWithException, called at src\Distribution\Simple\Program\Run.hs:160:7 in Cabal-3.11.0.0-inplace:Distribution.Simple.Program.Run
CallStack (from HasCallStack):
dieWithException, called at src\Distribution\Client\ProjectOrchestration.hs:1226:21 in cabal-install-3.11.0.0-inplace:Distribution.Client.ProjectOrchestration
I'm unsure whether this is a Cabal bug or a GHC (or for that matter ghc-pkg) bug, but perhaps Cabal can fix it? There should be some way of normalizing that path. Note that the path exists:
❯ ls /mingw64/include
_bsd_types.h d3d11_3.idl flif_enc.h math.h ole2ver.h stddef.h windows.devices.power.h
....
This seems to be a recurrent issue, which is due to the specification in the .pc
file:
- graphite2.pc doesn't use full filepaths msys2/MINGW-packages#6958
- MSYS paths incorrectly recognized as relative on Windows commercialhaskell/stack#1989
- Does not build on Windows haskell-hvr/brotli#3
To Reproduce
Steps to reproduce the behavior:
$ cat aa.cabal
cabal-version: 3.0
name: aa
version: 0.1.0.0
-- synopsis:
-- description:
license: BSD-3-Clause
license-file: LICENSE
author: Javier Sagredo
maintainer: javier.sagredo@iohk.io
-- copyright:
category: Codec
build-type: Simple
extra-doc-files: CHANGELOG.md
-- extra-source-files:
common warnings
ghc-options: -Wall
library
import: warnings
exposed-modules: MyLib
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.18.1.0
hs-source-dirs: src
default-language: Haskell2010
pkgconfig-depends: tcl, tre
$ cabal build
Warning: this is a debug build of cabal-install with assertions enabled.
Build profile: -w ghc-9.6.3 -O1
In order, the following will be built (use -v for more details):
- aa-0.1.0.0 (lib) (first run)
Warning: this is a debug build of cabal-install with assertions enabled.
Preprocessing library for aa-0.1.0.0...
Building library for aa-0.1.0.0...
Warning: this is a debug build of cabal-install with assertions enabled.
Error: [Cabal-7125]
Failed to build aa-0.1.0.0. The failure occurred during the final install step. The exception was:
Error: [Cabal-8012]
'C:\ghcup\bin\ghc-pkg.exe' exited with an error:
aa-0.1.0.0: Warning: haddock-interfaces: C:\Users\Javier\aa\dist-newstyle\build\x86_64-windows\ghc-9.6.3\aa-0.1.0.0\doc\html\aa\aa.haddock doesn't exist or isn't a file
aa-0.1.0.0: Warning: haddock-html: C:\Users\Javier\aa\dist-newstyle\build\x86_64-windows\ghc-9.6.3\aa-0.1.0.0\doc\html\aa doesn't exist or isn't a directory
aa-0.1.0.0: include-dirs: /mingw64/include is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (use --force to override)
aa-0.1.0.0: include-dirs: /mingw64/include is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (use --force to override)
Expected behavior
It should understand either /mingw64/include
as C:\msys64\mingw64\include
System information
- Operating system: Windows 11, MINGW64_NT-10.0-22621
cabal
HEAD (but any would do)ghc
9.6.3