asny / three-d

2D/3D renderer - makes it simple to draw stuff across platforms (including web)
MIT License
1.24k stars 105 forks source link

cargo run --example triangle panics on nixos #364

Closed GlennWSo closed 1 year ago

GlennWSo commented 1 year ago

Hi

I tried to run the example triangle and the first result.unwrap() panics! I would like help to understand the error msg:

❯ cargo run --example triangle Finished dev [unoptimized + debuginfo] target(s) in 1.24s Running target/debug/examples/triangle thread 'main' panicked at 'called Result::unwrap() on an Err value: GlutinError(Error { raw_code: None, raw_os_message: None, kind: NotFound })', examples/triangle/src/main.rs:10:6 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

info about my env:

cargo v0.16.0
rustc v1.69.0

hardware and drivers:

❯ lspci | grep VGA 01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2060 Mobile] (rev a1)

GlennWSo commented 1 year ago

update:

when trying check my drivers that X uses with glxinfo i got GLIBC not found as error info: i will investigate this further and share my findings.

glxinfo | grep -i vendor glxinfo: /nix/store/vnwdak3n1w2jjil119j65k8mw1z23p84-glibc-2.35-224/lib/libc.so.6: version GLIBC_ABI_DT_RELR' not found (required by /nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib/libpthread.so.0) glxinfo: /nix/store/vnwdak3n1w2jjil119j65k8mw1z23p84-glibc-2.35-224/lib/libc.so.6: versionGLIBC_2.36' not found (required by /nix/store/0d4xl0xk1g0w41yqyd64jvzbip5lhfig-libXdmcp-1.1.3/lib/libXdmcp.so.6)

GlennWSo commented 1 year ago

i can now run glxinfo with no problems:

❯ glxinfo | grep -i "vendor|rendering" direct rendering: Yes server glx vendor string: NVIDIA Corporation client glx vendor string: NVIDIA Corporation OpenGL vendor string: NVIDIA Corporation GL_NV_parameter_buffer_object2, GL_NV_path_rendering, GL_NV_path_rendering_shared_edge, GL_NV_pixel_data_range, GL_NV_stereo_view_rendering, GL_NV_texgen_reflection, GL_NV_parameter_buffer_object2, GL_NV_path_rendering, GL_NV_path_rendering_shared_edge, GL_NV_pixel_data_range, GL_NV_stereo_view_rendering, GL_NV_texgen_reflection, GL_NV_path_rendering, GL_NV_path_rendering_shared_edge, GL_NV_shadow_samplers_cube, GL_NV_stereo_view_rendering,

my old update now irrelevent:

update:

when trying check my drivers that X uses with glxinfo i got GLIBC not found as error info: i will investigate this further and share my findings.

glxinfo | grep -i vendor glxinfo: /nix/store/vnwdak3n1w2jjil119j65k8mw1z23p84-glibc-2.35-224/lib/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by ...

GlennWSo commented 1 year ago

To show the environment that fail to run the examples i have created a pull request (draft) #364

I suspect that culprit is that nixos dont put the x11 stuff where Glutin expects them, as nixos generally dont allow implicit dependencies.

GlennWSo commented 1 year ago

I have found a solution. Its in pull request #365 Thanks to Alexandru Scvorțov and his blogpost about the intersection of graphics/rust/nixos

asny commented 1 year ago

Hi. Sorry for the late reply.

Great that you found a solution 👍 I probably wouldn't be able to help anyway. And I appreciate the PR, but I'm not going to merge it. The purpose of three-d is rendering, not providing a render context, so I assume that people have OpenGL capabilities, drivers installed etc. Otherwise, i would use way too much time on these kind of issues. Also, I have no chance of maintaining the flake.nix file. Instead, maybe glutin is interested in this addition?