Compiling Qtiplot 0.9.8.9+2400svn

This post is about how I was able to successfully compile and package the most recent svn checkout of qtiplot on my Ubuntu 12.04 x64 installation.

Qtiplot is a great software for scientific plotting, and is a very functional open-source replacement for Origin. Since it is a Qt application and open source, it can be compiled on pretty much any platform (although it is not the most trivial of compilations). The maintainer provides precompiled binaries if you subscribe ($$$) to a maintenance contract, but there’s no reason you can’t compile it yourself! Here’s how I managed to get it working on my installation.

  • Download the latest SVN of qtiplot from the development website (as of writing, this is rev. 2400) and rename the directory for clarity:
    svn checkout http://svn.berlios.de/svnroot/repos/qtiplot/trunk mv trunk qtiplot-0.9.8.9+svn2400 
  • Download and install the dependencies that you will need to compile the program:
    sudo apt-get install libboost-all-dev libgsl0-dev libqt4-dev docbook-utils dblatex libpng12-dev libtool zlib1g-dev qt4-dev-tools python-all-dev libxext-dev libqtassistantclient-dev libmuparser-dev python-qt4-dev python-sip-dev pyqt4-dev-tools 
  • Now we’ll need to download and compile a few third party libraries that are not included with the qtiplot sources: tamu_anova (0.2), QTeXEngine (0.3), and algLib(2.6.0):
    • (Note: if these sources are not available, you can download them from here, here, and here and proceed as below w/o the wget commands)
    cd qtiplot-0.9.8.9+svn2400/3rdparty
    wget http://ftp.debian.org/debian/pool/main/t/tamuanova/tamuanova_0.2.orig.tar.gz
    tar xvzf tamu_anova-0.2.tar.gz
    cd tamu_anova-0.2
    ./configure
    make
    cd ..
    wget http://download.berlios.de/qtiplot/QTeXEngine-0.3-opensource.zip
    unzip QTeXEngine-0.3-opensource.zip
    cd QTeXEngine
    qmake
    make
    cd ..
    wget http://www.alglib.net/translator/re/alglib-2.6.0.cpp.zip
    unzip alglib-2.6.0.cpp.zip
    cd cpp
    chmod +x build
    ./build gcc
    cd ..
  • After this, your 3rdparty folder should look something like this:
    drwxrwxr-x 9 josh josh 4.0K Jul 30 12:30 ./
    drwxrwxr-x 7 josh josh 4.0K Jul 30 10:53 ../
    -rw-rw-r-- 1 josh josh 1.1M Sep 28  2011 alglib-2.6.0.cpp.zip
    drwxrwxr-x 8 josh josh 4.0K Jul 30 12:30 cpp/
    drwxrwxr-x 8 josh josh 4.0K Jul 30 12:30 QTeXEngine/
    -rw-rw-r-- 1 josh josh 143K Nov  9  2010 QTeXEngine-0.3-opensource.zip
    drwxrwxr-x 4 josh josh 4.0K Jul 30 10:46 qwt/
    drwxrwxr-x 6 josh josh 4.0K Jul 30 10:46 qwtplot3d/
    drwxrwxr-x 6 josh josh 4.0K Jul 30 10:53 .svn/
    drwxrwxr-x 2 josh josh 4.0K Jul 30 11:55 tamu_anova-0.2/
    -rw-rw-r-- 1 josh josh 216K Apr 28  2011 tamuanova_0.2.orig.tar.gz
    drwxrwxr-x 3 josh josh 4.0K Jul 30 10:46 zlib/
    
  • Now, you need to make a slight modification to one of the source files in order for the comilation to be successful because they don’t include the correct libraries:
    • We need to modify the file ./3rdparty/qwtplot3d/include/qwt3d_global.h by adding the GL/glu.h line, so the first 8 lines of the file look like:
    #ifndef QWT3D_GLOBAL_H
    #define QWT3D_GLOBAL_H
    
    #include <qglobal.h>
    #include <GL/glu.h>
    #if QT_VERSION < 0x040000
    #include <qmodules.h>
    #endif
  • The next step is to create a build.conf file. This file goes in the original ./qtiplot-0.9.8.9+svn2400/ folder. You’ll notice that a build.conf.example file is included with the source, and this will show you the syntax, but does not have the correct path and library options. Copy the one that I used below, or download here.
    isEmpty( QTI_ROOT ) {
      message( "each file including this config needs to set QTI_ROOT to the dir containing this file!" )
    }
    
    ##########################################################
    ##     System specific configuration
    ##########################################################
    
    # Global include path which is always added at the end of the INCLUDEPATH
    SYS_INCLUDEPATH  =/usr/include/
    SYS_INCLUDEPATH = -I/$$QTI_ROOT/tmp/qtiplot
    # Global lib path and libs which is ls always added at the end of LIBS
    SYS_LIBS = -L/usr/lib -lGLU -lz
    
    ##########################################################
    ## muParser (http://muparser.sourceforge.net/)
    ##########################################################
    
    MUPARSER_INCLUDEPATH = /usr/include/muParser
    MUPARSER_LIBS = -lmuparser
    
    ##########################################################
    ## GNU Sientific Library (http://www.gnu.org/software/gsl/)
    ##########################################################
    
    GSL_LIBS = -lgsl -lgslcblas
    
    ##########################################################
    ## QWT - use local copy
    # http://qwt.sourceforge.net/index.html
    ##########################################################
    
    # include path.
    QWT_INCLUDEPATH = $$QTI_ROOT/3rdparty/qwt/src
    # link locally against a copy in 3rdparty/
    QWT_LIBS = $$QTI_ROOT/3rdparty/qwt/lib/libqwt.a
    
    ##########################################################
    ## QwtPlot3D - use local copy
    # http://qwtplot3d.sourceforge.net/
    ##########################################################
    
    # include path.
    QWT3D_INCLUDEPATH = $$QTI_ROOT/3rdparty/qwtplot3d/include
    # link locally against a copy in 3rdparty/
    QWT3D_LIBS = $$QTI_ROOT/3rdparty/qwtplot3d/lib/libqwtplot3d.a
    
    ##########################################################
    ## libpng - use system config
    ##########################################################
    
    LIBPNG_LIBS = -lpng
    
    ##########################################################
    ## QTeXEngine - use local config
    # http://soft.proindependent.com/qtexengine/
    ##########################################################
    
    # include path.
    TEX_ENGINE_INCLUDEPATH = $$QTI_ROOT/3rdparty/QTeXEngine/src
    # link locally against a copy in 3rdparty/
    TEX_ENGINE_LIBS = $$QTI_ROOT/3rdparty/QTeXEngine/libQTeXEngine.a
    
    ##########################################################
    ## ALGLIB (2.6) - use local config
    # http://www.alglib.net/
    ##########################################################
    
    # include path.
    ALGLIB_INCLUDEPATH = $$QTI_ROOT/3rdparty/cpp/src
    # link locally against a copy in 3rdparty/
    ALGLIB_LIBS = $$QTI_ROOT/3rdparty/cpp/out/libalglib.a
    
    ##########################################################
    ## TAMUANOVA - optional. you don't have to set these variables
    # http://www.stat.tamu.edu/~aredd/tamuanova/
    ##########################################################
    
    # include path.
    TAMUANOVA_INCLUDEPATH = $$QTI_ROOT/3rdparty/tamu_anova-0.2/
    # link locally against a copy in 3rdparty/
    TAMUANOVA_LIBS = $$QTI_ROOT/3rdparty/tamu_anova-0.2/libtamuanova.a
    
    ##########################################################
    ## python - system installation
    ##########################################################
    
    # the python interpreter to use
    PYTHON = python
    
    ##########################################################
    ## Qt tools - allows to use specific versions
    ##########################################################
    
    LUPDATE = lupdate
    LRELEASE = lrelease
    
    ############################################################
    ##  Target specific configuration: configure Qtiplot itself
    ############################################################
    
    contains( TARGET, qtiplot ) {
      # building without muParser doesn't work yet
      SCRIPTING_LANGS += muParser
      SCRIPTING_LANGS += Python
    
      # a console displaying output of scripts; particularly useful on Windows
      # where running QtiPlot from a terminal is inconvenient
      DEFINES         += SCRIPTING_CONSOLE
    
      # Uncomment the following line if you want to perform a custom installation using the *.path variables defined in ./qtiplot.pro.
      #CONFIG          += CustomInstall
    
      CONFIG          += release
      #CONFIG          += debug
    }
    
  • Now, after all that work you have to try to compile the software (this may take some time if you have a slow computer). First, run the following from the ./qtiplot-0.9.8.9+svn2400/ folder:
    qmake qtiplot.pro
    make
    
    • Note: you can speed up the compilation process by using the -j option and providing a number of parallel processors to use. You can also use the -s option to reduce some of the output of the make command. The command that I use is:
    • make -j 4 -s 
  • If everything goes according to plan, after some time you should have an executable file named qtiplot in the ./qtiplot-0.9.8.9+svn2400/qtiplot/ folder. You can test it out by running the following commands:
     cd qtiplot
    ./qtiplot
    
  • You should now hopefully be running the most up to date version of qtiplot. Congratulations! Configuration options can be modified in the program, and the settings file (if you need to back it up) is located at
    $HOME/.config/ProIndependent/QtiPlot.conf
  • The default source packages do not come with a suitable Makefile for running `sudo make install` like you normally would to install the program. At this point, I would either create a link to the executable on your path, or continue and try to edit the Makefile. Since this is something I didn’t have time to do, I just did the first option, as it works for me.
  • UPDATE: If you do not want to all of this, I’ve found an Ubuntu PPA maintained by Francis Brown that contains both the latest stable version of qtiplot and the latest svn checkout as well. This is much easier, as he has taken care of all the hard work, but you don’t get the fun learning process that comes with compiling your own software.
    • To install the latest stable version:
      sudo add-apt-repository ppa:francisbrwn9/ppa
      sudo apt-get update
      sudo apt-get install qtiplot
      
    • To install the latest svn checkout:
      sudo add-apt-repository ppa:francisbrwn9/testing
      sudo apt-get update
      sudo apt-get install qtiplot
      

