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

'compile_shader' crash on Windows/MSYS2 #1032

Closed
lem0nify opened this issue Feb 10, 2016 · 10 comments
Closed

'compile_shader' crash on Windows/MSYS2 #1032

lem0nify opened this issue Feb 10, 2016 · 10 comments

Comments

@lem0nify
Copy link

I'm trying to make any piston application work on msys.
I installed freetype and mingw64 gcc tools on msys2 using pacman, then built rust and cargo from sources, as said in your getting-started tutorial. Everything went fine.
Then I've built spinning-square example with cargo build. This finished without any errors (just some warnings about #[allow(raw_pointer_derive)]) but when I try to run it, I see (always different) runtime errors about 'compile_shader' fuction. There are some examples of them:

$ cargo run
Running target\debug\spinning-square.exe
thread '

' panicked at 'compile_shader: 0(1) : error C0000: syntax error, unexpected $undefined at token ""
', C:\msys64\home\Konstantin.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.23.0\src\back_end.rs:56
note: Run with RUST_BACKTRACE=1 for a backtrace.
Process didn't exit successfully: target\debug\spinning-square.exe (exit code: 101)

$ cargo run
Running target\debug\spinning-square.exe
thread '

' panicked at 'compile_shader: 0(1) : error C0000: syntax error, unexpected $undefined, expecting "::" at token ""
', C:\msys64\home\Konstantin.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.23.0\src\back_end.rs:56
note: Run with RUST_BACKTRACE=1 for a backtrace.
Process didn't exit successfully: target\debug\spinning-square.exe (exit code: 101)

$ cargo run
Running target\debug\spinning-square.exe
thread '

' panicked at 'compile_shader: 0(1) : error C0000: syntax error, unexpected integer constant at token ""
', C:\msys64\home\Konstantin.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.23.0\src\back_end.rs:56
note: Run with RUST_BACKTRACE=1 for a backtrace.
Process didn't exit successfully: target\debug\spinning-square.exe (exit code: 101)

Any changes in OpenGL version in code don't affect result. Other piston applications (e.g. rust-2048) don't work the same way.
I find it strange that I always see different errors without even recompile.
On my linux laptop everything works fine and I have such problems only on Windows/MSYS2. I have also tryed to compile and run simple OpenGL application written in C here but it works fine too.
I use Windows 8.1 64bit, my video card is GeForce GTX 770 and the last driver (361.75) is installed.
Sorry for my bad english.
So what could be the problem and how to fix it? Hope for your help.

@GiGurra
Copy link

GiGurra commented Apr 23, 2016

Same problem here I believe - though Im using the visual studio build
Spinning squares results in

 Running `target\debug\spinning-square.exe`
thread '<main>' panicked at 'compile_shader: 0(1) : error C0000: syntax error, unexpected $undefined at token "<undefined>"
', C:\Users\kjolh\.babun\cygwin\home\kjolh\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:57
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Process didn't exit successfully: `target\debug\spinning-square.exe` (exit code: 101)

Here is an example project which has the problem:
https://github.com/GiGurra/test_rust_gl

Failing on an nvidia gtx (980) on windows
Running on Linux/ubuntu 1404 works just fine :S (intel chip)

@ghost
Copy link

ghost commented Apr 25, 2016

Also using MSVC, using the tutorial code I seem to gotten different errors when running multiple times without rebuilding.

