[Interest] Use Oracle 11g with Qt5.1 on MacOS

Till Oliver Knoll till.oliver.knoll at gmail.com
Wed Nov 13 19:10:32 CET 2013


Am 13.11.2013 um 15:53 schrieb Emmanuel Bourgerie <manu at bourgerie.fr>:

> Turns out those libraries are available in my instantclient folder,
> which is aliased correctly (DYLD_LIBRARY_PATH).

Ah, that reminds me: according to e.g.
  http://forums.macrumors.com/showthread.php?t=956258

on OS X you do /not/ have a dynamic lookup of shared libs in the sense that a predefined order of paths is checked for the existence of a certain shared library.

The path of a given library is always [1] "hard-coded" into the executable/dependent library - that's where the "install_name_tool" comes into play which lets you set both a "library identifier" for the library as well as the path to it in the dependent binaries.

Refer e.g. to 

  http://osiris.laya.com/coding/dylib_linking.html

Also the Qt docs themselves explain how to "deploy on Mac":

  http://qt-project.org/doc/qt-5.0/qtdoc/deployment-mac.html

What that means: even if you have a library in /usr/lib/foo.dynlib with an "identifier" "foo.dylib" (can't remember what "identifiers" usually look like - refer to docs), but that path is not compiled into your executable (or the hard-coded path was something else like /usr/LOCAL/lib/foo.dynlib) then foo.dynlib /won't/ be found!

Note that the paths can (and usually are) be relative to each other. That's why you can move around application "bundles" and they still execute.

So if you *really* want to have your Oracle libs under /usr/lib/wherever *and* you are sure that they will be exactly placed at /this/ location on every Mac you intend to deploy your application, then you need to change that path in all your libraries (including Qt libs, in case they refer to it - e.g. the plugin!) and executables that refer to it! -> install_name_tool.

The preferred way would probably be to use relative paths and put the Oracle libs into your app bundle.


Anyway, that's how I have it roughly in mind. Details might be different ;)

[1] It /might/ be possible to circumvent that "hard-coded library path" and use a more flexible/Unix-like lib resolution with some linker flags, which would then also honour LD_LIBRARY_PATH and Co - but not sure.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131113/4e969299/attachment.html>


More information about the Interest mailing list