Your environment
Which OS do you use?
Windows 11 25H2 (internal version 26200.8246)
Which version of GHC do you use and how did you install it?
GHC 9.14.1 from GHCup
How is your project built (alternative: link to the project)?
Cabal 3.16
Which LSP client (editor/plugin) do you use?
VSCode + Haskell plugin
Which version of HLS do you use and how did you install it?
HLS 2.13.0.0 from GHCup
Have you configured HLS in any way (especially: a hie.yaml file)?
No
Steps to reproduce
- Pull in a C library dependency (e.g., via
pkg-config-depends: libclang)
- Install
mingw-w64-x86_64-clang-libs in MSYS2 and set PKG_CONFIG_PATH accordingly
- Load any Haskell source file with a Template Haskell splice
- Encounter the error
loadArchive: failed for libclang.dll.a
Expected behaviour
No error should occur.
Actual behaviour
HLS reports an error loadArchive: failed for the library dependency libclang.dll.a.
Debug information
Removing libclang.dll.a from MSYS2 forces pkg-config (and in turn Cabal and GHC) to fall back to the static library libclang.a, and the error disappears. Therefore, I suspect that using -optl-static could also solve the problem, but I do want to link with the dynamic libraries for the application in this case. I guess the problem is that GHC cannot load import libraries like libclang.dll.a (or it cannot find the corresponding libclang.dll which provides the actual code).
I wonder if there is any option to proivide compiler/linker options (-optl-static in this case) to HLS only (and not Cabal/GHC at build time), because messing with MSYS2 library files seems a really fragile workaround.
Your environment
Which OS do you use?
Windows 11 25H2 (internal version 26200.8246)
Which version of GHC do you use and how did you install it?
GHC 9.14.1 from GHCup
How is your project built (alternative: link to the project)?
Cabal 3.16
Which LSP client (editor/plugin) do you use?
VSCode + Haskell plugin
Which version of HLS do you use and how did you install it?
HLS 2.13.0.0 from GHCup
Have you configured HLS in any way (especially: a
hie.yamlfile)?No
Steps to reproduce
pkg-config-depends: libclang)mingw-w64-x86_64-clang-libsin MSYS2 and setPKG_CONFIG_PATHaccordinglyloadArchive: failedforlibclang.dll.aExpected behaviour
No error should occur.
Actual behaviour
HLS reports an error
loadArchive: failedfor the library dependencylibclang.dll.a.Debug information
Removing
libclang.dll.afrom MSYS2 forcespkg-config(and in turn Cabal and GHC) to fall back to the static librarylibclang.a, and the error disappears. Therefore, I suspect that using-optl-staticcould also solve the problem, but I do want to link with the dynamic libraries for the application in this case. I guess the problem is that GHC cannot load import libraries likelibclang.dll.a(or it cannot find the correspondinglibclang.dllwhich provides the actual code).I wonder if there is any option to proivide compiler/linker options (
-optl-staticin this case) to HLS only (and not Cabal/GHC at build time), because messing with MSYS2 library files seems a really fragile workaround.