Macintosh linking problem - @executable_path

Discussion in 'Game Development (Technical)' started by Rainer Deyke, Dec 8, 2005.

  1. Rainer Deyke

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    380
    Likes Received:
    0
    I have had several reports of the Macintosh version of Lightslayer (direct download link) not starting, even though it runs correctly on my own Mac Mini and at least some other Macs. One user sent in a crash log, which contains the following (OS X 10.4):
    Another sent in a crash log containing the following (OS X 10.3.9):
    However, if I examine the bundle, it clearly contains the file libSDL-1.2.0.dylib in the Contents/MacOS directory. Is there any Macintosh expert here who can tell me what I'm doing wrong?
     
  2. Gnatinator

    Original Member

    Joined:
    Nov 23, 2004
    Messages:
    357
    Likes Received:
    0
    Embedding the *.dylib properly can be a pain in the ass. Proper instructions on how to do it can be found here.

    I would recommend just using the *.framework, it's much easier. (embed the *.framework by dropping it into a "Frameworks" folder beside the resources and macos folders)
     
  3. Rainer Deyke

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    380
    Likes Received:
    0
    I am aware of that page, and I'm pretty sure that I followed the instructions properly. The only difference is that I placed the dylib files in the same directory as the executable (@executable_path/lib_name) instead of in ../Frameworks (@executable_path/../Frameworks/lib_name). I don't see how this could be the cause of my problem, and I have no way of testing if it is the cause of my problem. The way I see it, platform-specific dylib files should go into the same platform-specfic directory as the executable, and only true frameworks (which are also bundles and may therefore contain code for multiple platforms) should go in the Frameworks directory. Am I wrong?

    Using frameworks would require me to write scripts that turn my dylibs into frameworks. It's possible, but it's also a lot of extra work, with a lot of extra chances for something to go wrong.
     
  4. Gnatinator

    Original Member

    Joined:
    Nov 23, 2004
    Messages:
    357
    Likes Received:
    0
    I'm assuming your just trying to embed the SDL library into your app so it will work on systems without it?

    Keep it simple. Grab an existing SDL 1.2.0 *.framework from an another game/app and throw it in. No need to make your own.
     
  5. Rainer Deyke

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    380
    Likes Received:
    0
    I don't like the idea of embedding the SDL framework for the following reasons:
    • I don't like trying things at random in hope that they will fix something.
    • I have no way of testing if this actually works.
    • I use other dylibs which aren't available in framework form.
    • Frameworks increase the download size.
    • I generally don't trust code that I didn't compile myself, although in the case of SDL I don't expect any problems on OS X.

    BTW, I found the problem. It turns out that the libSDL-1.2.0.dylib I had included in the bundle was just a symbolic link to libSDL-1.2.0.7.2.dylib, which of course I had not included in the bundle. A stupid mistake, but not one that I am likely to repeat now that I know what to watch out for.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer