Unable to compile rust tutorials on mac

I’ve done the following:

  1. Installed both the runtime and development installer from here: https://gstreamer.freedesktop.org/download/#macos
  2. Added the following to my .zshrc:
export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Libraries/pkgconfig"
export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"

I first tried running the C files referring to [Installing on Mac OS X]. I couldn’t compile it with the Manual compilation way but was able to compile it with pkg-config.
I tried running the basic tutorials in rust with cargo run and I’m getting the following error:

 Compiling tutorial-2 v0.1.0 (/Users/foo/Rust/gstreamer/tutorial-2)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.47s
     Running `target/debug/tutorial-2`
dyld[5618]: Library not loaded: @rpath/libgstreamer-1.0.0.dylib
  Referenced from: <31D00DA7-B40D-36BE-892C-227790D656EE> /Users/foo/Rust/gstreamer/tutorial-2/target/debug/tutorial-2
  Reason: tried: '/Users/foo/Rust/gstreamer/tutorial-2/target/debug/deps/libgstreamer-1.0.0.dylib' (no such file), '/Users/foo/Rust/gstreamer/tutorial-2/target/debug/libgstreamer-1.0.0.dylib' (no such file), '/Users/foo/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgstreamer-1.0.0.dylib' (no such file), '/Users/foo/.rustup/toolchains/stable-aarch64-apple-darwin/lib/libgstreamer-1.0.0.dylib' (no such file), '/Users/foo/lib/libgstreamer-1.0.0.dylib' (no such file), '/usr/local/lib/libgstreamer-1.0.0.dylib' (no such file), '/usr/lib/libgstreamer-1.0.0.dylib' (no such file, not in dyld cache)
zsh: abort      cargo run

Interestingly, the Library not loaded: @rpath/libgsreamer-1.0.0.dylib error was coming even when I was trying to manually compile the C program without pkg-config and the error for it was:

dyld[5739]: Library not loaded: @rpath/GStreamer.framework/Versions/1.0/lib/GStreamer
  Referenced from: <F1DEB422-9E2C-3B90-A7DD-E4BB64301599> /Users/foo/Rust/gstreamer/main
  Reason: no LC_RPATH's found
zsh: abort      ./main

Could you please help me with this? Thanks!

I was able to solve this with the environment variable DYLD_FALLBACK_LIBRARY_PATH.
It would be nice if this was documented in the macOS installation instructions

export DYLD_FALLBACK_LIBRARY_PATH="/Library/Frameworks/GStreamer.framework/Libraries"

This is due to a rustc / cargo bug. We’re adding a workaround for it: Add workaround for linking against macOS SDK's relocatable dylibs (!1516) · Merge requests · GStreamer / gstreamer-rs · GitLab

Thanks for letting me know! I see that the commit has been merged. Hopefully, nobody has to go through all that trouble once the version is released!
Is there a way a beginner like me can debug such issues?
I’m facing another issue and I would like to provide as much information as possible. Since nobody else seems to complaining on issues like these, how would I know whether it’s architecture specific or language specific (and other factors)?