> On Nov 11, 2016, at 1:47 AM, Prashanth Udupa <prashanth.ud...@gmail.com> 
> wrote:
> 
> Hi Jake,
>  
> > install_name_tool -id @executable_path/../Frameworks/externalLib.dylib 
> > MyWonderfulApp.app/Contents/Frameworks/externalLib.dylib
> 
> Don't do that last install_name_tool command. Instead, build your dynamic 
> library with:
> in qmake...
>         QMAKE_SONAME_PREFIX = @rpath (which is equivalent to QMAKE_LFLAGS += 
> -Wl,-install_name,@rpath/externalLib.dylib)
> or in qbs...
>         cpp.sonamePrefix: "@rpath"
> 
> In my case, I use an external-lib provided by someone else. I cannot rebuild 
> it from source code - I can only link to it. Its available in /usr/local/lib 
> folder on my Mac while building. But it needs to be included in the 
> app-bundle for deployment.

In that case your install_name_tool command should be:

install_name_tool -id @rpath/externalLib.dylib /usr/local/lib/externalLib.dylib

Just run that once on your global copy and you don't need to run it again each 
time you build your app since it will work for copying to any application.

I'd also recommend reading up on Run-Path Dependent Libraries at Apple 
Developer: 
https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html#//apple_ref/doc/uid/TP40008306-SW1
 which explains the concept of relocatability in depth.

> 
> In anycase, I did not know about QMAKE_SONAME_PREFIX. This is good, thanks!
>  
> and build your main application and command line helper tool with:
> in qmake...
>         QMAKE_RPATHDIR += @loader_path/../Frameworks (which is equivalent to 
> QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../Frameworks)
> or in qbs...
>         cpp.rpaths: ["@loader_path/../Frameworks"]
> 
> I did not know this either. Thanks!
> 
> Thanks,
> Prashanth
> 

-- 
Jake Petroules - jake.petrou...@qt.io
The Qt Company - Silicon Valley
Qbs build tool evangelist - qbs.io

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to