[Development] Fixing the DLL/shared/static mess

Thiago Macieira thiago.macieira at intel.com
Fri Apr 13 18:55:04 CEST 2012


On sexta-feira, 13 de abril de 2012 13.41.34, Thiago Macieira wrote:
> I ran into Ossi and Marius S.O. talking about the mess we have with the
> build and use of Qt as shared/DLL or static. It's something I had begun
> fixing, but I haven't finished yet.
> 
> If you're dealing with a different buildsystem than qmake, or you're
> packaging Qt, please my email that is a reply to this:

The word "read" in "please read my email"  was missing.

> 4) Packagers who package only one type of Qt build (shared or static, but
> not both), should not see any changes either. One Qt build means a set of
> library files and the headers (e.g.: libQtCore.so and qconfig.h).

THIS IS A PROPOSAL

A static-and-shared build of Qt is currently not supported. There are no plans 
to accomplish this with the current buildsystem in one build.

However, it might be possible to do it in two builds. If you want to try this, 
the recommendation is:

1) configure Qt for shared
2) build and install all libs and headers, including qconfig.h, qconfig.pri
3) configure Qt for static
4) build but install *only* the library files; do NOT overwrite qconfig.h
5) report back to the mailing list because we need the feedback

ASSUMPTION: you *can* have both sets of libraries installed in the same place 
and your linker will link to the shared Qt if no extra command-line options 
are passed. 

On Windows, since linking to a DLL actually links to a static import library, 
the above is not possible.

Buildsystems should be changed to support compile-time selection of which one 
to link to.

For qmake, the proposed solution is:
CONFIG += prefer_shared_qt
CONFIG += prefer_static_qt

prefer_shared_qt is a no-op, since it's the default

prefer_static_qt defines QT_STATIC and must also use a static linking form:

	-static -lQtQml -lQtGui -lQtCore -shared $dependent_libs

The dependent libs need to be read from each lib's .prl file LIBS_PRIVATE 
variable (currently not set).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120413/0fd776fc/attachment.sig>


More information about the Development mailing list