This discussion is archived
3 Replies Latest reply: Oct 6, 2009 6:23 AM by 725591 RSS

macosx, instantclient and application bundle

480677 Newbie
Currently Being Moderated
I'm facing strange problem - but it's maybe because I don't know too much about macosx internals.

I have an application (Qt4/OCCI over Oracle InstantClient) and I want to redistribute it as a bundle. The bundle is built into required structure (required libs are copied into bundle) and binaries are "relinked" to contain relative paths to its libraries.

But it looks like the InstantClient libraries are not loaded correctly because I cannot connect to the oracle server if I start my app from Finder. No error message from OCCI is raised, just a dummy C++ exception with no additional info.

When I start the app from terminal (with set DYLD_LIBRARY_PATH=/opt/local/lib/oracle) it's working very well. It is not working if the DYLD.. env var is not set)

My app can support more databases and all connections are working fine.

rimmer:MacOS pvanek$ otool -L TOra |grep 10
@executable_path/../../Contents/MacOS/libocci.dylib.10.1 (compatibility version 0.0.0, current version 0.0.0)
@executable_path/../../Contents/MacOS/libclntsh.dylib.10.1 (compatibility version 0.0.0, current version 0.0.0)

rimmer:MacOS pvanek$ otool -L libocci.dylib.10.1
@executable_path/../../Contents/MacOS/libocci.dylib.10.1 (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.1)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

rimmer:MacOS pvanek$ otool -L libclntsh.dylib.10.1
@executable_path/../../Contents/MacOS/libclntsh.dylib.10.1 (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.1)

This behavior is confirmed on another mac without any oracle libs installed so it is not issue of duplication lib loading.

Example bundle:

What could be problem? Should I simulate DYLD... variable somehow?
  • 1. Re: macosx, instantclient and application bundle
    422185 Newbie
    Currently Being Moderated
    a number of common unix apps always require some environment variables. I don't know, if this is really the cause of your problem here. You may give setting an environment variable in the app-folders info.plist a try.

    Prior to this you may set the variable in ~/.MacOSX/environment.plist, relogon(?) and test the app.
    Just a new entry of type String into that directory and make sure to use absolute paths.

    Find a document named "Runtime Configuration Guidelines" in the developer's documentation for more.
    There you find informations how to set a dictionary named LSEnvironment in the ino.plist.

  • 2. Re: macosx, instantclient and application bundle
    jpiwowar Journeyer
    Currently Being Moderated
    Hi Petr,

    Does the information in [this thread|] help at all? The original poster resolved a similar issue with getting his app to use DYLD_LIBRARY_PATH.


    John P.
  • 3. Re: macosx, instantclient and application bundle
    725591 Newbie
    Currently Being Moderated
    thanks for help. I do apologise for longer delay, but I made some "try-crash-try again" loops with this issue.

    h4. Solution:

    1) Bundling instant client requires (for my C++ app) these files:
    libociei.dylib (a huge one)

    The cmake's tool did not recognized libociei.dylib, so it was not packed.

    2) Instant client requires DYLD_LIBRARY_PATH in all cases. It's not possible to use ~/.profile for it as it's working only for shells (terminals). So I forced my app to use custom Info.plist (Contents/Info.plist) with additional content:


    Where ${EXE_NAME} is variable provided by build system. These are paths with (MacOS) *.10.1 and (Libraries) *.dylib files with instant client stuff.

    3) I did not tried ~/.MacOS/environment.plist ar whatever as I need it for redistributable bundle.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points