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

Couldn't find Nim version #125

Closed
andreaferretti opened this issue May 19, 2015 · 5 comments
Closed

Couldn't find Nim version #125

andreaferretti opened this issue May 19, 2015 · 5 comments

Comments

@andreaferretti
Copy link
Contributor

I have installed Nim on Ubuntu 15.04 using the instructions on the Nim Github page (i.e. using Koch, and then adding $NIMHOME/bin to the $PATH).

I am now trying to install nimble, but when I do nim c -r src/nimble install, the process fails with Couldn't find Nim version..

Apparently, the issue stems from the fact that running osproc.execCmdEx("nim -v") fails with

(output: /bin/sh: 1: nim: not found
, exitCode: 127)

I am not sure how to fix this, as the nim command is certainly in the $PATH (and in fact nim -v works correctly in the same shell).

@dom96
Copy link
Collaborator

dom96 commented May 19, 2015

What happens when you execute which nim?

@dom96
Copy link
Collaborator

dom96 commented May 19, 2015

Nimble actually uses findExe to find the path to the Nim executable. Try it and see what it returns.

@andreaferretti
Copy link
Contributor Author

When I do which nim, I do not find anything. I have tried

import os, osproc

echo findExe("nim")

and it prints /home/papillon/tools/Nim/bin/nim, as expected. If then I try

import os, osproc

echo execCmdEx("nim -v")
echo execCmdEx("/home/papillon/tools/Nim/bin/nim -v")

the second command prints the expected output, but the first one fails with

(output: /bin/sh: 1: nim: not found
, exitCode: 127)

as I remarked above. It seems that the issue is that nimble finds the correct path for the nim executable, but then tries to start nim without the full path

@andreaferretti
Copy link
Contributor Author

This seems the issue:

proc getNimBin*: string =
  result = "nim"
  if findExe("nim") != "": result = "nim"
  elif findExe("nimrod") != "": result = "nimrod"

Instead it should return whatever findExe returns. If I change this to

proc getNimBin*: string =
  result = "nim"
  let exe = findExe("nim")
  if exe != "": result = exe
  elif findExe("nimrod") != "": result = "nimrod"

the installation proceeds correctly

@HOLYCOWBATMAN
Copy link

Same thing happened when i tried to install nimble in a vagrant box ubuntu 14.04 today. Using the result of findExe("nim") instead of "nim" fixed it.

@dom96 dom96 closed this as completed in 2ed0984 Nov 24, 2015
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