Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows compiler build fails #9375

Closed
sinkingsugar opened this issue Oct 14, 2018 · 10 comments
Closed

Windows compiler build fails #9375

sinkingsugar opened this issue Oct 14, 2018 · 10 comments

Comments

@sinkingsugar
Copy link
Contributor

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...

@Araq
Copy link
Member

Araq commented Oct 14, 2018

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.

@sinkingsugar
Copy link
Contributor Author

It was definitely working few commits before tho. As I never changed windows gcc in ages :(

@sinkingsugar
Copy link
Contributor Author

using clang and adding respective --cc:clang to all required steps works.

@LemonBoy
Copy link
Contributor

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 🤷‍♂️

@sinkingsugar
Copy link
Contributor Author

@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.

@nc-x
Copy link
Contributor

nc-x commented Oct 16, 2018

@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.

@sinkingsugar
Copy link
Contributor Author

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.

@LemonBoy
Copy link
Contributor

Can confirm that the bootstrap succeeds with gcc v8.2.0 (rev3)

@sinkingsugar
Copy link
Contributor Author

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.

@Araq
Copy link
Member

Araq commented Oct 22, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants