Getting an error while building nim, nim iteration @ commands.nim line 51: cannot open file: ../doc/basicopt.txt
Tests looked green otherwise so I merged in distribution...
This is known problem with GCC v8, use a different GCC. Note that we don't know yet if it's a Nim bug or a GCC bug, but using a different GCC helps.
It was definitely working few commits before tho. As I never changed windows gcc in ages :(
using clang and adding respective --cc:clang to all required steps works.
I spent too much time than I'm willing to admit in order to debug this issue.
For some reason the strlen here (that's called from here, shit hits the fan when we pass the mode flag) returns zero even though if you inspect the s buffer you can see its first byte is not \0.
I've also bisected a bit this problem and found that by checking out the commit before the introduction of the tyUncheckedArray type but have no idea about what's up, I tried to build the second stage with --gc:none and got the same error so I'd rule out the possibility of memory corruption.
Maybe it's just a GCC bug (I hope so) that may have been fixed for the upcoming 8.3 release :man_shrugging:
@LemonBoy Very curious, have you checked what happens C code side? Specifically you could just compare before the specific suspicious commit and after.
I have to say it's a little bit scary but at same time it's only gcc on Windows as far as I understand.
@sinkingsugar
Which gcc version are you on?
I had this same issue but updating to gcc v8.2.0 (rev3) (mingw-w64 from msys2) fixed the issue.
Not sure, I will check on the build machine but probably indeed older :)
So weird that the issue goes down to gcc tho... quite scary.
Can confirm that the bootstrap succeeds with gcc v8.2.0 (rev3)
btw I'm not quite sure but I probably was using the mingw-w64 package from nim-lang website... Not super sure but worth check it.
Also I suppose we can close this as long as we can put some big warning somewhere :) also ... or vcc was able to bootstrap nim.
I think we should default to -O2 instead of -O3. And I'd like to switch to clang on Windows for the default compiler of Nim, produces better code for me and can be used without setting any PATH.