Page 2 of 2
Re: PureBasic + SDL + Mac ...
Posted: Tue Jul 15, 2014 7:01 pm
by Danilo
kenmo wrote:Danilo, does that mean the end-user would have to run that commandline?
No. You do it, and the result is a stand-alone app with included Framework.
You then distribute the final .app to end users, and they don't need to install
SDL themselves or anything, as the framework is included.
SDL_Test.app.zip
Re: PureBasic + SDL + Mac ...
Posted: Thu Jul 17, 2014 11:04 pm
by kenmo
Nice solution! That .app seems to work without installing the SDL2 framework (at least it works on OSX 10.9, I would like to test back to maybe 10.5).
About that commandline action... I don't really know HOW it works. First I assumed it added some information to the .plist, but I was wrong, nothing seems to be added there. Does it modify the executable? Does it store the Framework path in a hidden file within the .app? Does the OS cache that information elsewhere? Or is it just Mac Magic?

Re: PureBasic + SDL + Mac ...
Posted: Fri Jul 18, 2014 5:41 am
by Danilo
kenmo wrote:Nice solution! That .app seems to work without installing the SDL2 framework (at least it works on OSX 10.9, I would like to test back to maybe 10.5).
Yes, it works with Mac OS X 10.5 and newer. Older OS are not supported.
For your Reference:
Mac Developer Library: Run-Path Dependent LibrariesIn OS X v10.5 and later the linker and dynamic loader offer a simple way of allowing multiple executables in an application suite directory to share dependent libraries while providing the suiteās users
the option of relocating the suite directory. Using run-path dependent libraries you can create a directory structure containing executables and dependent libraries that users can relocate without breaking it.
kenmo wrote:About that commandline action... I don't really know HOW it works. First I assumed it added some information to the .plist, but I was wrong, nothing seems to be added there.
Does it modify the executable? Does it store the Framework path in a hidden file within the .app? Does the OS cache that information elsewhere? Or is it just Mac Magic?

It is directly added to the Loader information within the executable. You can show the loader commands with otool, option (lowercase) "-l":
Code: Select all
otool -l ./SDL_Test.app/Contents/MacOS/SDL_Test
It lists the loader commands for the executable, and you will see something like that:
Code: Select all
[...]
Load command 14
cmd LC_LOAD_DYLIB
cmdsize 64
name @rpath/SDL2.framework/Versions/A/SDL2 (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 3.1.0
compatibility version 1.0.0
[...]
Load command 24
cmd LC_RPATH
cmdsize 44
path @executable_path/../Frameworks (offset 12)
The loader command LC_RPATH adds the internal Frameworks directory to the path
where the loader looks for libraries/frameworks that start with "@rpath", see otool with option (uppercase) "-L":
Code: Select all
otool -L ./SDL_Test.app/Contents/MacOS/SDL_Test
Re: PureBasic + SDL + Mac ...
Posted: Sat Jul 19, 2014 2:11 am
by jack
Danilo, your tips are very useful, I think you should add them to the Programming on the Mac platform thread so they don't get buried.
Re: PureBasic + SDL + Mac ...
Posted: Sat Sep 13, 2025 4:00 pm
by Piero