sigmoid

..oo..oo..oo..oo..oo..oo..

Browsing Posts published by stathis

Qt on windows does not compile with MySQL support out of the box. If you’re unsure how to compile Qt on Windows with Visual Studio take a look at my other post on how to create a Qt Shadow build with Visual Studio. Based on the setup explained there, you have to first download the MySQL server. I recommend using the zipped pre-compiled binary releases (such as mysql-5.x.x-win32.zip), otherwise you’ll have the burden to compile MySQL yourself too. Decompress this into a directory of your choice, e.g. D:\dev\mysql.

Now, when you configure your Qt build, add the appropriate options shown coloured below:

configure -ltcg -opensource -mp -qt-sql-mysql -I D:\dev\mysql\include -L D:\dev\mysql\lib -l libmysql

You should see the Qt configuration output mentioning MySQL support. Follow the subsequent steps outlined in my [intlink id=”54″ type=”post”]other post[/intlink] to compile Qt and if everything is setup properly, you will end up with a Qt version that supports MySQL via QSql.

Software used

(versions here are updated each time I update the toolset and libraries)

  • Microsoft Visual Studio 2010 Ultimate Edition
  • Nokia Qt [v4.7.2, v4.8.0, v4.8.1]
  • MySQL [v5.5.10, v5.5.22, v5.5.24]
0

Using the LGR encoding for writing greek in latex documents on gentoo presumably should be fairly straight forward, but it took me a bit of searching before I figured it out. I’m using app-text/texlive, but I have not had greek language support (duh!). The error I was getting looked like this:

kpathsea: Running mktextfm grmn1095
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input grmn1095
This is METAFONT, Version 2.718281 (Web2C 7.5.7)

kpathsea: Running mktexmf grmn1095

! I can’t find file `grmn1095′.
<*> …ljfour; mag:=1; nonstopmode; input grmn1095

Please type another input file name
! Emergency stop.
<*> …ljfour; mag:=1; nonstopmode; input grmn1095

Transcript written on mfput.log.
grep: grmn1095.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input grmn1095′ failed to make grmn1095.tfm.
kpathsea: Appending font creation commands to missfont.log.

LaTeX Font Warning: Font shape `LGR/ptm/m/n’ undefined
(Font) using `LGR/cmr/m/n’ instead on input line 28.

That’s not much help really if you don’t know what you’re looking for. The solution on Gentoo is quite simple; just recompile TeXLive with greek language support:

USE+=”linguas_el” emerge -Dva app-text/texlive

A useful page on the LGR encoding support and example tex files to test your installation can be found in the Greek with the LGR font encoding webpage. To test, download lgrxenc.def and lgrxenc-test.tex and run latex lgrxenc-test && dvipdf lgrxenc-test. If everything goes well, you should end up with a pdf file with the greek characters rendered properly. You can compare your file with lgrxenc-test.pdf. Check the example test file for the latex commands you need in order to write using the LGR encoding.

0

A “shadow build” is an out-of-source build, where the source code is kept in one place and the build tree in another. I use this method to compile Qt on windows with Visual Studio (as of writing this post with VS2010).


Preparation

First download the latest Qt source code package. I usually download the latest qt-everywhere-opensource-src-x.x.x from http://get.qt.nokia.com/qt/source/.

Unpack it into the directory you want the source code kept, I choose D:\dev\qt-src. Create also the destination directory where you want your build to be, I chose D:\dev\qt-build. The directories can be anything and they can be in different drives, but I recommend avoiding to use directory names with spaces, as this may cause problems.

You will also need to have Perl installed to run the configure script of Qt. If you don’t already have it, I recommend using the portable version of Strawberry Perl for Windows. You can download it here. As this is a one-off step and you won’t need to do this next time you want to build Qt, unpack it into a suitable location in your system. I chose D:\dev\perl. Notice the batch file portableshell.bat, as we will need this in a bit.

Strawberry Perl for Windows

Directory of Strawberry Perl for Windows


Configuring and Compiling Qt

Now, open the Visual Studio Command Prompt, as shown here:

Visual Studio Command Prompt

Visual Studio Command Prompt

You have to open the VS Command Prompt instead of a normal Command Prompt (cmd.exe), as this will load the Visual Studio variables into your environment, e.g. location of the Visual C++ compiler, linker etc. You also have to setup your environment with Perl support, so execute from within the VS Command Prompt the portableshell.bat. You can easily do this:

D:\dev\perl\portableshell.bat

Now that your environment is setup with both VS and Perl support, change into the directory you intend to build and run the configure script in the source directory:

cd D:\dev\qt-build
D:\dev\qt-src\configure -ltcg -opensource -mp

You may want to have other switches for your Qt, so investigate the options with configure -help, but these will work just fine if you don’t have any special needs. Briefly:

  • -ltcg enables Link-time Code Generation, which tells the linker to call the compiler and perform whole program optimization.
  • -opensource tells Qt you’re building for Open Source development, not commercial.
  • -mp enables building Qt with multiple processes, which will speed up your build. Use this if you have a computer with multiple cores or cpus.

The configure script will run for a while to compile some basic tools required and configure the Qt build for your system. Once configuration is finished you are ready to compile Qt. This may take a couple of hours and around 15-20GB of free space may be required to build everything in D:\dev\qt-build. To compile the code use either the default nmake or jom. jom has the advantage of utilizing all cpus and cores on multicore machines and therefore it will build qt much faster than nmake.

So, while still in D:\dev\qt-build, to start the compilation:

nmake -f D:\dev\qt-src\Makefile

or

jom -f D:\dev\qt-src\Makefile

Once the compilation is finished you may also want to build the documentation for Qt Assistant, which isn’t built by default, you can do this with:

nmake -f D:\dev\qt-src\Makefile docs
jom -f D:\dev\qt-src\Makefile docs

If everything goes according to plan Qt will be built in D:\dev\qt-build and may occupy some 15-17GB of hard disk space. If you don’t want to rebuild Qt, you can clean up the build from intermediate files:

nmake -f D:\dev\qt-src\Makefile clean
jom -f D:\dev\qt-src\Makefile clean

Keep in mind that you cannot delete or move the sources from D:\dev\qt-src as the shadow build files in D:\dev\qt-build reference headers in this directory and will not work when you try to compile software against it. If you really need to move your Qt build elsewhere then take a look at QtMove.


Software used

(versions here are updated each time I update the toolset and libraries)

0