Sadly, the new version of vulkano fails to build on computer.
error: /home/austin/Workspace/vulkano/target/debug/deps/libvulkano_shaders-ab78b8590e7207b0.so: undefined symbol: _ZN7glslang8TProgram10getInfoLogEv
--> examples/src/bin/image/main.rs:289:5
|
289 | vulkano_shaders::shader!{
| ^^^^^^^^^^^^^^^
error: aborting due to previous error
Your example works fine for me. Have you tried deleting your target directory? Looks like a bug in rust.
I have tried to delete my target directory yes. Using the latest nightly rust also. I get the error on anything that uses vulkano doesn't have to be that example.
Have you tried on stable rust?
It works fine for me on both nightly and stable.
Can you check if a project just depending on shaderc-rs has the same issue?
Going to run a system update make sure there are no issues with my driver stack. I guess I am running the Mesa 19.1.0 rc's which may be causing issues. Otherwise I'll check to see if shaderc by itself has issues.
On a fresh system update the issue still occurs. On a crate with shaderc by itself there are no problems. Issue seems to be occurring with the shader macro. I am guessing it is is a compiler bug.
My distro is rockin a pretty old version of shaderc, 2018.0. This is probably what is the causing issues.
Oh no...
You should be able to work around this by uninstalling your distro's shaderc and then shaderc-rs will recompile it from scratch.
Well updated the package to the latest version and got it in, https://github.com/void-linux/void-packages/pull/12285, but same thing happens sadly.
Well maybe the error is different
error[E0433]: failed to resolve: could not find `Shader` in `vs`
--> examples/src/bin/image/main.rs:95:18
|
95 | let vs = vs::Shader::load(device.clone()).unwrap();
| ^^^^^^ could not find `Shader` in `vs`
error[E0433]: failed to resolve: could not find `Shader` in `fs`
--> examples/src/bin/image/main.rs:96:18
|
96 | let fs = fs::Shader::load(device.clone()).unwrap();
| ^^^^^^ could not find `Shader` in `fs`
error: /home/austin/Workspace/vulkano/target/debug/deps/libvulkano_shaders-28d8a00f92a74e80.so: undefined symbol: _ZN7glslang8TProgram10getInfoLogEv
error: aborting due to 3 previous errors
I've got the same error. This is due to a bug in the build.rs script of shaderc-rs. I've provided a bugfix in https://github.com/google/shaderc-rs/pull/59
@AustinJ235 @faulesocke I'm getting the same error on 0.16 on the same setup, is there any quickfix?
Weird wonder if the new version of shaderc is to blame as they did release 0.6.1 recently. I did read their commit history at some point and saw that they made some changes around using what was available on the host system. In vulkano-shaders we have set to always build from source, so I wonder if this flag is now getting ignored in the new version.
You could try adding this to your project's Cargo.toml:
[patch.crates-io]
shaderc = "=0.6.0"
If for some reason that patch trick doesn't work go ahead and clone vulkano repos and change the shaderc version in vulkano-shaders/Cargo.toml to =0.6.0
I'm also on void; the examples fail to build even with changing vulkano-shaders's shaderc version to =0.6.0. The patch trick also fails on my own separate project, which is just from following the guide on vulkano.rs.
Wonder if it was ever fixed in the first place. Do you have the shaderc system lib installed? Maybe try with or without it. You could also try removing build from source feature flag in the vulkano-shaders Cargo.toml
Yeah I've tried everything you suggested and nothing worked. I realized that I'm getting the error you had when you opened the issue, before you updated shaderc in void-packages, and I noticed that shaderc is now on version 2019.1 instead of 2019.0. I tried building 2019.1 through xbps-src, but it errors and I don't have the time/knowledge to debug it. Given that it doesn't work even with the shaderc system package uninstalled, I kind of doubt that it'd work just by updating. I don't know if that reasoning makes sense though.
Ok looking at the previous fixes for this looks like the system lib for glslang is important also. Looking at void's glslang version it is slightly out of date, template here. The version used there is from november 1st last year, but the latest stable seems to be january 6th of this year. This is also a major version bump which may be causing the issues with linking I presume. glslang releases You could try up'ing the version in void's template and installing that to see if it resolves issues or not.
I am currently not running void linux sadly atm, otherwise I'd have a go at this.
Just in case someone needs an instant solution:
I "solved" this issue temporary by building shaderc from source, this requires cmake and python3 and a time-wasting process, but if you just want to build it NOW, add following in your cargo.toml:
shaderc = "0.6.1"
shaderc-sys = "0.6.1"
[features]
shaderc_fix = ["shaderc/build-from-source"]
and build with --features=shaderc_fix (e.g. cargo run --features=shaderc_fix)
I had a derp moment I guess, https://github.com/vulkano-rs/vulkano/blob/dd7b202e80a3b1add413a91cc379751c0bbc944a/vulkano-shaders/Cargo.toml#L27
Turns out we already have the feature flag available for this
I ran into this again after installing void on a new machine. For the record: You need to install shaderc, glslang and SPIRV-Tools (not sure about SPIRV-Headers, I guess this is not necessary).
I found out what the problem is by looking at the output messages when building shaderc-rs. It said:
warning: Only shaderc library found. Assuming libraries it depends on are built into the shaderc library.
So this is probably a dependency issue in Void Linux.
Okay, checked the sources. This is not a problem within Void Linux.
In void, libshaderc_shared.so dynamically links libglslang.so. Not statically. But shaderc-rs does the following during build:
When all of these 4 libraries are found: SPIRV, SPIRV-Tools, SPIRV-Tools-opt, glslang, then it links against them. Otherwise it doesn't link to any of them and just assumes that shaderc works without all of them. I will report it over there.
Okay, this is already fixed in the current shaderc version. So this can be resolved by updating to shaderc 0.7.
Most helpful comment
I had a derp moment I guess, https://github.com/vulkano-rs/vulkano/blob/dd7b202e80a3b1add413a91cc379751c0bbc944a/vulkano-shaders/Cargo.toml#L27
Turns out we already have the feature flag available for this