[Development] Qt 4.x and Qt 5 frameworks should use @rpath (QTBUG-31814)

Jake Petroules jake.petroules at petroules.com
Sat Aug 9 21:56:57 CEST 2014


On 2014-08-09, at 09:29 AM, Thiago Macieira <thiago.macieira at intel.com> wrote:

> On Saturday 09 August 2014 04:59:57 Jake Petroules wrote:
>> On 2014-08-08, at 07:52 PM, Thiago Macieira <thiago.macieira at intel.com> 
> wrote:
>>> On Friday 08 August 2014 15:22:44 Jake Petroules wrote:
>>>> In qmake, can you explain why we can't use:
>>>> QCoreApplication::applicationFilePath() + "/../bin", etc.?
>>> 
>>> Because that might be completely different on other machines. The prefix
>>> to the bin directory is a user choice on configuring, just as any other
>>> paths.
>> 
>> Can't we place a textual configuration file somewhere alongside qmake?
> 
> Not for the generic case. No Linux distribution worth their 2 cents will 
> accept a text file in /usr/bin.
> 
> Though if they follow our advice, it's qtchooser in /usr/bin and the actual Qt 
> binaries will be in $libdir/qt5/bin.
> 
>> This
>> would be preferable to binary patching. If file is missing, determine paths
>> automatically (which should work fine for OS X).
> 
> Are you sure? From qcoreapplication_mac.cpp:
> 
>        QCFType<CFURLRef> 
> bundleURL(CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
> 
> qmake isn't a bundle. Does the above work?

Of course. On Darwin, everything is a bundle, even if it isn't. :)

> Not to mention that qmake has no QCoreApplication in the first place.

It's a static method.

>>> And besides, applicationFilePath() may fail on some systems.
>> 
>> Systems people actually use + Qt supports or "some systems" in the academic
>> sense? Examples?
> 
> QCoreApplication::applicationFilePath() has an implementation for:
> - Windows
> - Blackberry
> - iOS and OS X (bundle only)
> - Linux with /proc (excludes Android)
> 
> That leaves out very important to us: Android and QNX. They fall back to 
> parsing argv[0], which can fail for a variety of reasons, including users 
> passing dummy argv arrays to QCoreApplication.

Excluding Android and QNX, can we leave each path in qmake empty unless otherwise specified, in order to allow it to fall back to a default based on the filesystem location of qmake[.exe]? CONFIG could contain a new dynamic_qmake_path; mkspecs for platforms other than Android and QNX can add this. When building qmake, add:

1. User-specified path from configure (cut off the prefix if the platform has dynamic_qmake_path, too), or:
2. Default path based on prefix specified in configure if ! dynamic_qmake_path, or:
3. Empty string, in which case applicationFilePath + XXX is used at runtime

Would this work?

>> (BTW, how does this part work on Windows? There's no sonames to patch but do
>> paths in qmake.exe get rewritten?)
> 
> Yes, they do. qmake is patched in all SDK installations.
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-- 
Jake Petroules - jake.petroules at petroules.com
Chief Technology Officer - Petroules Corporation




More information about the Development mailing list