[caret-users] howto compile 5.613 on Debian

Bayle Shanks bshanks.list at gmail.com
Fri Mar 19 18:09:03 CDT 2010

Here's how i compiled Caret on my Debian system.

i installed the following Debian packages:

libqwt5-qt4-dev (5.2.0-1)
libvtk5-dev (5.4.2-5)
libqt4-dev (4:4.5.3-4)
cmake (2.6.0-6)
libqwtplot3d-qt4-dev (0.2.7+svn1)

i didn't install ITK.

i ran as root:
  ln -s /usr/lib/libGL.so.1 /usr/lib/libGL.so

 export VTK_INC_DIR=/usr/include/vtk-5.4/
 export VTK_LIB_DIR=/usr/lib
 export QWT_INC_DIR=/usr/include/qwt-qt4
 export QWT_LIB_DIR=/usr/lib
 export QTDIR=/usr/share/qt4

 # caret_build.patch is attached to this email
 patch --strip=1 < ../caret_build.patch

 make qmake-dynamic
 make build

At this point the caret5 executable is in the "caret" subdirectory.

Now each time before running,

 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/qt4/plugins/imageformats


Some notes on caret_build.patch:

* Added compiler define NO_PATENTS which tells caret/GuiRecordingDialog.cxx
and caret_qmake_include.pro not to use vtkMPEG2Writer (NO_PATENTS doesn't
affect caret/GuiRecordingDialog.h, but mb it should)
* Removed all reference to vtkMPEG1Writer.h b/c vtkMPEG1Writer doesnt seem
to exist (anymore?) according to
* Changed the name of some libraries in caret/caret5.pro:

+++ caret_source/caret/caret5.pro    2010-03-15 18:33:52.000000000 -0700
@@ -140,9 +140,9 @@
    # FreeBSD also does not have libdl, but integrates its functions
    # into libc.
    !exists( /etc/rc.conf ) {
-      LIBS += -lvtkjpeg \
-              -lvtkpng \
-              -lvtkexpat \
+      LIBS += -ljpeg \
+              -lpng \
+              -lexpat \

* took out some static linking via Q_IMPORT_PLUGIN from caret/main.cxx:

--- caret_source_5.613_orig/caret/main.cxx    2009-07-08 14:17:05.000000000
+++ caret_source/caret/main.cxx    2010-03-15 18:33:52.000000000 -0700
@@ -523,9 +523,9 @@
    // needed for static linking to have JPEG support
-   Q_IMPORT_PLUGIN(qjpeg) //QJpegPlugin)
-   Q_IMPORT_PLUGIN(qgif)  //QGifPlugin)
-   Q_IMPORT_PLUGIN(qtiff) //QTiffPlugin)
+   //Q_IMPORT_PLUGIN(qjpeg) //QJpegPlugin)
+   //Q_IMPORT_PLUGIN(qgif)  //QGifPlugin)
+   //Q_IMPORT_PLUGIN(qtiff) //QTiffPlugin)

* vtk's GetNextCell and InsertNextCell now take "vtkIdType" instead of
"int". I changed some variables from type "int" to type "vtkIdType". But
there were some times when integer constants were used or when a for loop
was used with an int counter to iterate --- in those cases i kept it as int
and typecast the ints to vtkIdType. This may not be safe, I don't know, and
I haven't tested those code paths. But it makes it compile... At one point,
I added an #include "vtkCellArray.h", which seems to make vtkIdType defined.

* vtk's PrintSelf now takes a vtkIndent rather than an int. Again, i
typecast. Again, i don't know if this is safe.

* Manually defined HAVE_VTK5 and NO_PATENTS at the top of

* In caret_qmake_include.pro, rather than have the VTK5 code block
conditional upon "exists( $(VTK_INC_DIR)/vtkMPEG2Writer.h )", i made it
conditional upon "contains ( DEFINES, HAVE_VTK5 )", and then, above, added a
block which sets HAVE_VTK5 if exists( $(VTK_INC_DIR)/vtkMPEG2Writer.h )

* In caret_qmake_include.pro, changed some library names:
lvtkjpeg              ljpeg
lvtkpng                  lpng
lvtkexpat              lexpat
lvtkzlib              lz
lqwt                  lqwt-qt4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://brainvis.wustl.edu/pipermail/caret-users/attachments/20100319/73640206/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: caret_build.patch
Type: text/x-diff
Size: 21490 bytes
Desc: not available
URL: <http://brainvis.wustl.edu/pipermail/caret-users/attachments/20100319/73640206/attachment-0002.bin>

More information about the caret-users mailing list