-
Notifications
You must be signed in to change notification settings - Fork 30
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
Adding Nim
to nimble.lock
makes nimble download and compile the compiler
#67
Comments
Today, after recompiling from HEAD, I checked the files that were used to compile nimlangserver and it didn't even use anything from stdlib or the Nim compiler that was installed by nimble, that is, keeping Nim in .lock only delays the process of nimlangserver compilation, as it used the Nim compiler that I already had (devel) and my devel's stdlib and not the one installed by Nimble. |
This sounds more like a nim/nimble bug than one in langserver? ie the purpose of a lock file is to deterministically choose which libraries are used to compile the application - that quite obviously includes the standard library which makes up most of the code (and compiler, by extension). |
Of course, there can be several interpretations of what was intended by adding Nim to .lock. I can see two:
In my opinion, the second option seems more obvious, mainly because I don't know of any package manager that installs a specific interpreter or compiler for each package you intend to install. Generally, if the interpreter or compiler does not match the version required by the installed package, the package installation should fail. |
this is the case.
This is also the case ;) The key insight here is that in order to compile the application, you need to have matching versions of all dependencies - it's really that simple. If you have a system nim installation and it matches the required version, that should be used - if not, nimble should install a matching version just like it installs libraries. This same logic applies to other "tools" you might need to build the package (ie c2nim or some other custom binary of which This enables a number of things:
Note that the above is not limited to lock files - the same logic applies if you have not locked your Nim but instead specified a version range with which it works.
Modern package managers (ie cargo, npm etc) track the compiler/runtime version required to compile the application just like any other dependency. They also typically offer tooling to switch between versions (ie nvm, rustup, choosenim etc). The only difference you're observing is that nimble includes this functionality in the same program. |
Oh, and finally, in nimble there should obviously be room for local overrides based on flags ( |
Was removed in 8449dfb |
For the record, I removed it by mistake. But I do see the pain on downloading it every time, so my vote is to keep it as is for the time being. |
every time? Only once, it should be cached, no? |
Added it back. It seems I need to learn more about Nimble. I just wanted to update some deps, turned out it somewhat dumped my global Nimble folder when doing the lock (and removed Nim from there as I didnt have it) |
Not sure if this is the cause but I couldn't get nimble to install nimlangserver on Mac using a brew installed nim (2.2.1) nimble install nimlangserver
Downloading https://github.com/nim-lang/langserver using git
Downloading https://github.com/nim-lang/Nim.git using git
Tip: 7 messages have been suppressed, use --verbose to show them.
nimble.nim(703) downloadDependency
Error: Downloaded package checksum does not correspond to that in the lock file:
... Package: [email protected]@r.5935c3bfa9fec6505394867b23510eb5cbab3dbf
... Checksum: efb469b3ca8c4ec85c5829fa18997508672f9740
... Expected checksum: 46333e8f4bda41dd6d3852a3f5fa4975b96b66a2 Cloning this repo, removing this line AND the lock file made it work |
I was installing nimlangserver with nimble and noticed that it always downloaded the Nim compiler, compiled csource, koch, compiler, tools... an unnecessary and slow process for those who have the compiler in the path.
langserver/nimble.lock
Line 235 in 3a537e5
The text was updated successfully, but these errors were encountered: