I have a 2700 lines Nim source file which import about 1000 lines of non-standard includes. Compiling it with -d:release -d:danger takes ab 14 seconds CPU time.
I had to kill the Nim compiler after 2 hours and 15 minutes (on an otherwise idle machine) when I tried to compile with --gc:orc -d:release -d:danger
Are there any rules of thumb about the practical usability of the --gc:orc option?
nim --version gives
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-09-13
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: ef390e6a68db74a61137d7690dd2b10ec3dee050
active boot switches: -d:release
To elaborate on what @Araq said - I'd try to get some more info out of the compiler. You can build a debug version of the compiler by compiling your program using ./koch(.exe) temp c (or cpp) -r your_module.nim
This should allow you to use gcc/lldb/whatever microsoft's debugger is called to debug the compiler as it attempts to compile your program.
You can also check out the --verbosity option on the compiler and crank it up to like 3 let's say and you'll get all sorts of extra output which might help.
As @yardanico also mentioned - producing a minimal reproducible example is always beneficial to troubleshooting any issue, but I know sometimes it's near impossible / difficult.
Try to eliminate all the dependencies from the C/C++ code you can - maybe just stub their implementations and keep the interfaces and bind to those. That should help you at least make your example be able to be compiled by others - without them being required to build all the projects yours depends on (assuming it does so).
Just my tips - hope they help!
Thanks to all! The --verbosity flag shows some not GC-safe warnings which I don't understand. Terminating the Nim compiler (in gdb) gives the following trace back
Program received signal SIGINT, Interrupt.
0x0000555555be8afc in hash_injectdestructors_188 ()
(gdb) where
#0 0x0000555555be8afc in hash_injectdestructors_188 ()
#1 0x0000555555bed4e7 in aliasesCached_injectdestructors_121 ()
#2 0x0000555555bf56d0 in computeLastReadsAndFirstWrites_injectdestructors_3786
()
#3 0x0000555555c20434 in injectDestructorCalls_injectdestructors_10218 ()
#4 0x0000555555d46240 in genTopLevelStmt_cgen_29426 ()
#5 0x0000555555d4638e in myProcess_cgen_29434 ()
#6 0x00005555558c3d38 in processTopLevelStmt_passes_138 ()
#7 0x00005555558c4a5c in processModule_passes_231 ()
#8 0x0000555555d6723e in compileModule_modules_1709 ()
#9 0x0000555555d6b622 in compileProject_modules_2894 ()
#10 0x0000555555ec1e9e in commandCompileToC_main_363 ()
#11 0x0000555555ec2562 in compileToBackend_main_534 ()
#12 0x0000555555ec5099 in mainCommand_main_504 ()
#13 0x0000555555ecbbce in handleCmdLine_nim_41 ()
#14 0x0000555555ecc67e in NimMainModule ()
#15 0x0000555555ecc582 in NimMain ()
#16 0x000055555557096d in main ()
I have put 3 files into Pastebin which should compile with just the standard libraries installed. pastebin.com/LwvSpGyx pastebin.com/AmU4CDcW pastebin.com/BH9mBAs2
These file expire on Sunday October 3rd
Thanks for looking into this problem, Helmut
You can do git bisect on tags or branches too, so you could do
git bisect start
git bisect good v1.4.8
git bisect bad devel
Just don't forget to git pull beforehand.
Thanks Yardanico. Unfortunately I need some more help.
After
git pull
git bisect start
git bisect good v1.4.8
git bisect bad devel
nim c koch.nim
./koch temp
gives
/home/jarausch/Nim/Compiler/Nim/compiler/commands.nim(39, 11) template/generic instantiation of `bootSwitch` from here
/home/jarausch/Nim/Compiler/Nim/compiler/commands.nim(40, 33) Error: undeclared identifier: 'nativeStackTraceSupported'
candidates (edit distance, scope distance); see '--spellSuggest':
(12, 4): 'getStackTraceEntries' [proc declared in /usr/lib/nim/system/excpt.nim(524, 6)]
(12, 4): 'getStackTraceEntries' [proc declared in /usr/lib/nim/system/excpt.nim(529, 6)]
FAILURE
What am I missing? Thanks, Helmut