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

On Linux, "nimsuggest" crashes if Nim is installed in /usr/bin and the library in /usr/lib/nim #23695

Closed
lscrd opened this issue Jun 7, 2024 · 6 comments

Comments

@lscrd
Copy link

lscrd commented Jun 7, 2024

Description

If Nim is installed in the standard locations of a Linux system, nimsuggest expects the library to be installed in /usr/lib instead of /usr/lib/nim.

The issue has been encountered on a Manjaro system, but should exist on any Linux system and even on any Posix system.

Nim Version

Nim Compiler Version 2.0.4 [Linux: amd64]
Compiled at 2024-05-04
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

Current Output

For instance, for command "nimsuggest somefile.nim":

Error: cannot open '/usr/lib/system.nim'
lineinfos.nim(314)       raiseRecoverableError
Error: unhandled exception: cannot open '/usr/lib/system.nim' [ERecoverableError]

Expected Output

No error.

Possible Solution

No response

Additional Information

Looking at the sources, it appears that nimsuggest doesn’t use the same rule as the compiler to find the location of the library. For Posix system, the compiler adds special rules if "nim" binary is installed in /usr/bin or /usr/local/bin.

@jmgomez
Copy link
Collaborator

jmgomez commented Jun 8, 2024

Related: #21328

@jmgomez
Copy link
Collaborator

jmgomez commented Jun 8, 2024

#23201 and #22369

jmgomez added a commit to jmgomez/Nim that referenced this issue Jun 8, 2024
(Not tested)
@jmgomez
Copy link
Collaborator

jmgomez commented Jun 8, 2024

@lscrd Can you give a shot at the PR? You will need to ./build_all.sh and then replace your nimsuggest with the one in the PR.

Thanks

@lscrd
Copy link
Author

lscrd commented Jun 8, 2024

@jmgomez
I did the test but nimsuggest still crashes. I noted that the path to the library is also computed in the procedure handleCmdLine which is called when nimsuggest is the main module. So I suppose that a modification should be done here too.

@jmgomez
Copy link
Collaborator

jmgomez commented Jun 9, 2024

@lscrd I changed it as well, but the chunk didnt make it into the commit. Apologies. Should be up now.

@lscrd
Copy link
Author

lscrd commented Jun 10, 2024

@jmgomez
I applied the modifications and now nimsuggest works.
Thanks!

@Araq Araq closed this as completed in 1cbcbd9 Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants