3 Replies Latest reply on Oct 6, 2009 1:23 PM by 725591

    macosx, instantclient and application bundle

      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
          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
            Hi Petr,

            Does the information in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=686407] 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
              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.