Packaging Unix Executable with dynamic libraries - what is the best way?

Discussion in 'Mac Programming' started by gregor.hoch, Aug 17, 2011.

  1. gregor.hoch macrumors member

    Apr 5, 2011
    Hi, I have a unix executable that requires two libraries, which are currently dynamically linked. Now I would like to distribute the binary together with the libraries. I failed to compile static libraries (and I also see the disadvantage of upgrading) so I am wondering what the best way is ti package the unix executable with the libraries.

    Right now, I have created a .app bundle with the unix executable in '' and the dynamic libraries in ''. After creating the bundle I have changed the lib location in the binary using install_name_tool to @executable_path/../Frameworks/libmylib.dylib.
    When I start the app file it crashes right away. I can, however, directly address the binary using '', which works.

    How bad is this practice? What would be a better alternative to package the binary with the dynamic libraries? Actually, I do not need the user to start the app. I am calling the binary from another application so that it's not strictly necessary that the user starts the app. But I really have the impression that's bad practice. So I would like to either package in a different way or make the .app file work.

  2. Sydde macrumors 68020


    Aug 17, 2009
    If you can do it in carbon, perhaps you might find this tutorial helpful?

Share This Page