GStreamer Library Loading Issue on macOS: Team IDs and Path Conflicts: code signature not valid for use in process

Hi everyone, I’m new to macOS development, and I’m currently trying to bundle my Rust tauri app that uses GStreamer-rs for macOS. The app works perfectly on Windows, but I’m facing issues with library loading and code signing when running it on macOS. I didn’t pay Apple because I already develop apps for free, so I did free self signing.

I’ve packaged my app and included all the necessary GStreamer .dylib files in the Frameworks directory within my app bundle. The structure looks like this:

my.app
└── Contents
├── MacOS
│ └── ui # main executable
├── Frameworks
│ ├── libgstapp-1.0.0.dylib
│ ├── libgstreamer-1.0.0.dylib
│ ├── libgstbase-1.0.0.dylib
│ ├── [other .dylib files]
├── Resources
│ └── icon
└── Info.plist

However, when I attempt to run the app, I get the following error:

dyld[4881]: Library not loaded: @rpath/libgstapp-1.0.0.dylib
  Referenced from: <6CF03C75-DF38-3E07-A327-FC8E85193DFC> /Applications/my.app/Contents/MacOS/ui
  Reason: tried: '/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libgstapp-1.0.0.dylib' 
    (code signature in <BFC99086-A7C5-3E07-94D5-C12015D09B85> '/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libgstapp-1.0.0.dylib' 
    not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), 
    '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libgstapp-1.0.0.dylib' 
    (no such file),
    '/Applications/my.app/Contents/Frameworks/libgstapp-1.0.0.dylib' 
    (code signature not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)

It seems like my app is trying to load the GStreamer libraries from the system /Library/Frameworks/GStreamer.framework/... instead of from my bundled Frameworks directory.

Question:

Is this error caused by a path issue (where the app is still looking for libraries in the system folder), or is it related to the code signing and different Team IDs, as mentioned in the error?

I would appreciate any guidance on how to ensure my app loads the GStreamer libraries from the bundled Frameworks folder and whether the signing issue could be causing this problem.

I solved this issue by writing a script to sign all of those files individually and my problem is fixed.