C:\Users\Brian\Documents\Projects\simple_game>cargo run
   Compiling spinning-square v0.1.0 (file:///C:/Users/Brian/Documents/Projects/simple_game)
     Running `target\debug\spinning-square.exe`
thread '<main>' panicked at 'compile_shader: ERROR: 0:1: '0' : syntax error syntax error

', C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:57
stack backtrace:
   0:     0x7ff612e1b6c7 - rt::lang_start::hb4b3697e84472c7btLz
   1:     0x7ff612e1af06 - rt::lang_start::hb4b3697e84472c7btLz
   2:     0x7ff612e1272f - sys_common::unwind::begin_unwind_inner::h248268d78bb53d12kSt
   3:     0x7ff612e12c1d - sys_common::unwind::begin_unwind_fmt::hdae0033914fa114bqRt
   4:     0x7ff612e0487c - new
                        at C:\Users\Brian\Documents\Projects\simple_game\<std macros>:8
   5:     0x7ff612e0e8e3 - new
                        at C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:226
   6:     0x7ff612d89cb3 - main
                        at C:\Users\Brian\Documents\Projects\simple_game\src\main.rs:64
   7:     0x7ff612e1a8c8 - rt::lang_start::hb4b3697e84472c7btLz
   8:     0x7ff612e17298 - sys_common::thread_local::StaticKey::lazy_init::hcef16f113f22e22drIt
   9:     0x7ff612e1a74d - rt::lang_start::hb4b3697e84472c7btLz
  10:     0x7ff612d94819 - main
  11:     0x7ff612e21acf - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:255
  12:     0x7ffc9bf82d91 - BaseThreadInitThunk
Process didn't exit successfully: `target\debug\spinning-square.exe` (exit code: 101)

C:\Users\Brian\Documents\Projects\simple_game>cargo run
     Running `target\debug\spinning-square.exe`
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: "Attribute \'pos\' does not exists in shader"', ../src/libcore\result.rs:746
stack backtrace:
   0:     0x7ff65bd1b6c7 - rt::lang_start::hb4b3697e84472c7btLz
   1:     0x7ff65bd1af06 - rt::lang_start::hb4b3697e84472c7btLz
   2:     0x7ff65bd1272f - sys_common::unwind::begin_unwind_inner::h248268d78bb53d12kSt
   3:     0x7ff65bd12c1d - sys_common::unwind::begin_unwind_fmt::hdae0033914fa114bqRt
   4:     0x7ff65bd17332 - rust_begin_unwind
   5:     0x7ff65bd1e1c8 - panicking::panic_fmt::h5dc62a1e662648a6lcM
   6:     0x7ff65bd043ce - unwrap_failed<collections::string::String>
                        at C:\Users\Brian\Documents\Projects\src\libcore\macros.rs:29
   7:     0x7ff65bd0d9f4 - unwrap
                        at C:\Users\Brian\Documents\Projects\src\libcore\result.rs:687
   8:     0x7ff65bd04c34 - new
                        at C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:84
   9:     0x7ff65bd0e8e3 - new
                        at C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:226
  10:     0x7ff65bc89cb3 - main
                        at C:\Users\Brian\Documents\Projects\simple_game\src\main.rs:64
  11:     0x7ff65bd1a8c8 - rt::lang_start::hb4b3697e84472c7btLz
  12:     0x7ff65bd17298 - sys_common::thread_local::StaticKey::lazy_init::hcef16f113f22e22drIt
  13:     0x7ff65bd1a74d - rt::lang_start::hb4b3697e84472c7btLz
  14:     0x7ff65bc94819 - main
  15:     0x7ff65bd21acf - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:255
  16:     0x7ffc9bf82d91 - BaseThreadInitThunk
Process didn't exit successfully: `target\debug\spinning-square.exe` (exit code: 101)

C:\Users\Brian\Documents\Projects\simple_game>cargo run
     Running `target\debug\spinning-square.exe`
thread '<main>' panicked at 'ShaderInfoLog not valid utf8', ../src/libcore\option.rs:704
stack backtrace:
   0:     0x7ff65bd1b6c7 - rt::lang_start::hb4b3697e84472c7btLz
   1:     0x7ff65bd1af06 - rt::lang_start::hb4b3697e84472c7btLz
   2:     0x7ff65bd1272f - sys_common::unwind::begin_unwind_inner::h248268d78bb53d12kSt
   3:     0x7ff65bd12c1d - sys_common::unwind::begin_unwind_fmt::hdae0033914fa114bqRt
   4:     0x7ff65bd17332 - rust_begin_unwind
   5:     0x7ff65bd1e1c8 - panicking::panic_fmt::h5dc62a1e662648a6lcM
   6:     0x7ff65bd1f4b4 - option::expect_failed::hd3fbe3b63102864euGO
   7:     0x7ff65bd03e13 - expect
                        at C:\Users\Brian\Documents\Projects\src\libcore\option.rs:298
   8:     0x7ff65bd01993 - compile_shader
                        at C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\shader_utils.rs:159
   9:     0x7ff65bd046f6 - new
                        at C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:50
  10:     0x7ff65bd0e8e3 - new
                        at C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:226
  11:     0x7ff65bc89cb3 - main
                        at C:\Users\Brian\Documents\Projects\simple_game\src\main.rs:64
  12:     0x7ff65bd1a8c8 - rt::lang_start::hb4b3697e84472c7btLz
  13:     0x7ff65bd17298 - sys_common::thread_local::StaticKey::lazy_init::hcef16f113f22e22drIt
  14:     0x7ff65bd1a74d - rt::lang_start::hb4b3697e84472c7btLz
  15:     0x7ff65bc94819 - main
  16:     0x7ff65bd21acf - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:255
  17:     0x7ffc9bf82d91 - BaseThreadInitThunk
Process didn't exit successfully: `target\debug\spinning-square.exe` (exit code: 101)

C:\Users\Brian\Documents\Projects\simple_game>cargo run
     Running `target\debug\spinning-square.exe`
thread '<main>' panicked at 'compile_shader: FLEX: Unknown char �
ERROR: 0:1: '�' : syntax error syntax error

', C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:57
stack backtrace:
   0:     0x7ff65bd1b6c7 - rt::lang_start::hb4b3697e84472c7btLz
   1:     0x7ff65bd1af06 - rt::lang_start::hb4b3697e84472c7btLz
   2:     0x7ff65bd1272f - sys_common::unwind::begin_unwind_inner::h248268d78bb53d12kSt
   3:     0x7ff65bd12c1d - sys_common::unwind::begin_unwind_fmt::hdae0033914fa114bqRt
   4:     0x7ff65bd0487c - new
                        at C:\Users\Brian\Documents\Projects\simple_game\<std macros>:8
   5:     0x7ff65bd0e8e3 - new
                        at C:\Users\Brian\.cargo\registry\src\github.com-88ac128001ac3a9a\piston2d-opengl_graphics-0.28.1\src\back_end.rs:226
   6:     0x7ff65bc89cb3 - main
                        at C:\Users\Brian\Documents\Projects\simple_game\src\main.rs:64
   7:     0x7ff65bd1a8c8 - rt::lang_start::hb4b3697e84472c7btLz
   8:     0x7ff65bd17298 - sys_common::thread_local::StaticKey::lazy_init::hcef16f113f22e22drIt
   9:     0x7ff65bd1a74d - rt::lang_start::hb4b3697e84472c7btLz
  10:     0x7ff65bc94819 - main
  11:     0x7ff65bd21acf - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:255
  12:     0x7ffc9bf82d91 - BaseThreadInitThunk
Process didn't exit successfully: `target\debug\spinning-square.exe` (exit code: 101)

Windows 10 64-bit, GTX 670M, Driver version 361.91

@GiGurra
Copy link

GiGurra commented Apr 25, 2016

Yes sometimes (maybe 1 out of 5 times) it actually Does start :S (without rebuild). But most of the time it doesn't. I tried with both stable rust 1.8 and nightly 2.0 with the exact same results, so maybe this is caused by the MSVC integration somehow..

@lem0nify
Copy link
Author

The one thing I don't understand is why developers of Piston ignore this thread. They (or he) are the ones who know best how their engine works.

@bvssvni
Copy link
Member

bvssvni commented Apr 26, 2016

@lem0nify Been busy.

We have encountered a compiler bug concerning corrupted memory before, see gfx-rs/gfx#574. It could be something that only affects MSVC. The process used to find it might be of help rust-lang/rust#22536.

The opengl_graphics backend has an "image_test" example, https://github.com/PistonDevelopers/opengl_graphics/blob/master/examples/image_test.rs, which might be a starting point for reducing the test case. If there is a compiler bug, but not something wrong with the GLSL compiler inside the driver, then a such reduced example would be of great help for the Rust team.

@lem0nify
Copy link
Author

@bvssvni So what should I do?
I've tried to run image_test example, but it shows the same error.

@bvssvni
Copy link
Member

bvssvni commented Apr 26, 2016

@lem0nify Try remove code from your fork of opengl_graphics and the "image_test" example until you have the minimum amount of code required that trigger the bug.

@lem0nify
Copy link
Author

@bvssvni Sorry I can't remove parts from your code correctly because I don't fully understand rust, piston, opengl, glsl and only start to learn them. So I can only notice that this error is glsl log putted in buffer by gl::GetShaderInfoLog (shader_utils.rs, line 150) but it happens only with textured/150_core.glslv shader (back_end.rs, line 137). Can you please try to investigate the reason?

@bvssvni
Copy link
Member

bvssvni commented May 28, 2016

@lem0nify PistonDevelopers/opengl_graphics#236 fixed a possible dangling pointer. Do you still get the error?

@lem0nify
Copy link
Author

@bvssvni No I don't get it since your prevous reference. Thank you.

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

3 participants