[Development] Non-movable Qt build

Lincoln Ramsay a1291762 at gmail.com
Wed Jan 2 14:33:57 CET 2013


On 2/01/13 11:01 PM, Peter Kümmel wrote:
> On 02.01.2013 13:50, Yves Bailly wrote:
>> Le 02/01/2013 13:42, Thiago Macieira a écrit :
>>> On quarta-feira, 2 de janeiro de 2013 10.53.03, Yves Bailly wrote:
>>>> Does anyone knows where I could find the source code of the "official"
>>>> installer, or at least some information about what it does? Because the
>>>> installer does relocate the binaries, that would be a good starting point
>>>> to relocate my own binaries...
>>> It simply edits the qmake and QtCore DLL binaries, plus maybe some files in
>>> mkspecs, changing a placeholder prefix to the installation dir.
>> Editing binaries? hu, havent't done that since... a long time ;-) Changing some
> Sounds like a really bad hack. And this was not changed in Qt 5?
>

QTDIR was a hack. You'd end up with the libs from one version of Qt and 
the plugins from another. Plus, Qt installations couldn't have parts in 
arbitrary locations like they can now.

qt.conf is a hack because your app doesn't read it before it's found 
QtCore (so it can't change the Qt libs your app pulls in, only the 
plugins and data paths).

Your Qt app has to know where Qt lives. Since it must be able to locate 
QtCore.[so|dll|dylib] in order to even start, that is the most reliable 
place to store the location(s) of Qt. The strings are even designed to 
be patched, padded out to a fixed length and with markers to help 
patching tools.

Your app should have an embedded RPATH or similar that causes it to use 
a specific Qt. If you want to use a different Qt, change the embedded 
RPATH, re-link against the different Qt or use a runtime method 
([[DY]LD_LIBRARY_]PATH).

Yes, this means you need to change the strings in QtCore if you move it. 
And if you move the "SDK" part, you'll need to change paths in qmake and 
various files it reads to make sure everything can be found.

I second calls for simple tools to perform these operations to be made 
available but I've been doing that for a long time.

Qtopia had a simple perl script to patch QtCore. It's old but should 
give you an idea of how easy it is to do the patching of QtCore/qmake. 
The SDK patching just requires replacing strings in text files.

https://bugreports.qt-project.org/secure/attachment/19980/patchqt

-- 
Link




More information about the Development mailing list