Building Qt Jambi on Windows using MinGW: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(Simplify punctuation)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
h1. Building Qt Jambi on Windows using MinGW
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}


= Building Qt Jambi on Windows using MinGW =
== General ==
== General ==


Line 7: Line 8:
== Prerequisites: ==
== Prerequisites: ==


'''Note about current releases:'''<br />Current Qt releases are compiled using MinGW version 4.4, while the current official version of MinGW from &quot;http://www.mingw.org/&amp;quot;:http://www.mingw.org/ is 4.5. Issues may arise if you try to run applications which were compiled against MinGW-4.5 with a Qt library compiled against MinGW-4.4.<br />Unless you have access to a MinGW version known to work with the official Qt binaries, you are encouraged to build your own Qt binaries from source. If you want to stick to the official Qt binaries you may try the MinGW-4.4 binaries provided by &quot;msysgit&amp;quot;:http://code.google.com/p/msysgit/ or those shipped with the Qt SDK releases.
'''Note about current releases:'''
Current Qt releases are compiled using MinGW version 4.4, while the current official version of MinGW from [http://www.mingw.org/ http://www.mingw.org/] is 4.5. Issues may arise if you try to run applications which were compiled against MinGW-4.5 with a Qt library compiled against MinGW-4.4.
Unless you have access to a MinGW version known to work with the official Qt binaries, you are encouraged to build your own Qt binaries from source. If you want to stick to the official Qt binaries you may try the MinGW-4.4 binaries provided by [http://code.google.com/p/msysgit/ msysgit] or those shipped with the Qt SDK releases.


* '''MinGW:''' You can download MinGW from &quot;http://www.mingw.org&amp;quot;:http://www.mingw.org. Follow the installation instructions there. In the rest of this howto we will assume that you have installed MinGW to ''C:''. If you chose a different installation destination configure your '''PATH''' accordingly in the section ''Adjust your CMD environment'' below.
* '''MinGW:''' You can download MinGW from [http://www.mingw.org http://www.mingw.org]. Follow the installation instructions there. In the rest of this howto we will assume that you have installed MinGW to ''C:''. If you chose a different installation destination configure your '''PATH''' accordingly in the section ''Adjust your CMD environment'' below.


* '''Git (optional):''' You need that if you want to fetch the Qtjambi sources via git. The easiest way to achieve that is by installing Msysgit which can be downloaded from &quot;http://code.google.com/p/msysgit&amp;quot;:http://code.google.com/p/msysgit/.
* '''Git (optional):''' You need that if you want to fetch the Qtjambi sources via git. The easiest way to achieve that is by installing Msysgit which can be downloaded from [http://code.google.com/p/msysgit/ http://code.google.com/p/msysgit].


* '''Qt:''' You can download Qt here: &quot;http://qt.nokia.com/&amp;quot;:http://qt.nokia.com/. The version of Qt used for this howto is Qt-4.7.1. You may have to change your '''PATH''' settings below if you chose a different version or installed it to another destination.
* '''Qt:''' You can download Qt here: [http://qt.nokia.com/ http://qt.nokia.com/]. The version of Qt used for this howto is Qt-4.7.1. You may have to change your '''PATH''' settings below if you chose a different version or installed it to another destination.


* '''Java Development kit:''' You can get it here: &quot;http://www.oracle.com/technetwork/java/javase/downloads/index.html&amp;quot;:http://www.oracle.com/technetwork/java/javase/downloads/index.html. Make sure you use the 32bit version if your Qt is 32bit.
* '''Java Development kit:''' You can get it here: [http://www.oracle.com/technetwork/java/javase/downloads/index.html http://www.oracle.com/technetwork/java/javase/downloads/index.html]. Make sure you use the 32bit version if your Qt is 32bit.


* '''Apache Ant:''' Ant is the tool used to build qtjambi. You can get it here: &quot;http://ant.apache.org/bindownload.cgi&amp;quot;:http://ant.apache.org/bindownload.cgi. The version used for this howto is ant-1.8.1.
* '''Apache Ant:''' Ant is the tool used to build qtjambi. You can get it here: [http://ant.apache.org/bindownload.cgi http://ant.apache.org/bindownload.cgi]. The version used for this howto is ant-1.8.1.


* '''Qtjambi:''' Last but not least, you of course need Qtjambi itself. You have to fetch it from &quot;http://qt.gitorious.org/qt-jambi&amp;quot;:http://qt.gitorious.org/qt-jambi. Make sure you use the latest community version, not the official version which is hopelessly outdated and not maintained anymore. You need git to fetch it: You can use &quot;msysgit&amp;quot;:http://code.google.com/p/msysgit/ for it. Alternatively you can just take a source package from our website, if currently available.
* '''Qtjambi:''' Last but not least, you of course need Qtjambi itself. You have to fetch it from [http://qt.gitorious.org/qt-jambi http://qt.gitorious.org/qt-jambi]. Make sure you use the latest community version, not the official version which is hopelessly outdated and not maintained anymore. You need git to fetch it: You can use [http://code.google.com/p/msysgit/ msysgit] for it. Alternatively you can just take a source package from our website, if currently available.


Executing git clone git://gitorious.org/qt-jambi/qtjambi-4_7.git qtjambi will fetch the current development version of qtjambi into a directory called qtjambi. Now change into that directory and start with adjusting the environment.
Executing git clone git://gitorious.org/qt-jambi/qtjambi-4_7.git qtjambi will fetch the current development version of qtjambi into a directory called qtjambi. Now change into that directory and start with adjusting the environment.
Line 25: Line 28:
== Compile own Qt with MinGW and MSYS ==
== Compile own Qt with MinGW and MSYS ==


1. Get Qt sources from git repo or their site<br />2. Open MSYS console<br />3. Go to extracted Qt source directory and run ./configure.exe with arguments you want (TODO: proper argument listing) '''Important note:''' Do not use ./configure, it fails with MSYS. You may also need to use <code><s>platform win32-g++<code><br />4. exec “make” or “mingw32-make”, which one ever is available<br />5. Go to eat something.
1. Get Qt sources from git repo or their site
<br />h2. Adjust the build properties
2. Open MSYS console
<br />In the root directory of Qtjambi there are two files named ''build.properties'' and ''buildpath.properties'' respectively. These two files represent the build configuration used by ant to build Qtjambi. In order for Qtjambi to compile on windows, we have to change a few settings in ''buildpath.properties'' since the default settings are geared towards compilation on linux. You have to comment in or delete (thereby effectively deactivating) the entries ''qtjambi.java.library.path'' and all those starting with ''qtjambi.phonon.''. It is also safe to do the same to those entries describing the location of the Qt library. Those start with ''qt.'' (eg.: qt.bindir, qt.libdir). The resulting ''buildpath.properties'' configuration file</s> stripped of all comment lines - may look like this:
3. Go to extracted Qt source directory and run ./configure.exe with arguments you want (TODO: proper argument listing) '''Important note:''' Do not use ./configure, it fails with MSYS. You may also need to use <code>-platform win32-g++<code>
4. exec "make" or "mingw32-make", which one ever is available
5. Go to eat something.


</code>timestamp.dir = build/timestamps<br />java.srcdir = src/java<br />java.outdir = build/java/out<br />jardir = jars<br />generator.outputdir = build/generator/out<br />generator.xmlmerge.srcdir = generator/typesystem/xml<br />generator.xmlmerge.outputdir = build/generator<br />juic.outputdir = build/juic/out<code>
== Adjust the build properties ==
In the root directory of Qtjambi there are two files named ''build.properties'' and ''buildpath.properties'' respectively. These two files represent the build configuration used by ant to build Qtjambi. In order for Qtjambi to compile on windows, we have to change a few settings in ''buildpath.properties'' since the default settings are geared towards compilation on linux. You have to comment in or delete (thereby effectively deactivating) the entries ''qtjambi.java.library.path'' and all those starting with ''qtjambi.phonon.''. It is also safe to do the same to those entries describing the location of the Qt library. Those start with ''qt.'' (eg.: qt.bindir, qt.libdir). The resulting ''buildpath.properties'' configuration file- stripped of all comment lines - may look like this:
 
</code>timestamp.dir = build/timestamps
java.srcdir = src/java
java.outdir = build/java/out
jardir = jars
generator.outputdir = build/generator/out
generator.xmlmerge.srcdir = generator/typesystem/xml
generator.xmlmerge.outputdir = build/generator
juic.outputdir = build/juic/out<code>


== Adjust your CMD environment: ==
== Adjust your CMD environment: ==
Line 39: Line 54:
The commands to set up the environment may (depending on your installation paths) look like this:
The commands to set up the environment may (depending on your installation paths) look like this:


</code>set &quot;JAVA_HOME=C:Files (x86)1.6.0_23&amp;quot;<br />set &quot;MINGW=C:&quot;<br />set &quot;ANT=C:Files\ant&amp;quot;<br />set &quot;QTDIR=C:.7.1&amp;quot;<br />set &quot;PATH=JAVA_HOME;ANT;QTDIR;MINGW;PATH&quot;<code>
</code>set "JAVA_HOME=C:Files (x86)1.6.0_23"
set "MINGW=C:"
set "ANT=C:Files\ant"
set "QTDIR=C:.7.1"
set "PATH=JAVA_HOME;ANT;QTDIR;MINGW;PATH"<code>


== Clean Qtjambi from (possibly) existing build files ==
== Clean Qtjambi from (possibly) existing build files ==
Line 49: Line 68:
== Compile Qtjambi ==
== Compile Qtjambi ==


Now start the compilation of qtjambi with the following command:<br /><code>ant all<code>
Now start the compilation of qtjambi with the following command:
<code>ant all<code>


Alternatively you can use the following batch script that takes care of all this (except cleaning the build directory):
Alternatively you can use the following batch script that takes care of all this (except cleaning the build directory):


Save the script content below to a file called ''compile-qtjambi-win32.bat'':<br /></code><br />&amp;#64;echo off
Save the script content below to a file called ''compile-qtjambi-win32.bat'':
</code>
@echo off


setlocal EnableDelayedExpansion
setlocal EnableDelayedExpansion


REM Setting environment variables<br />set &quot;LC_ALL=C&amp;quot;<br />if not defined JAVA_HOME (set &quot;JAVA_HOME=C:Files (x86)1.6.0_23&amp;quot;)<br />if not defined MINGW (set &quot;MINGW=C:&quot;)<br />if not defined ANT (set &quot;ANT=C:Files\ant&amp;quot;)<br />if not defined QTDIR (set &quot;QTDIR=C:.7.1&amp;quot;)<br />set &quot;PATH=JAVA_HOME;ANT;QTDIR;MINGW;PATH&quot;
REM Setting environment variables
set "LC_ALL=C"
if not defined JAVA_HOME (set "JAVA_HOME=C:Files (x86)1.6.0_23")
if not defined MINGW (set "MINGW=C:")
if not defined ANT (set "ANT=C:Files\ant")
if not defined QTDIR (set "QTDIR=C:.7.1")
set "PATH=JAVA_HOME;ANT;QTDIR;MINGW;PATH"


REM Starting the compilation process<br />echo &quot;COMPILING QTJAMBI&amp;quot;<br />ant %1
REM Starting the compilation process
echo "COMPILING QTJAMBI"
ant %1


endlocal<br /><code>
endlocal
<code>


This way you only have to call ''compile-qtjambi-win32.bat'' &lt;argument&amp;gt; where &lt;target&amp;gt; can be any of the ant targets defined for this project. The script can basically be regarded an alias for ant with some environment variables set. You use it as you would use ant. For example, in order to compile Qtjambi you would execute: </code>compile-win32.bat all</code>
This way you only have to call ''compile-qtjambi-win32.bat'' <argument> where <target> can be any of the ant targets defined for this project. The script can basically be regarded an alias for ant with some environment variables set. You use it as you would use ant. For example, in order to compile Qtjambi you would execute: </code>compile-win32.bat all</code>


To see a list of supported targets use: <code>compile-win32.bat -projecthelp<code><br />Note however that the script must be placed into the root directory of Qtjambi and also be executed from within that very directory.
To see a list of supported targets use: <code>compile-win32.bat -projecthelp<code>
Note however that the script must be placed into the root directory of Qtjambi and also be executed from within that very directory.


If the compilation is successfull you will see a line similar to this:<br /></code>BUILD SUCCESSFUL<br />Total time: 61 minutes 8 seconds<code>
If the compilation is successfull you will see a line similar to this:
</code>BUILD SUCCESSFUL
Total time: 61 minutes 8 seconds<code>


== Launching Qtjambi demo ==
== Launching Qtjambi demo ==


In order to launch Qtjambi you have to set the '''CLASSPATH''' and run qtjambi like this from the Qtjambis root directory:<br /></code>java <s>cp build\qtjambi-win32-mingw-4.7.1.jar;^<br />qtjambi-4.7.1.jar;^<br />qtjambi-examples-4.7.1.jar com.trolltech.launcher.Launcher<code>
In order to launch Qtjambi you have to set the '''CLASSPATH''' and run qtjambi like this from the Qtjambis root directory:
<br />Note that the symbol ^ in batch scripts or in the command console on windows is used to break up long commands into several lines. You could have just as well put the entire command into a single line. We broke it up here to make it more readable.
</code>java -cp build\qtjambi-win32-mingw-4.7.1.jar;^
<br />h2. Troubleshooting
qtjambi-4.7.1.jar;^
<br />h3. Can't compile Qt Jambi
qtjambi-examples-4.7.1.jar com.trolltech.launcher.Launcher<code>
<br />If your Qt libraries are not compiled against MinGW 4.5 you won't be able to build Qt Jambi using that version of MinGW. The standard Qt-4.7.x binaries provided by Nokia are compiled against MinGW 4.4 so you need to use that version of MinGW to compile Qtjambi. If you want to stick to your bleeding edge version of MinGW you have to compile Qt yourself using MinGW 4.5.
 
<br />h3. Can't load Qt Jambi examples
Note that the symbol ^ in batch scripts or in the command console on windows is used to break up long commands into several lines. You could have just as well put the entire command into a single line. We broke it up here to make it more readable.
<br />It might happen that loading the demo app shipped with Qt Jambi fails with the following error:<br /></code>Loading library: 'QtCore4.dll'…<br /></s> using deployment spec
 
== Troubleshooting ==
=== Can't compile Qt Jambi ===
If your Qt libraries are not compiled against MinGW 4.5 you won't be able to build Qt Jambi using that version of MinGW. The standard Qt-4.7.x binaries provided by Nokia are compiled against MinGW 4.4 so you need to use that version of MinGW to compile Qtjambi. If you want to stick to your bleeding edge version of MinGW you have to compile Qt yourself using MinGW 4.5.
 
=== Can't load Qt Jambi examples ===
It might happen that loading the demo app shipped with Qt Jambi fails with the following error:
</code>Loading library: 'QtCore4.dll'…
- using deployment spec


at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(Unknown Source)<br /> at com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(Unknown Source)<br /> at com.trolltech.qt.Utilities.loadQtLibrary(Unknown Source)<br /> at com.trolltech.qt.Utilities.loadQtLibrary(Unknown Source)<br /> at com.trolltech.qt.QtJambi_LibraryInitializer.&lt;clinit&amp;gt;(Unknown Source)<br /> … 1 more<br />Caused by: java.lang.UnsatisfiedLinkError: C:_x86_4.7.1_mingw-[stamp]4.dll:<br />Can't find dependent libraries<br /> at java.lang.ClassLoader$NativeLibrary.load(Native Method)<br /> at java.lang.ClassLoader.loadLibrary0(Unknown Source)<br /> at java.lang.ClassLoader.loadLibrary(Unknown Source)<br /> at java.lang.Runtime.load0(Unknown Source)<br /> at java.lang.Runtime.load(Unknown Source)<br /> at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary_helper(Unknown Source)<br /> … 6 more<br />Could not find the main class: com.trolltech.launcher.Launcher. Program will exit.<code>
at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(Unknown Source)
at com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(Unknown Source)
at com.trolltech.qt.Utilities.loadQtLibrary(Unknown Source)
at com.trolltech.qt.Utilities.loadQtLibrary(Unknown Source)
at com.trolltech.qt.QtJambi_LibraryInitializer.<clinit>(Unknown Source)
… 1 more
Caused by: java.lang.UnsatisfiedLinkError: C:_x86_4.7.1_mingw-[stamp]4.dll:
Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.Runtime.load(Unknown Source)
at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary_helper(Unknown Source)
… 6 more
Could not find the main class: com.trolltech.launcher.Launcher. Program will exit.<code>


This means it fails to load two vital dlls from one of the jar files listed above. This is a known bug which has already been fixed in the git repository. If you use an older version you have to workaround it by adding the location of those libs to '''PATH'''. Qt and mingw both ship those files. If you want to use the ones shipped with Qt you would have to adjust your path like so assuming Qt was installed to ''C:.7.1'':<br /></code>set PATH=C:.7.1\bin;PATH</code><br />Now launching the qtjambi demo should work as expected.
This means it fails to load two vital dlls from one of the jar files listed above. This is a known bug which has already been fixed in the git repository. If you use an older version you have to workaround it by adding the location of those libs to '''PATH'''. Qt and mingw both ship those files. If you want to use the ones shipped with Qt you would have to adjust your path like so assuming Qt was installed to ''C:.7.1'':
</code>set PATH=C:.7.1\bin;PATH</code>
Now launching the qtjambi demo should work as expected.

Latest revision as of 13:20, 23 August 2015

This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

Building Qt Jambi on Windows using MinGW

General

The following howto describes the steps neccessary to compile Qt Jambi on Windows using the MinGW development environment. It was tested on a 32bit Windows 7 installation. If you encounter any problems following it you are encouraged to seek help in the #qtjambi channel on freenode.

Prerequisites:

Note about current releases: Current Qt releases are compiled using MinGW version 4.4, while the current official version of MinGW from http://www.mingw.org/ is 4.5. Issues may arise if you try to run applications which were compiled against MinGW-4.5 with a Qt library compiled against MinGW-4.4. Unless you have access to a MinGW version known to work with the official Qt binaries, you are encouraged to build your own Qt binaries from source. If you want to stick to the official Qt binaries you may try the MinGW-4.4 binaries provided by msysgit or those shipped with the Qt SDK releases.

  • MinGW: You can download MinGW from http://www.mingw.org. Follow the installation instructions there. In the rest of this howto we will assume that you have installed MinGW to C:. If you chose a different installation destination configure your PATH accordingly in the section Adjust your CMD environment below.
  • Git (optional): You need that if you want to fetch the Qtjambi sources via git. The easiest way to achieve that is by installing Msysgit which can be downloaded from http://code.google.com/p/msysgit.
  • Qt: You can download Qt here: http://qt.nokia.com/. The version of Qt used for this howto is Qt-4.7.1. You may have to change your PATH settings below if you chose a different version or installed it to another destination.
  • Qtjambi: Last but not least, you of course need Qtjambi itself. You have to fetch it from http://qt.gitorious.org/qt-jambi. Make sure you use the latest community version, not the official version which is hopelessly outdated and not maintained anymore. You need git to fetch it: You can use msysgit for it. Alternatively you can just take a source package from our website, if currently available.

Executing git clone git://gitorious.org/qt-jambi/qtjambi-4_7.git qtjambi will fetch the current development version of qtjambi into a directory called qtjambi. Now change into that directory and start with adjusting the environment.

Compile own Qt with MinGW and MSYS

1. Get Qt sources from git repo or their site 2. Open MSYS console

3. Go to extracted Qt source directory and run ./configure.exe with arguments you want (TODO: proper argument listing) Important note: Do not use ./configure, it fails with MSYS. You may also need to use

-platform win32-g++<code>
4. exec "make" or "mingw32-make", which one ever is available
5. Go to eat something.

== Adjust the build properties ==
In the root directory of Qtjambi there are two files named ''build.properties'' and ''buildpath.properties'' respectively. These two files represent the build configuration used by ant to build Qtjambi. In order for Qtjambi to compile on windows, we have to change a few settings in ''buildpath.properties'' since the default settings are geared towards compilation on linux. You have to comment in or delete (thereby effectively deactivating) the entries ''qtjambi.java.library.path'' and all those starting with ''qtjambi.phonon.''. It is also safe to do the same to those entries describing the location of the Qt library. Those start with ''qt.'' (eg.: qt.bindir, qt.libdir). The resulting ''buildpath.properties'' configuration file- stripped of all comment lines - may look like this:

timestamp.dir = build/timestamps

java.srcdir = src/java java.outdir = build/java/out jardir = jars generator.outputdir = build/generator/out generator.xmlmerge.srcdir = generator/typesystem/xml generator.xmlmerge.outputdir = build/generator

juic.outputdir = build/juic/out

== Adjust your CMD environment: ==

You have to at least set the '''QTDIR''' and '''JDK_HOME''' variables to point to your Qt and JDK installation respectively. The compiler suit shipped with MinGW must be in '''PATH''' so ant can find and run it. Also make sure the ant binary is in '''PATH''' or else you have to use the full path to the ant binaries in order to execute the ant command.

Below we assume that Qt is installed to ''C:.7.1'', The Java JDK can be found in ''C:Files\Java\jdk1.6.0_23'' and ant has been installed to _C:Files\ant while mingw can be found in ''C:'' (That's the default installation path if you installed Mingw using msysgit: http://code.google.com/p/msysgit/).

The commands to set up the environment may (depending on your installation paths) look like this:

set "JAVA_HOME=C:Files (x86)1.6.0_23"

set "MINGW=C:" set "ANT=C:Files\ant" set "QTDIR=C:.7.1"

set "PATH=JAVA_HOME;ANT;QTDIR;MINGW;PATH"

== Clean Qtjambi from (possibly) existing build files ==

It is best to clean the root directory of qtjambi from old build-files by calling ''ant clean'' or ''ant distclean'' to have a fresh start:

ant clean

Compile Qtjambi

Now start the compilation of qtjambi with the following command:

ant all<code>

Alternatively you can use the following batch script that takes care of all this (except cleaning the build directory):

Save the script content below to a file called ''compile-qtjambi-win32.bat'':

@echo off

setlocal EnableDelayedExpansion

REM Setting environment variables set "LC_ALL=C" if not defined JAVA_HOME (set "JAVA_HOME=C:Files (x86)1.6.0_23") if not defined MINGW (set "MINGW=C:") if not defined ANT (set "ANT=C:Files\ant") if not defined QTDIR (set "QTDIR=C:.7.1") set "PATH=JAVA_HOME;ANT;QTDIR;MINGW;PATH"

REM Starting the compilation process echo "COMPILING QTJAMBI" ant %1

endlocal

This way you only have to call ''compile-qtjambi-win32.bat'' <argument> where <target> can be any of the ant targets defined for this project. The script can basically be regarded an alias for ant with some environment variables set. You use it as you would use ant. For example, in order to compile Qtjambi you would execute:

compile-win32.bat all To see a list of supported targets use:

compile-win32.bat -projecthelp<code>
Note however that the script must be placed into the root directory of Qtjambi and also be executed from within that very directory.

If the compilation is successfull you will see a line similar to this:

BUILD SUCCESSFUL Total time: 61 minutes 8 seconds

== Launching Qtjambi demo ==

In order to launch Qtjambi you have to set the '''CLASSPATH''' and run qtjambi like this from the Qtjambis root directory:

java -cp build\qtjambi-win32-mingw-4.7.1.jar;^

qtjambi-4.7.1.jar;^

qtjambi-examples-4.7.1.jar com.trolltech.launcher.Launcher

Note that the symbol ^ in batch scripts or in the command console on windows is used to break up long commands into several lines. You could have just as well put the entire command into a single line. We broke it up here to make it more readable.

== Troubleshooting ==
=== Can't compile Qt Jambi ===
If your Qt libraries are not compiled against MinGW 4.5 you won't be able to build Qt Jambi using that version of MinGW. The standard Qt-4.7.x binaries provided by Nokia are compiled against MinGW 4.4 so you need to use that version of MinGW to compile Qtjambi. If you want to stick to your bleeding edge version of MinGW you have to compile Qt yourself using MinGW 4.5.

=== Can't load Qt Jambi examples ===
It might happen that loading the demo app shipped with Qt Jambi fails with the following error:

Loading library: 'QtCore4.dll'…

- using deployment spec

at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(Unknown Source)

at com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(Unknown Source)
at com.trolltech.qt.Utilities.loadQtLibrary(Unknown Source)
at com.trolltech.qt.Utilities.loadQtLibrary(Unknown Source)
at com.trolltech.qt.QtJambi_LibraryInitializer.<clinit>(Unknown Source)
… 1 more

Caused by: java.lang.UnsatisfiedLinkError: C:_x86_4.7.1_mingw-[stamp]4.dll: Can't find dependent libraries

at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.Runtime.load(Unknown Source)
at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary_helper(Unknown Source)
… 6 more

Could not find the main class: com.trolltech.launcher.Launcher. Program will exit.

This means it fails to load two vital dlls from one of the jar files listed above. This is a known bug which has already been fixed in the git repository. If you use an older version you have to workaround it by adding the location of those libs to '''PATH'''. Qt and mingw both ship those files. If you want to use the ones shipped with Qt you would have to adjust your path like so assuming Qt was installed to ''C:.7.1'':

set PATH=C:.7.1\bin;PATH

Now launching the qtjambi demo should work as expected.