vulkano-rs / vulkano

Safe and rich Rust wrapper around the Vulkan API
Apache License 2.0
4.48k stars 433 forks source link

Fail to load vulkan on mac #2120

Open rongcuid opened 1 year ago

rongcuid commented 1 year ago

Template

Issue

When I try to run a Vulkano program, it fails to load Vulkan:

cargo run --bin basic-compute-shader
    Finished dev [unoptimized + debuginfo] target(s) in 0.06s
     Running `/Users/rongcuid/src/vulkano/target/debug/basic-compute-shader`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LibraryLoadFailure(DlOpen { desc: "dlopen(libvulkan.1.dylib, 0x0005): tried: \'libvulkan.1.dylib\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OSlibvulkan.1.dylib\' (no such file), \'/usr/lib/libvulkan.1.dylib\' (no such file, not in dyld cache), \'libvulkan.1.dylib\' (no such file), \'/Users/rongcuid/src/vulkano/target/debug/build/shaderc-sys-d1970d87df1501e8/out/lib/libvulkan.1.dylib\' (no such file), \'/Users/rongcuid/src/vulkano/target/debug/deps/libvulkan.1.dylib\' (no such file), \'/Users/rongcuid/src/vulkano/target/debug/libvulkan.1.dylib\' (no such file), \'/Users/rongcuid/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libvulkan.1.dylib\' (no such file), \'/Users/rongcuid/.rustup/toolchains/stable-aarch64-apple-darwin/lib/libvulkan.1.dylib\' (no such file), \'/Users/rongcuid/lib/libvulkan.1.dylib\' (no such file), \'/usr/local/lib/libvulkan.1.dylib\' (no such file), \'/usr/lib/libvulkan.1.dylib\' (no such file, not in dyld cache)" })', examples/src/bin/basic-compute-shader.rs:36:40

The library is in fact under /opt/local/lib. I don't know why Vulkano doesn't load it, because I have tried using Vulkan in C and that program can load the library normally.

rongcuid commented 1 year ago

It was Macport's problem. I installed directly from the installer and it works. I guess it's your choice to see whether this installtion option should be considered as an additional case

Rua commented 1 year ago

I don't know anything about Macs. What in Vulkano's code would need to be changed?

rongcuid commented 1 year ago

Maybe Vulkano is not responsible for loading the library. Perhaps the issue is elsewhere, maybe Ash. I will give it a look later.