Open timotheecour opened 5 years ago
IIRC the main reason I chose to do it this way is simplicity, supporting both symlinks and this proxy exe would have been more complex.
To be honest I think the underlying bug should be fixed, even if choosenim uses symlinks it won't fix this problem.
windows can use symlinks too, eg https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/
hopefully fixed by https://github.com/nim-lang/Nim/pull/13232 but still, symlinks should be used IMO
actually, this is not fixed, shim/wrapper process causes the following issue:
lldb -o r -o quit /Users/timothee/.nimble//bin/nim
Error: Spawning of process failed. (Error was: Interrupted system call)
Info: If unexpected, please report this error to https://github.com/dom96/choosenim
Process 59025 exited with status = 1 (0x00000001)
Is this with latest version of choosenim? Can you reproduce it? Does it happen with older versions too?
thanks for re-opening, see also https://github.com/nim-lang/Nim/issues/16838 which lists several issues caused by shims instead of symlinks (including one that prevents using testament in nimble tests
), and was closed as This is not a Nim issue but a choosenim issue.
This is an important issue that should be tracked and eventually fixed.
Is this with latest version of choosenim?
yes. choose -v choosenim v0.7.4 (2020-10-20 17:23:03) [macosx/amd64]
Can you reproduce it?
yes, i retried with latest choosenim (0.7.4) and it results in same error as https://github.com/dom96/choosenim/issues/126#issuecomment-767959944 for any shim generated by choosenim / proxyexe.
Does it happen with older versions too?
how do I build a shim?
git clone https://github.com/dom96/choosenim && cd choosenim
nim c -o:/tmp/z01 src/choosenimpkg/proxyexe.nim
fails with: cliparams.nim(179, 7) Error: undeclared identifier: 'setNimbleDir'
and setNimbleDir
isn't defined in this repo.
how do I build a shim?
Can you just grab the choosenim release from the releases page and use it to install Nim somewhere? You can set a new $HOME or whatever to not overwrite your existing install.
HOME=/tmp/d09c /Users/timothee/Downloads/choosenim-0.3.0_macosx_amd64 1.4.2
lldb -o r -o quit /tmp/d09c/.nimble/bin/nim
Error: Traceback (most recent call last)
... proxyexe.nim(62) proxyexe
... proxyexe.nim(53) main
... Spawning of process failed. (Error was: Interrupted system call)
Info: If unexpected, please report this error to https://github.com/dom96/choosenim
Process 57390 exited with status = 1 (0x00000001)
HOME=/tmp/d09b /Users/timothee/Downloads/choosenim-0.7.5-20210102-f338473_macosx_amd64 1.4.2 lldb -o r -o quit /tmp/d09b/.nimble/bin/nim Error: Spawning of process failed. (Error was: Interrupted system call) Info: If unexpected, please report this error to https://github.com/dom96/choosenim Process 49248 exited with status = 1 (0x00000001)
git rev-parse HEAD f338473dd7557a9fda5276f30aafa76ced5ed85d NIMBLE_DIR=$HOME/.nimble_fake50 nimble install HOME=/tmp/d09 bin/choosenim 1.4.2 lldb -o r -o quit /tmp/d09/.nimble/bin/nim
Error: Spawning of process failed. (Error was: Interrupted system call)
Info: If unexpected, please report this error to https://github.com/dom96/choosenim
minimized repro:
import osproc
proc main()=
let exePath = "/Users/timothee/git_clone/nim/Nim_devel/bin/nim"
let p = startProcess(exePath, options={poParentStreams})
let exitCode = p.waitForExit()
p.close()
main()
nim c -o:/tmp/z01 main lldb -o r -o quit /tmp/z01
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11753.nim(14) t11753 /Users/timothee/git_clone/nim/timn/tests/nim/all/t11753.nim(11) main /Users/timothee/git_clone/nim/Nim_devel/lib/pure/osproc.nim(1246) waitForExit /Users/timothee/git_clone/nim/Nim_devel/lib/pure/includes/oserr.nim(94) raiseOSError Error: unhandled exception: Interrupted system call [OSError] Process 79961 exited with status = 1 (0x00000001)
so this points to a nim bug that I'll file and is (hopefully) fixable via something similar to https://github.com/nim-lang/Nim/pull/13232; however, the remaining issues I raised in https://github.com/nim-lang/Nim/issues/16838 are still valid, so there should be at least 1 bug open to track it
choosenim is implemented by a binary that dispatches to the real nim binary; this prevents using
lldb -- nim c -r foo
, at least on OSX:I'm curious why isn't choosenim using symbolic links (at least on posix) which seems a simpler approach and avoids this kind of problem ? maybe I'm missing something?
i'm on OSX (where gdb isn't supported, only lldb)
but this bug has always been there
EDIT: related to https://github.com/nim-lang/Nim/issues/9634; I may have a patch but no PR yet; but still genuinely curious why can't symbolic links be used instead, on posix?