Description
Your environment
Which OS do you use?
Ubuntu 22.04
Which version of GHC do you use and how did you install it?
9.4.8 from GHCup
How is your project built (alternative: link to the project)?
Using cabal, a single library and a test-suite.
Which LSP client (editor/plugin) do you use?
VS Code+vscode-haskell
Which version of HLS do you use and how did you install it?
2.5.0.0 from GHCup
Have you configured HLS in any way (especially: a hie.yaml
file)?
Yes and no (neither work)
What's wrong?
Code analysis works fine on my library, but not in my test-suite.
I found some "workarounds" such as:
- Building HLS from source according to: https://haskell-language-server.readthedocs.io/en/latest/troubleshooting.html#static-binaries-and-template-haskell-support;
- Fully reinstalling the haskell toolchain;
- Removing .stack, .cabal and .ghc caches;
- Generally messing around with different versions of GHC (and changing required base version), cabal and HLS;
- Use a hie.yaml file.
None of the above seem to solve the error in the debug information part, or result in different issues such as being unable to resolve a build-scheme.
Given what I read in other issues and how long they have been open there won't be a solution soon, so preferably I'd like to know if there is something I haven't tried yet. If not, I'd like to know if it is possible to disable HLS for specific files in my project so I don't get bothered by the error message all the time.
Debug information
Failed to run ["cabal","v2-repl","monads-and-applicatives:test:monads-and-applicatives-test"] in directory "/home/timo/Documents/UU/AFP/Weekly/monads-and-applicatives". Consult the logs for full command and error.
Failed command: cabal --builddir=/home/timo/.cache/hie-bios/dist-monads-and-applicatives-3d485c38466d4eb1204f0f6844ca30a0 v2-repl --with-compiler /home/timo/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/timo/.cache/hie-bios/ghc-pkg-8544494cfbb2b2d94b74ba47851bfadd monads-and-applicatives:test:monads-and-applicatives-test
Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
- monads-and-applicatives-0.1.0.0 (lib) (first run)
- monads-and-applicatives-0.1.0.0 (test:monads-and-applicatives-test) (first run)
Preprocessing library for monads-and-applicatives-0.1.0.0..
Building library for monads-and-applicatives-0.1.0.0..
<no location info>: error:
Warning: Couldn't figure out linker information!
Make sure you're using GNU ld, GNU gold or the built in OS X linker, etc.
collect2: fatal error: cannot find ‘ld’
compilation terminated.
`gcc' failed in phase `Linker'. (Exit code: 1)
Error: cabal: Failed to build monads-and-applicatives-0.1.0.0 (which is
required by test:monads-and-applicatives-test from
monads-and-applicatives-0.1.0.0).