Open omentic opened 3 years ago
-p
adds a path as a search path, so -p:-d:explicitSourcePath
wouldn't do what you think it does. It would try to search for the missing files in a directory -d:explicitSourcePath
. Try passing the explicitSourcePath
argument with a fully expanded path, not sure if that'll help, but it can't hurt.
Using -d:explicitSourcePath
with a fully expanded path still fails silently.
[~]$ nimble install -d:explicitSourcePath:/home/user/Projects/contrib/Nim nimlsp
Downloading https://github.com/PMunch/nimlsp using git
Verifying dependencies for nimlsp@0.3.2
Info: Dependency on astpatternmatching@any version already satisfied
Verifying dependencies for ast_pattern_matching@1.0.0
Info: Dependency on jsonschema@>= 0.2.1 already satisfied
Verifying dependencies for jsonschema@0.2.1
Info: Dependency on ast_pattern_matching@any version already satisfied
Verifying dependencies for ast_pattern_matching@1.0.0
[~]$
Hmm, and with -p:-d
and fully expanded path? I can't see -p
in the Nimble docs, but I've seen it suggested elsewhere since I last replied.
It gives the same error as a relative path above:
[~]$ nimble install -p:-d:explicitSourcePath:/home/user/Projects/contrib/Nim nimlsp
Downloading https://github.com/PMunch/nimlsp using git
Verifying dependencies for nimlsp@0.3.2
Info: Dependency on astpatternmatching@any version already satisfied
Verifying dependencies for ast_pattern_matching@1.0.0
Info: Dependency on jsonschema@>= 0.2.1 already satisfied
Verifying dependencies for jsonschema@0.2.1
Info: Dependency on ast_pattern_matching@any version already satisfied
Verifying dependencies for ast_pattern_matching@1.0.0
Installing nimlsp@0.3.2
Building nimlsp/nimlsp using c backend
/tmp/nimble_228384/githubcom_PMunchnimlsp/src/nimlsppkg/suggestlib.nim(11, 8) template/generic instantiation of `mImport` from here
/home/user/Projects/contrib/Nim/nimsuggest/sexp.nim(15, 19) Error: cannot open file: std/private/decode_helpers
Prompt: Build failed for 'nimlsp@0.3.2', would you like to try installing 'nimlsp@#head' (latest unstable)? [y/N]
Answer: n
Tip: 10 messages have been suppressed, use --verbose to show them.
Error: Aborting installation due to build failure
[~]$
Hmm, curious. And what Nim sources are you pointing to? Can you confirm that the named module actually exists in the lib folder of those sources?
I'm pointing to a cloned copy of https://github.com/nim-lang/Nim. std/private/decode_helpers
exists as Nim/lib/std/private/decode_helpers.nim
.
Hmm, very weird.. Could you try to clone NimLSP and build manually to see if that works? Honestly not sure what's going on here.. What version of Nim/Nimble do you have installed by the way? The sources you point to must match the Nim version you're compiling with. This should probably be a check of some kind somewhere..
Nim 1.4.8, Nimble 0.13.1. I'm pointing to devel
sources, maybe that's the problem?
[nimlsp]$ nimble build
Verifying dependencies for nimlsp@0.3.2
Info: Dependency on astpatternmatching@any version already satisfied
Verifying dependencies for ast_pattern_matching@1.0.0
Info: Dependency on jsonschema@>= 0.2.1 already satisfied
Verifying dependencies for jsonschema@0.2.1
Info: Dependency on ast_pattern_matching@any version already satisfied
Verifying dependencies for ast_pattern_matching@1.0.0
Building nimlsp/nimlsp using c backend
/home/user/nimlsp/src/nimlsppkg/suggestlib.nim(11, 8) template/generic instantiation of `mImport` from here
/home/user/nimlsp/src/nimlsppkg/suggestlib.nim(7, 14) Error: cannot open file: /usr/nimsuggest/nimsuggest.nim
Tip: 10 messages have been suppressed, use --verbose to show them.
Error: Build failed for package: nimlsp
... Execution failed with exit code 1
... Command: /usr/bin/nim c --colors:on --noNimblePath -d:NimblePkgVersion=0.3.2 --path:/home/user/.nimble/pkgs/ast_pattern_matching-1.0.0 --path:/home/user/.nimble/pkgs/jsonschema-0.2.1 --path:/home/user/.nimble/pkgs/ast_pattern_matching-1.0.0 --hints:off -o:/home/user/nimlsp/nimlsp /home/user/nimlsp/src/nimlsp.nim
[nimlsp]$
Yeah, as I said the sources must match the version you're compiling with. Try again with 1.4.8 sources and it should work
I was having the same problem (trying to compile nimlsp against the current git version of Nim sources while using Nim 1.4.8 on my system). As per your suggestion, grabbing the 1.4.8 sources from the Nim website and doing a nimble install -p:-d:explicitSourcePath:/path/to/uncompressed/nim/sources/
worked. It was able to build and install without any further issues. The source path does need to be absolute and nimlsp is dependent on the location you provided still being there after building/installing. People who use their distribution-packaged version of Nim (Arch, for example) might run into trouble because it installs sources with a different hierarchy than those in official Nim source tarballs.
Yes, for best compatibility with Nim tooling you are recommended to grab Nim via choosenim
instead.
@PMunch Considering a lot of people have been having this problem, any chance of having nimlsp just download the right sources if it can't find them?
I'd rather not replicate the logic of choosenim/your package manager in NimLSP. I've asked the maintainer of choosenim if we could get some kind of hooking system that could rebuild NimLSP when you change versions, which would at least help a little bit. But it could probably have some kind of check to see which version you're building against and error out with a better message if it detects an invalid setup.
I don't have
choosenim
on my system, so I'm pointing it to Nim's git repository with-p:-d:explicitSourcePath
(just-d:explicitSourcePath
failed silently). Nim unfortunately still can't find some files.The missing files seem to be in Nim/lib. How can I tell Nimble to look here?