tags:

views:

223

answers:

4

I have used Qt to build a small application. It turns out that I need to reconfigure and Qt from scratch in order to be able to link statically. I've done it before, and I remember that it was a very long process.

So does anyone know a Qt SDK installer that provides the ability for static linking out of the box?

+1  A: 

If you want to statically link Qt you need the commercial license - which comes with static libs.

EDIT - yes you could arguably provide the user with some sort of patch tool to allow them to switch your statically linked Qt lib with their own version and remain within the LGPL - but really?

Martin Beckett
You can create static libraries and link to them with the free version
PiedPiper
Yes and i can get a really good loan rate from the bank with a sawn-off shotgun but it's not legal.
Martin Beckett
Damn. I didn't know this (about static linking Qt).
StackedCrooked
A: 

For Unix / Windows / Mac OS-x, it's as easy as adding the -static option to configure:

-static ............ Create and use static Qt libraries.

The deployment page links to specifics about each OS.

Kaleb Pederson
A: 

A very detailed post on building a static version of Qt with both the MS and gcc toolsets can be found here.

Rob
+2  A: 

In addition to Martin Beckett's answer.

Be careful with licenses!

If you use Qt under (L)GPL license terms and distribute your own app under (L)GPL too, than everything is OK.

Of course if you want to make proprietary software than the situation is more complicated. Very roughly, the end user should be able to (modify and) recompile Qt and use your application with the (modified and) recompiled version of the library. To achieve this with static linking, without making your source code available to the end users, it is enough to provide a linkable object code so they can re-link with their modified library.

Also if I remember correctly if you use LGPL Qt and provide source code, you don't have to use the LGPL license for your own code. You can compose your own license (if you are a lawyer =)) and deny any rights other than that the user can re-compile and re-link.

kemiisto
Correct - you can distribute a commercial app with LGPL Qt, you simply supply the QtXXX.dlls and put them in the same dir as your app. Really it's no more restricting than using MFC in a dll
Martin Beckett