beef331 / nimscripter

Quick and easy Nim <-> Nimscript interop
MIT License
149 stars 8 forks source link

Can't find compiler package with nimscripter 1.0.21 when Nim is installed in non-standard directory #27

Open thindil opened 1 year ago

thindil commented 1 year ago

Hello,

First, thank you for your work. 😄 Unfortunately, as stated above the newest version of nimscripter, 1.0.21, doesn't work when Nim, tested with version 1.6.12, is installed in a different directory, for example in /usr/local. Trying to build the first example from README.md file ends with the error: Error: cannot open file: /usr/local/compiler/nimeval.

The previous approach, with file config.nims works good, the path is set properly.

beef331 commented 1 year ago

Does it work if you have the config.nims?

thindil commented 1 year ago

Unfortunately, no. Still the same error.

beef331 commented 1 year ago

Well well well 1 step forward 2 steps back... where are your compiler sources located?

thindil commented 1 year ago

A standard day in the development. 😆 Binary file nim is located in /usr/local/bin, compiler source in /usr/local/lib/nim. It seems like Nim in code solves $nim to path to the binary, while everything works as expected when it is made via configuration.

I was trying to find any related issue in Nim, but without results. Probably I missed something.

thindil commented 1 year ago

Just a quick update, it seems like in the devel version of the compiler the $nim variable works as expected: in both situations it points to the directory where Nim library is.

beef331 commented 1 year ago

Hmph, the only issue is that the fix is not back-ported, so I guess to support 1.6.x I still need that import hack I mentioned.

thindil commented 1 year ago

Or mark 1.0.20 as the last, which was working with 1.6 series. I'm not sure if it will be back-ported, everything depends on when the 2.0 version will be available.

FedericoCeratto commented 1 year ago

This is related to https://nim-lang.org/docs/packaging.html - the last line indicates:

The "compiler" directory contains compiler sources and should not be part of the compiler binary package

thindil commented 1 year ago

@FedericoCeratto it is true for Linux 😉. For example, on FreeBSD compiler package contains patches and hacks which are needed for Nim to works, like generating a documentation. The reason: many paths are hard-coded.