Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gregor.hoch

macrumors member
Original poster
Apr 5, 2011
51
6
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 'my.app/Contents/MacOS' and the dynamic libraries in 'my.app/Contents/Frameworks'. 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 'my.app/Contents/MacOS/my', 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.

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.