[vtkusers] VTK and Qt, static build

Clinton Stimpson clinton at elemtech.com
Mon Sep 20 11:41:14 EDT 2010


On Sunday, September 19, 2010 07:45:16 pm Gib Bogle wrote:
> I've been spending a couple of days trying to build a static version of
> Qt-4.6.3, then linking it into a static build of VTK, with the aim of being
> able to distribute a single execution file instead of a big package of
> DLLs.  This process has been fraught with problems, and I'm posting about
> it in the hope that someone else has ventured down the same path.  A
> forlorn hope, perhaps.
> 
> The static build of Qt-4.6.3 has errors that can be side-stepped (loosely
> based on info from Nokia) by replacing
> Q_DECL_IMPORT extern
> by
> Q_CORE_EXPORT
> in a couple of files.  This generates static Qt libraries, but when these
> are used in the VTK build (with Qt) there are many "undefined reference"
> errors referring to Qt functions.
> 
> Can VTK be built static using static Qt libraries?  Do I need to do
> anything special in the cmake configure?  As it is I see that the .a
> versions of the libraries are being selected.  It isn't clear to me what
> is the root cause of the compile errors I'm seeing.

A static Qt and VTK should work.  I just tried on Linux and it worked.

I suggest, you check your Qt build against the Qt examples to see if you get 
unresolved references.  If you have problems, you could go to the Qt list for 
help.
Then introduce VTK.  If you start having problems when VTK is introduced, then 
you can give us the link errors you are seeing.

Clint



More information about the vtkusers mailing list