Here's the full output:
nexus/src/nexus/cmd$ nim --path:../.. -d:ssl c programs/nexus.nim
Hint: used config file '/home/user/.choosenim/toolchains/nim-2.2.0/config/nim.cfg' [Conf]
Hint: used config file '/home/user/.choosenim/toolchains/nim-2.2.0/config/config.nims' [Conf]
......................................................................................................................................................................................................................................................................SIGSEGV: Illegal storage access. (Attempt to read from nil?)
I commented code out until I found what was causing this, here's the code it breaks on:
var
webAppYAML: WebAppYAML
s = newFileStream(&"{webAppConfPath}/{pathName}.yaml")
load(s, webAppYAML)
s.close()
The load call, specifically, was narrowed down to be the cause of the SIGSEGV.
Is WebAppYAML a ref object? What is load's code?
A small example is great but it is not so great if it is all private code instead of stdlib or something like that so we can see what is happening.
It's an object but it has a field of seq that's a ref object. Making that an object prevents the error.
Full type code:
Media* = ref object of RootObj
name*: string
`type`*: string
version*: string
url*: string
MediaList* = seq[Media]
WebAppYAML* = object
shortName*: string
# package*: string
description*: string
basePath*: string
srcPath*: string
mediaList*: MediaList
Thanks for pointing out that ref objects could be the problem! I'll do that as a workaround, but should I file a bug for the compiler? Is this a known issue?