Skip to content

HLS fails on package with foreign-library #3862

@DavidEichmann

Description

@DavidEichmann

Your environment

OS: Ubuntu Linux
GHC: 9.6.3 (from ghcup)
project: https://github.com/DavidEichmann/hls-bug-report-01

editor: vscode: 1.84.1
vscode: haskell extension: 2.4.1

HLS: 2.4.0.0 (ghcup)

Steps to reproduce

git clone https://github.com/DavidEichmann/hls-bug-report-01
cd hls-bug-report-01
cabal build # verify that biuld works
haskell-language-server

Expected behaviour

Haskell language server runs without error

Actual behaviour

Haskell language server fails

Debug information

Failed to run ["cabal","v2-repl","hls-foreign-lib-fail:lib:myFlib"] in directory
  "/home/david/Desktop/tmp". Consult the logs for full command and error.
  Failed command: cabal
  --builddir=/home/david/.cache/hie-bios/dist-tmp-48326bca48508b2e48e44c21ade3d545 v2-repl
  --with-compiler /home/david/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg
  /home/david/.cache/hie-bios/ghc-pkg-4e9277ded88027944646c26dd963fb21
  hls-foreign-lib-fail:lib:myFlib

  Error: cabal: Unknown target 'hls-foreign-lib-fail:lib:myFlib'.
  The package hls-foreign-lib-fail has no library component 'myFlib'.




  Process Environment:
  HIE_BIOS_GHC: /home/david/.ghcup/ghc/9.6.3/lib/ghc-9.6.3/bin/ghc-9.6.3
  HIE_BIOS_GHC_ARGS: -B/home/david/.ghcup/ghc/9.6.3/lib/ghc-9.6.3/lib

Analysis

You can see that HLS is trying to use target string hls-foreign-lib-fail:lib:myFlib, but this is incorrect! The ...:lib:... should be ...:flib:... as we're dealing with a foreign-library.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions