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

Thiago Macieira thiago.macieira at intel.com
Sat Aug 9 15:29:02 CEST 2014


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?

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

> > 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.

> (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




More information about the Development mailing list