haskell / haskell/haskell-language-server
loadArchive failed on `.dll.a` with Template Haskell
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 12
Description
### 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.