clearlinux / distribution

Placeholder repository to allow filing of general bugs/issues/etc against the Clear Linux OS for Intel Architecture linux distribution
524 stars 29 forks source link

nim-lang - import strformat produces file not found error because clearlinux does not deploy starter nim.cfg #1972

Open rbucker opened 4 years ago

rbucker commented 4 years ago

I have the smallest nim program.

import strformat
let msg = "hello"
doAssert &"{msg}\n" == "hello\n"

When I try to build this app...

$ nim c -r d.nim 

I get the error

/d.nim(1, 8) Error: cannot open file: strformat

(I also get similar error messages when I the numble commands. The challenge there is that nimble has it's own nim scripts that also depends on the standard library.)

So in order to get my compile to work, I created a nim.cfg in the current folder. Granted there are plenty of places where I can create that file...

I started with:

verbosity:1                                                                                                                                                                                  
PATH:"$lib/pure" 

($lib will be substituted with the correct folder path /usr/lib/nim)

When I compile... I see that I'm missing another standard file macros. This continues until my nim.cfg files looks like:

verbosity:1                                                                                                                                                                                  
PATH:"$lib/pure"                                                                                                                                                                            
PATH:"$lib/core"                                                                                                                                                                            
PATH:"$lib/posix"                                                                                                                                                                           
PATH:"$lib/pure/collections" 

On the one hand it makes perfect sense to force the developer to manually choose which and where the packages are... but on the other hand since nimble is included in the dist you'd expect that the path and the standard libs would be included. On the other hand... this nim installation was pre-packaged in Intel's ClearLinux not to be confused with ClearOS and so they could have made a mistake.

Some debug: I performed a nim dump.

...
-- end of list --
/usr/lib/nim
...

It happens that I have an OpenBSD installation and so I performed the dump

... -- end of list -- /usr/local/lib/nim/pure /usr/local/lib/nim/core /usr/local/lib/nim/arch /usr/local/lib/nim/pure/unidecode /usr/local/lib/nim/js /usr/local/lib/nim/posix /usr/local/lib/nim/windows /usr/local/lib/nim/wrappers/linenoise /usr/local/lib/nim/wrappers /usr/local/lib/nim/impure /usr/local/lib/nim/pure/concurrency /usr/local/lib/nim/pure/collections /usr/local/lib/nim/deprecated/pure /usr/local/lib/nim/deprecated/core /usr/local/lib/nim



and I happen to see that there is a comprehensive `nim.cfg` on th openbsd installation that is not present in the clearlinux....
rbucker commented 4 years ago

I have learned that there is a default nim,cfg that should have been deployed with the basic nim bundle

https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg

ahkok commented 4 years ago

I'm pushing a patch to nim that will fall back to /usr/share/defaults/nim/nim.cfg if no config file is under /etc. I hope that works - this should be in a release in 1-2 days or so. Please test and report any further issues with it.