Reputation: 617
I'm using OS X - SDL2 https://www.libsdl.org/download-2.0.php and putting the Framework as a resource with the executable.
I'm linking fairly normally using -F/Path/to/local/framework -framework SDL2 but I've also adding -Wl,-rpath,./Library/Frameworks which allows me to run the executable from the root directory as it searchings that "relative" path to find the framework.
The problem arises when I want to run the executable from other directories. SDL has dynamic filepath loading for assets so that's not an issue, just it can't find the library, and gives: "dyld library not loaded image not found" which I can only attribute to the relative rpath link.
Any idea how to allow my "non-standard" Library/Framework path using GCC, C, OS X? rpath seems to not work.
Note this is all done in a Makefile.
EDIT: I just found out about: @executable_path and have not yet tested. Will test and get back to us.
Upvotes: 2
Views: 822
Reputation: 617
Using @executable_path in the path of the Local Library removes this problem, even after compilation and download of the binary.
Upvotes: 1