Let me know how this works out for you in the comments, or if you have any questions.

Tags: , , , , ,

5 Responses to “Compiling Qtiplot 0.9.8.9+2400svn”

  1. niv levy Says:
    January 20th, 2013 at 9:19 pm

    i had to modify one other file 3rdparty/qwtplot3d/include/qwt3d_openglhelper.h in a similar manner – i.e. inserting #include when compiled from 0.9.8.9 instead of from svn (which i can’t seem to access, either using the link you supplied or that suggested on qtiplot’s site). In any case, i still get that some features (e.g. open excel file) are limited to qtiplot pro, which i find a bit odd considering that supposdely it’s opensource and the only difference with the subscription version is the ability to download binaries.

  2. Joshua Taillon Says:
    January 22nd, 2013 at 1:59 pm

    Hmm… yes, that is strange. I have noticed a number of issues with the qtiplot website lately. Namely, the forum is no longer available, and some of the original links are not working. I think that the maintainer has been making some changes, and it seems as though he might be trying to restrict access to these “pro” features (even though the software remains open source).

    I’m glad you were able to get the basic functionality working, at least.

  3. thomas Says:
    October 17th, 2013 at 4:39 am

    Dear Mr. Taillon,

    Thank you very much for your instructions!
    I followed them strictly (except I use the qtiplot-0.9.8.9.tar.bz2 file from the QTIPlot Website), but i run into some errors.

    When I do as you described and execute the “make” command,
    the process ends with this:
    “make: *** [sub-manual-install_subtargets] Error 2”

    I searched for a solution and found some on in this forum http://ubuntuforums.org/showthread.php?t=1521703,
    but when I follow their advice and delete the line “manual\” from the qtiplot.pro file in the main folder and then run “qmake qtiplot.pro” and “make” again it does not work correctly.
    The compilation process in the terminal looks quiet different from the first on that ended in an error (but maybe this is irrelevant) and it looks like it finished without errors, but I can’t find any executeable qtiplot file in all folders.

    Do you have any idea what caused this?

    Another question:
    Do I have to remove the “+” at the beginning of the lines of the modification of the qwt3d_global.h file?

    Thank you!

    cheers,
    Thomas

    PS: How do write code in these grey boxes in this comments?

  4. Josh Says:
    October 30th, 2013 at 1:29 pm

    Hi Thomas, thanks for the comment, and sorry it took me so long to get back to you.

    I tried to do this the compilation as I have written, and I also ran into an error. It looks like when I copied over the build.conf file to the web, the line that says

    # Global include path which is always added at the end of the
    INCLUDEPATH
    

    should be all one line:

    # Global include path which is always added at the end of the INCLUDEPATH
    

    My make command bugged out on this line b/c it didn’t know what “INCLUDEPATH” was. I’m guessing that this was your error as well? There should be some sort of error output when you do the make command, but it may be buried somewhere earlier. Look for the ‘***’ that highlights where the error happened, and it should give you some idea of what went wrong.

    As for the qwtplot3d files, it looks like there is an error on my page… it looks like wordpress didn’t like how that code was formatted, for some reason. You’re correct about not using the ‘+’ characters, but it looks like the header files somehow went missing from there, and the ‘#’ characters got dropped. So I think that section should look like:

    #ifndef QWT3D_GLOBAL_H
    #define QWT3D_GLOBAL_H
    
    #include <qglobal.h>
    #include <GL/glu.h>
    #if QT_VERSION < 0x040000
    #include <qmodules.h>
    #endif
    

    I just tried the compilation again following the instructions on this page (substituting pyqt4-dev-tools for pyqt4-dev-tool on Ubuntu 13.04, another typo). It worked pretty well, but bombed out complaining that:

    /usr/bin/ld: note: 'gzclose' is defined in DSO /lib/x86_64-linux-gnu/libz.so.1 so try adding it to the linker command line
    /lib/x86_64-linux-gnu/libz.so.1: could not read symbols: Invalid operation
    

    I fixed this by adding ‘-lz’ to the SYS_LIBS in the build.conf file, as reflected in the edited page up above.

    I updated this page, and the method shown worked for me on Ubuntu 13.04 x64. I also switched around the source code plugin that I’m using to try to make the display and copying of code more consistent, since I was having some issues before. Hopefully this works better for you now.

    Honestly though, Qtiplot was too much work for me and too unstable to use regularly, so I’ve switched to origin (unfortunately). If there are any other changes to the code/libraries, I probably won’t be too active in updating this page, since I don’t use the software anymore, but hopefully this will help you get it working.

  5. Josh Says:
    October 30th, 2013 at 1:33 pm

    Thomas, you can include code in the comments by enclosing it in square brackets, like this

    [code]example code[/ code]

    Just make sure to remove the space between '/' and 'code' in the second tag (I just had to do this so it would display correctly here.

Leave a Reply

Search Previous Posts