I'm on macOS and I'm compiling my game with
g++ -F Frameworks -rpath Frameworks {{frameworks}} src/main.cpp -o game
I was following instructions on apple developer documents about how to create a macOS .app bundle, I have the correct folder structures and files but I still can't launch the app.
I got the error message:
Dyld Error Message:
Library not loaded: @rpath/sfml-window.framework/Versions/2.5.1/sfml-window
Referenced from: /Users/USER/*/test.app/Contents/MacOS/game
Reason: image not found
All of my framework bundles are in test.app/Contents/Frameworks
and I'm able to run the binary in the Contents folder by ./MacOS/game
. However it works if I just use the absolute path of the framework directory.
What should I pass as my -rpath
argument?
According to this link, you need to have your rpath
defined this way in the command line:
-rpath @executable_path/../Frameworks
That should tell it to look in AppBundle/Contents/Frameworks/ for all frameworks.
This is another good article on the subject.