Closed thindil closed 1 year ago
When using the variable in a Nim code, again one line is enough: import "$nim"/compiler/ast it returns the parent's path of the binary file. In example: /usr/local. Which causes the code not compile, can't find package.
But why would /usr/local/lib/ contain the compiler's source code? It might not be packaged at all so your premise is wrong.
I'm mainly surprised that the same variable returns different values depending on where it is used. My guess, one of these values, is wrong. The question is, which one? :)
Compiler
package was used here mostly as an example, but I got recently hit by that problem in one of Nim's packages.
Hi @thindil probably fixed by https://github.com/nim-lang/Nim/pull/21328 ?
Hello, @ringabout, thank you for checking. I will look on it. At the moment, it seems like Nim 2.0 doesn't want to build on FreeBSD. 🙄 I will need a bit more time to check and update needed patches to be able to check devel
branch.
Description
The value of
$nim
variable is different when used in a configuration file and in a Nim code. It is a problem, when someone uses Nim provided as a system package, as they usually put binaries and libraries in different places. It isn't a problem when using Nim version from choosenim or downloaded from the page, as both have everything bundled and$nim
points into the same place.For example, when
nim
binary is installed in/usr/local/bin
and Nim library installed in/usr/local/lib/nim
:config.nims
with just one line:switch("path", "$nim")
it returns the path to where Nim library is located. In example:/usr/local/lib/nim
.import "$nim"/compiler/ast
it returns the parent's path of the binary file. In example:/usr/local
. Which causes the code not compile, can't find package.Nim Version
Nim Compiler Version 1.6.12 [FreeBSD: amd64] Compiled at 2023-03-18 Copyright (c) 2006-2023 by Andreas Rumpf
active boot switches: -d:release
Current Output
No response
Expected Output
No response
Possible Solution
No response
Additional Information
No response