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
detect_windows_bitness_inconsistency #1958
detect_windows_bitness_inconsistency #1958
Conversation
…r on Windows detect wrong bitness combinations of the toolchain that can cause python -> llvm-link invocation to fail on Windows with a 'Error 6: handle is invalid' error message.
|
I'm curious, what's going on here? Seems like if we link proper bitcode files, it shouldn't matter what bitness the llvm executables are? And why does it matter what bitness python is, if it runs llvm in a different process? |
|
I don't know what happens here. If I install latest 32bit python and 64-bit clang, that line always throws an exception. Falling back to 32-bit clang or using 64bit python fixes the issue, so I wanted to document and decode that error message to a more friendly one. |
|
I am worried about pushing this without us understanding what's going on On Mon, Dec 30, 2013 at 10:38 AM, juj notifications@github.com wrote:
|
|
Even though this commit doesn't fix anything, I think this is extremely helpful, since now anyone getting this error will immediately get acknowledgement that the 'team' has seen this error as well, as well as give a suggestion of how to proceed to resolve it, and a diagnostic if they're running a mixed-bitness toolchain. The commit is careful to not hide the original error message, the exception is still printed. That said, if you still feel that it's too sketchy, then we can leave this out. |
|
Let's see what @vvuk has to say on this, he has experience with this kind of thing. |
|
Odd. 32-bit processes can launch 64-bit ones and vice versa; they can't link the other-bitness libraries and the like, as you would expect. But I wonder if python is trying to launch llvm-link in such a way that causes problems? @juj can you see if you can make a standalone .py script that launches llvm-link in the same way, that causes the problem with a 32-bit python/64-bit llvm? Would be easier to diagnose that way. |
|
This issue seems to only arise when Visual Studio spawns emcc. Calling it manually from command line does not reproduce the error. The 'handle is invalid' makes it feel like it is somehow related to the processes sharing piped stdout and stderr handles to each other, but it does not affect whether I use the EM_POPEN_WORKAROUND or adjust the popen pipes. Creating a script llvm.py that simply contains and routing emcc.bat to reproduces the error. Spawned via Visual Studio, it gives but spawned from command line is ok: Using python 2.7.5.3 64-bit instead of 2.7.5.3 32-bit succeeds, or using llvm 3.2 32-bit instead of llvm 64-bit succeeds. |
|
I would modify subprocess.py to dump the creationflags and startupinfo struct, at the point where CreateProcess is called since that's what causing the error. Then compare the two (VS vs. from command line). The CreateProcess docs have this bit of info:
Though the error is implying some validation; but it's some arg that's being passed in to that call that's causing the problem. I'd also inspect hStdInput/Output/Error and see if they're valid. There might be security issues at play too, somehow. |
|
Thanks, let me close this pr in interim. |
Improve error reporting when emscripten link step fails. In particular on Windows detect wrong bitness combinations of the toolchain that can cause python -> llvm-link invocation to fail on Windows with a 'Error 6: handle is invalid' error message.