Building Qt Jambi 4.7 on Ubuntu 10.04

NOTE: This is an Ubuntu-only tutorial. Some parts of it may not work on other Linux distributions. For the general building documentation visit: http://qtjambi.sourceforge.net/development/building/.

Finally I’ve managed to compile the latest version of Qt-Jambi framework, here I’ll share with you my build-experiences and highlight the points where you can break something.
There is also a Building document on the official website of Qt-Jambi, what gives an overview about building on several platforms, here I’ll focus to Ubuntu 10.04.
Grab the latest version from git, because the development happens here. Type in Terminal:

git clone git://gitorious.org/qt-jambi/qtjambi-4_7.git

Important: always check it twice before cloning, there are more qt-jambi repositories hosted at http://qt.gitorious.org/, but with the given build dependencies just this one compiles – eventually the trolltech one if you compile it against system Qt.
The URL after gitorious.org/qt-jambi/ will be change from time-to-time, you can make sure that you have typed the right URL by navigating to the community git repository of Qt-Jambi, and copying the URL from Clone & push urls.

Assuming that you are using Ubuntu 10.04 so you don’t need the kde-phonon backend. The list of dependencies is:

  • For Qt-Jambi:
  • openjdk-6-jdk (or alternatively the sun-java-jdk)
    ant-optional
    ant
    libxext-dev
    libgstreamer-plugins-base0.10-dev
    libgstreamer0.10-dev
    build-essential
    chrpath
    libgtk2.0-dev
    libexpat1-dev
    libfontconfig1-dev
    libfreetype6-dev
    libpng12-dev
    libcups2-dev
    libgtk2.0-dev
    libssl-dev
    libasound2-dev
    libdbus-qt-1-dev

  • For Qt itself:
  • phonon-backend-gstreamer
    libqt4-dev
    libphonon-dev

    You can install these from synaptic or copy/paste to the Terminal:

    sudo apt-get install openjdk-6-jdk ant-optional ant libxext-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev build-essential chrpath libgtk2.0-dev libexpat1-dev libfontconfig1-dev libfreetype6-dev libpng12-dev libcups2-dev libgtk2.0-dev libssl-dev libasound2-dev libdbus-qt-1-dev phonon-backend-gstreamer libqt4-dev libphonon-dev

    After cloning the repository and downloading the build dependencies go to the root directory of the cloned repository.
    In the Terminal session where you have checked out the git clone type:

    cd qtjambi-4_7

    If you have installed the libqt4-dev through the package management system then you don’t need to change anything.
    If you have your own compiled version of Qt then modify the variables qt.libdir, qt.includedir, qt.pluginsdir in buildpath.properties according to your Qt installation.

    Modify the version.properties file according to your Qt version (take a look to aptitude show libqt4-dev).

    Add the following environment variables to your ~/.bashrc file:

    #QTDIR bin
    PATH=/usr/share/qt4/bin:$PATH
    export PATH

    #set for Qt home
    QTDIR=/usr/share/qt4
    export QTDIR

    #set for Qt Libraries, usually QTDIR/bin
    LD_LIBRARY_PATH=/usr/share/qt4/lib
    export LD_LIBRARY_PATH

    #set for Java home (the exact path depends on your Java version)
    JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20
    export JAVA_HOME

    Restart the Terminal to apply the new environment variables, and in the directory qtjambi-4_7 type:
    ant all
    .

    When the build finished you can try running the Qt-Jambi demo program, by typing:

    java -cp "qtjambi-4.6.2.jar:qtjambi-linux32-gcc-4.6.2.jar:qtjambi-util-4.6.2.jar:qtjambi-examples-4.6.2.jar:qtjambi-designer-4.6.2.jar" com.trolltech.launcher.Launcher
    .
    If you have any questions or errors during the building, please drop a comment or take a look to #qtjambi IRC channel on irc.freenode.org.

    Happy hacking.

    Advertisements

    23 thoughts on “Building Qt Jambi 4.7 on Ubuntu 10.04

    1. gilangaramadan

      hello i have a problem to compile the source, this is it

      /home/noixx/qtjambi-4_7/setenv.xml:163: ERROR: qt-jambi version and qt version differ (qt-jambi: 4.6.2-0, qt: **Unknown**

      the version.properties has been edited to 4.6.2-0, after i show the libqt4-dev the version is 4:4.6.2-0ubuntu5.1

      how to solve the problem?
      thx.

      Reply
    2. akoskm Post author

      open the file called setenv.xml in the directory where you unpackaged the sources. on line 140 change:

      name=”qmake.binary” value=”qmake”

      to

      name=”qmake.binary” value=”qmake-qt4″

      Reply
    3. gilangaramadan

      Hey i wanna ask again, how to start qtjambi designer?
      I use java -jar qtjambi-designer-4.6.2.jar

      and is not working..

      Failed to load Main-Class manifest attribute from
      qtjambi-designer-4.6.2.jar

      how to solve it? thxb4

      Reply
      1. akoskm Post author

        Come up to our IRC channel #qtjambi at irc.freenode.org. I hope somebody will be able to help you, because I have no Designer knowledge at all. 🙂

        Reply
    4. Javier Faus

      Hi akoskm:

      I am trying to get that done in my Ubuntu 10.10 (amd64) but the package libdbus-qt-1-dev has been deleted from the repositories.

      Any ideas on how to workaround that problem would be very appreciated. Thanks in advance.

      Javier.

      PS: By the way, gilangaramadan were you able to get the designer to work with QT Jambi?

      Reply
      1. akoskm Post author

        Sadly there is no easy workaround to build it with _Ubuntu’s_ system-qt. The Qt Jambi modules aren’t separated yet, so building only some parts of if is not possible.
        However, compiling it with own-built Qt goes very well, so I suggest you this way.
        If you have any problem, let us know on #qtjambi at freenode.net

        Reply
    5. Javier Faus

      Hi akoskm:

      Thanks for your reply, I am trying to compile the copy form the repository so I have downloaded as you state in your post.

      After that I have installed the following packages:

      sudo apt-get install openjdk-6-jdk ant-optional ant kdelibs5-dev libxext-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev build-essential chrpath libgtk2.0-dev libexpat1-dev libfontconfig1-dev libfreetype6-dev libpng12-dev libcups2-dev libgtk2.0-dev libssl-dev libasound2-dev phonon-backend-gstreamer ñ libphonon-dev libdbus-1-dev libdbusmenu-qt-dev libdbusmenu-qt2 libsmokephonon3 libqt4-webkit libqt4-webkit-dbg libqt4webkit-dbg libsmokeqtwebkit4-3

      And also modified my .bashrc the same way you explained before. Actually I had to add a simbolic link from /usr/share/qt4/lib to /usr/lib

      > link -s /usr/share/qt4/lib /usr/lib

      so that the libraries where found on compilation time.

      The hole process seems to be OK but I am stuck with an error regarding the webkit example.

      That’s what I get:

      jar.qtjambi-examples:

      jar_init:

      compile:
      [echo] Compiling java classes: src/java/qtjambi-examples
      [mkdir] Created dir: /home/javi/Escritorio/git/qtjambi-4_7/build/java/out/qtjambi-examples
      [javac] Compiling 109 source files to /home/javi/Escritorio/git/qtjambi-4_7/build/java/out/qtjambi-examples
      [javac] /home/javi/Escritorio/git/qtjambi-4_7/src/java/qtjambi-examples/com/trolltech/demos/webkit/HelloWebKit.java:49: package com.trolltech.qt.webkit does not exist
      [javac] import com.trolltech.qt.webkit.*;
      [javac] ^
      [javac] /home/javi/Escritorio/git/qtjambi-4_7/src/java/qtjambi-examples/com/trolltech/demos/webkit/HelloWebKit.java:54: cannot find symbol
      [javac] symbol : class QWebView
      [javac] location: class com.trolltech.demos.webkit.HelloWebKit
      [javac] private QWebView browser;
      [javac] ^
      [javac] /home/javi/Escritorio/git/qtjambi-4_7/src/java/qtjambi-examples/com/trolltech/demos/webkit/HelloWebKit.java:70: cannot find symbol
      [javac] symbol : class QWebView
      [javac] location: class com.trolltech.demos.webkit.HelloWebKit
      [javac] browser = new QWebView();
      [javac] ^
      [javac] 3 errors

      BUILD FAILED
      /home/javi/Escritorio/git/qtjambi-4_7/antfiles/java.xml:110: The following error occurred while executing this line:
      /home/javi/Escritorio/git/qtjambi-4_7/antfiles/jar.xml:77: Compile failed; see the compiler error output for details.

      PS: What’s the difference between the qtjambi-linux64-community-4.6.3 type of sources and the ones you get from the repository? It seems to me that the former ones are kind of a “pre-compiled” solution. If that’s the case, cuold I can develop my own application interfaces using this “pre-compiled” solution? Thanks indeed.

      Reply
      1. akoskm Post author

        Hi Javier!
        The problem that WebKit isn’t compiled – why? because of missing dependencies. Some packages required for qtjambi are removed from Ubuntu and as the community is focusing to release the 4.7 as soon as possible, such things like modularized building will be implemented later.
        For now, probably the easiest way to get Qt Jambi compiled is to get the Qt sources from http://qt.nokia.com/downloads/ compile it, then clone the repository http://qt.gitorious.org/qt-jambi/qtjambi-4_7 , set the variables in buildpath.properties to the correct paths (point to your own compiled Qt – should be somewhere in /usr/local/Trolltech/Qt….).
        You don’t need to edit your ~/.bashrc, comment out all variables what you set before – except JAVA_HOME – then type “ant all” in Qt Jambi’s root directory.

        Reply
    6. Michael Jones

      There is some problem with the way qtjambi configures the classpath.

      /home/jonesmz/qt-jambi/com/trolltech/tools/ant/InitializeTask.java:133: reference to setNewProperty is ambiguous, both method setNewProperty(org.apache.tools.ant.Project,java.lang.String,java.lang.Object) in org.apache.tools.ant.PropertyHelper and method setNewProperty(java.lang.String,java.lang.String,java.lang.Object) in org.apache.tools.ant.PropertyHelper match
      [javac] props.setNewProperty(null, LIBSUBDIR, decideLibSubDir());
      [javac] ^
      [javac] /home/jonesmz/qt-jambi/com/trolltech/tools/ant/InitializeTask.java:134: reference to setNewProperty is ambiguous, both method setNewProperty(org.apache.tools.ant.Project,java.lang.String,java.lang.Object) in org.apache.tools.ant.PropertyHelper and method setNewProperty(java.lang.String,java.lang.String,java.lang.Object) in org.apache.tools.ant.PropertyHelper match
      [javac] props.setNewProperty(null, QTDIR, decideQtDir());

      Errors similar to these two repeat 29 times.

      Reply
    7. gokul

      i got this error
      and i am using ant version 1.7.1

      compile:
      [echo] Compiling java classes: src/java/ant-qtjambi excludes: ${module.excludes}
      [mkdir] Created dir: /home/cyborg/hacks/qtjambi/qtjambi-community/build/java/ant-qtjambi
      [javac] Compiling 22 source files to /home/cyborg/hacks/qtjambi/qtjambi-community/build/java/ant-qtjambi
      [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
      [javac] /home/cyborg/hacks/qtjambi/qtjambi-community/src/java/ant-qtjambi/com/trolltech/tools/ant/AntUtil.java:17: error: method getProperty in class PropertyHelper cannot be applied to given types;
      [javac] return props.getProperty(attr); // ANT 1.8.x
      [javac] ^
      [javac] required: String,String
      [javac] found: String
      [javac] reason: actual and formal argument lists differ in length
      [javac] /home/cyborg/hacks/qtjambi/qtjambi-community/src/java/ant-qtjambi/com/trolltech/tools/ant/AntUtil.java:30: error: method setNewProperty in class PropertyHelper cannot be applied to given types;
      [javac] props.setNewProperty(name, value); // ANT 1.8.x
      [javac] ^
      [javac] required: String,String,Object
      [javac] found: String,String
      [javac] reason: actual and formal argument lists differ in length
      [javac] /home/cyborg/hacks/qtjambi/qtjambi-community/src/java/ant-qtjambi/com/trolltech/tools/ant/AntUtil.java:36: error: method setProperty in class PropertyHelper cannot be applied to given types;
      [javac] props.setProperty(name, value, false); // ANT 1.8.x
      [javac] ^
      [javac] required: String,String,Object,boolean
      [javac] found: String,String,boolean
      [javac] reason: actual and formal argument lists differ in length
      [javac] /home/cyborg/hacks/qtjambi/qtjambi-community/src/java/ant-qtjambi/com/trolltech/tools/ant/AntUtil.java:42: error: method setProperty in class PropertyHelper cannot be applied to given types;
      [javac] props.setProperty(name, value, verbose); // ANT 1.8.x
      [javac] ^
      [javac] required: String,String,Object,boolean
      [javac] found: String,String,boolean
      [javac] reason: actual and formal argument lists differ in length
      [javac] 4 errors
      [javac] 1 warning

      BUILD FAILED

      Reply
      1. akoskm Post author

        Hi gokul,
        I’m not sure about the errors you are getting (my guess would be your ant version).
        You should definitely ask the guys on #qtjambi about this error.

        Reply
    8. Arisa Onwuka

      Hello Akoskm,
      the error i got was thesame as above with the addition of the following at the end of the output:

      BUILD FAILED
      /home/omega7/Desktop/qt-jambi/build.xml:145: The following error occurred while executing this line:
      /home/omega7/Desktop/qt-jambi/antfiles/jar.xml:76: Compile failed; see the compiler error output for details.

      i believe its a java compiler issue but i dont know how to go about it. some of the errors i can see from the output includes duplicate case label, cannot find symbol…

      Reply
      1. akoskm Post author

        Hi Arisa Onwuka,
        without the full error log it’s hard to say what went wrong. Put it to pastebin and post the link also post it on #qtjambi @ freenode for faster response ;).
        Regarding the duplicate case label, there was a patch for Ubuntu builds which fixed that.
        Here you can find the branches for other Ubuntu versions too. They contain only those changes which are applied in ubuntu versions.

        Reply

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s