I was trying to use SDL2 with rust and failed to do so. I was following along with everything on their github page but couldn’t get it working. Here’s what I’ve done so far.
I downloaded the framework from libsdl.org and put it under /Library/Frameworks/
Here’s my build.rs
fn main() {
println!("cargo:rustc-link-search=framework=/Library/Frameworks")
}
And here is cargo.toml
[package]
name = "gamee"
version = "0.1.0"
edition = "2021"
build = "build.rs"
[dependencies.sdl2]
version = "*"
features = ["use_mac_framework"]
cargo build runs successfully but when I run cargo run, I get this error
Running `target/debug/gamee`
dyld[85941]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2
Referenced from: <DBF38183-3DAF-38E0-BC8F-CC18E1E07066> /Users/ayush/SDL2/gamee/target/debug/gamee
Reason: no LC_RPATH's found
zsh: abort cargo run
I’m very new to rust and have no idea how to solve this issue. Any help would be appreciated!