2

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?

tga
  • 538
  • 4
  • 15
  • Without seeing what error messages are displayed, we can't tell you what's wrong. Open up Console.app, then launch your app, then see what errors are displayed and edit them into your question above by pressing the "edit" button. – user1118321 Nov 20 '18 at 17:34
  • @user1118321 Thank you for the reply, I now got the error messages and edited the question! – tga Nov 20 '18 at 18:41

1 Answers1

2

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.

user1118321
  • 25,567
  • 4
  • 55
  • 86
  • Thank you, it worked perfectly. Didn't know there're things like @executable_path before, the links are super helpful. – tga Nov 20 '18 at 23:08