1

I've created a CLI version of my OS X app (which is an App Bundle). In my bundle version there's a pre-compiled .dylib that is normally placed within the directory where the executable resides.

This won't work for the command line version - is there a way to embed it within my executable?

Rory Zipher
  • 245
  • 1
  • 2
  • 10
  • Why can't you put the command line executable in the `.app` bundle too? That way it has convenient access to the `.dylib`. – trojanfoe Jan 25 '16 at 13:45
  • @trojanfoe: The command line version won't be part of the app bundle version (released solo). Also it would need to be installed in `/usr/local/bin` and I don't think that would work putting an .app in there? – Rory Zipher Jan 25 '16 at 19:10
  • Any app that's I've used that installed a command line utility did the installation itself by copying it to `/usr/local/bin` from the app bundle. You could this by installing a symbolic link with the dylib linkage set during build. – trojanfoe Jan 25 '16 at 21:01

1 Answers1

0

If you want to distribute only binary version of your application which related of dylib's you may do this in next ways: 1. make pkg installer which will put dylib somewhere in the system 2. most of 3rd parties libraries supports building of static version (*.a) itself as well as dynamic version. So you can build static version of your libraries and link statically with them.

toohtik
  • 1,892
  • 11
  • 27
  • The OP doesn't appear to have a problem using the `.dylib` in his Cocoa app bundle, but with a command line tool. – trojanfoe Jan 25 '16 at 13:46
  • yes I understand from your post. I think that problem in ENV in which application runs. You can use @ loader_path or @ rpath or @ executable path variables for locating you .dyld and for example when you run app from the CLI. One of the variables are not set and you need use other. If you put your crash log and folders structure I'll make more detailed suggestion. – toohtik Jan 25 '16 at 14:02
  • Or similar question: http://stackoverflow.com/a/24345546/436694 but all of them related to location of frameworks and @rpath variables... – toohtik Jan 25 '16 at 14:09
  • Thanks, but this answer is not at all relative to what I'm asking. – Rory Zipher Jan 25 '16 at 19:11
  • Sorry I've update answer according to your question. Also you need to know that applciations which distributes like a bundles can runs from the command line and also without UI. – toohtik Jan 27 '16 at 16:29