Page 1 of 1

Import : EndImport - path?

Posted: Sat Nov 30, 2013 10:07 am
by Lebostein
Hi,

to import a dylib on mac, the code works if the dylib is in the same directory as the pb-file.
If I compile this pb to an app, in which subdirectory I have to copy the dylib?

Thanks.

Re: Import : EndImport - path?

Posted: Sun Dec 01, 2013 1:07 am
by Danilo
Lebostein wrote:to import a dylib on mac, the code works if the dylib is in the same directory as the pb-file.
If I compile this pb to an app, in which subdirectory I have to copy the dylib?
  • Copy the dylib into "YourAppName.App/Contents/MacOS/"
    or into a subdirectory within this folder, for example "YourAppName.App/Contents/MacOS/lib/"
  • Now run the command:

    Code: Select all

    install_name_tool -change YourDylibName.dylib @executable_path/YourDylibName.dylib ./YourAppName.App/Contents/MacOS/YourAppName
    If you installed into lib/ subdirectory, you write

    Code: Select all

    install_name_tool -change YourDylibName.dylib @executable_path/lib/YourDylibName.dylib ./YourAppName.App/Contents/MacOS/YourAppName
    (replace "YourAppName" and "YourDylibName" with your own names. Do not replace "@executable_path", it is written like that)
  • Verify the changed dylib path by running:

    Code: Select all

    otool -L ./YourAppName.App/Contents/MacOS/YourAppName
    It should output "@executable_path/" in front of your dylib name, whereas before the change it just displayed the dylib name without a path

Re: Import : EndImport - path?

Posted: Sun Dec 01, 2013 12:07 pm
by Lebostein
Thank you! I will try it.