Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with "cannot open file: std/private/decode_helpers" #88

Open
omentic opened this issue Aug 2, 2021 · 13 comments
Open

Build fails with "cannot open file: std/private/decode_helpers" #88

omentic opened this issue Aug 2, 2021 · 13 comments
Labels
build issue question Further information is requested

Comments

@omentic
Copy link

omentic commented Aug 2, 2021

[~]$ nimble install -p:-d:explicitSourcePath:~/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_3562/githubcom_PMunchnimlsp/src/nimlsppkg/suggestlib.nim(11, 8) template/generic instantiation of `mImport` from here
~/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

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?

@PMunch
Copy link
Owner

PMunch commented Aug 9, 2021

-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.

@omentic
Copy link
Author

omentic commented Aug 9, 2021

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
[~]$

@PMunch
Copy link
Owner

PMunch commented Aug 9, 2021

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.

@omentic
Copy link
Author

omentic commented Aug 9, 2021

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
[~]$

@PMunch
Copy link
Owner

PMunch commented Aug 9, 2021

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?

@omentic
Copy link
Author

omentic commented Aug 9, 2021

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.

@PMunch
Copy link
Owner

PMunch commented Aug 9, 2021

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..

@omentic
Copy link
Author

omentic commented Aug 10, 2021

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]$

@PMunch
Copy link
Owner

PMunch commented Aug 10, 2021

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

@ghost
Copy link

ghost commented Sep 30, 2021

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.

@PMunch
Copy link
Owner

PMunch commented Oct 4, 2021

Yes, for best compatibility with Nim tooling you are recommended to grab Nim via choosenim instead.

@omentic
Copy link
Author

omentic commented Jan 29, 2022

@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?

@PMunch
Copy link
Owner

PMunch commented Jan 29, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants