Closed mratsim closed 4 years ago
findNimStdLibCompileTime
is a bad idea. I wonder why we have it.
Because findNimStdLib
doesn't work with choosenim
? It could try to run nim dump
and find the folder from that, that would probably be the most reliable, or it could at least re-use whatever logic that calls. Right now it is less a findNimStdLib
and more of a guessWhereNimStdLibMightBeDependingOnWhereTheCompilerBinaryIs
..
The standard library is relative to nim.exe
but it's a better idea to ship your own version of the required Nim files. Really, it is, I made the same mistake with NimEdit. The Nim stdlib evolves so fast that it gets outdated with the NimScript version that you ship your program with.
there are a few issues going on here:
findNimStdLib
will not work with choosenim-installed nim; this is in part due to choosenim shims (https://github.com/dom96/choosenim/issues/189); it could use nim dump --dump.format:json
at runtimenimble install compiler
is misleading and this seems like a bug:
it installs under:
/Users/timothee/.nimble/pkgs/compiler-1.3.5/compiler.nimble
yet uses the latest release tag, 1.2, so the 1.3.5 is really misleadingfindNimStdLibCompileTime
currently fails with nimble install compiler
, but after a PR I'm about to submit, it'll work for nimble install compiler@#head
(or any recent enough version of compiler pkg that will have that patch), semantics can be discussed in PR; EDIT: fixed in https://github.com/nim-lang/Nim/pull/14334
When trying the compiler as library API, findNimStdLibCompileTime does not find system.nim when the compiler is installed through nimble.
Test case:
nimble install compiler
And then compile:
Error:
from: https://github.com/nim-lang/Nim/blob/af6539b0c3b6958251737d5bc140cbcc8652eb8b/compiler/nimeval.nim#L93-L98