Build Yzis on Windows with mingw32

From Yzis Wiki

Revision as of 02:30, 15 January 2009 by Orzel (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

This page gathers information on building/compiling Yzis on windows using mingw32. There is another way to compile yzis on windows, using microsoft visual c++, and this one is documented on this other page.

Contents

Installing tools on Windows

On windows, you will need to download and install a few packages.

Mingw

You need mingw to compile Yzis on windows. Qt proposes to download it and install at along with the Qt installation.

Qt

See http://www.trolltech.com/developer/downloads/qt/windows

The installer will ask you if you have mingw installed and whether it should download it. If you don't have mingw, just say yes and the Qt installer will take care of everything.

After the installation, you need to compile the Qt library in debug mode. Open: Start -> All Programs -> Qt by Trolltech (Open Source Edition) -> Qt 4.* (Build debug libraries)

You will also need to compile QtTest, which is not compiled by default. Open: Start -> All Programs -> Qt by Trolltech (Open Source Edition) -> Qt 4.* Command line

And then, in the DOS window, type:

 cd tools
 cd qtestlib
 qmake
 make


Lua

You can get lua binaries from: http://luabinaries.luaforge.net

The one to download is: lua5_1_2_Win32_dll_lib.zip Windows x86 DLL and Includes (Visual C++ 6 Compatible)

Unzip it in a directory, wherever you want.

CMake

Download the latest windows version from http://cmake.org/HTML/Download.html

GnuWin32

Yzis uses several GnuWin32 packages. To be able to compile with those, you need to download the developer packages. It is practical to download also the runtime dependencies at the same time.

My installation is to have all these packages extracted in d:\program\gnuwin32 and to do:

 set PATH=d:\program\gnuwin32\bin;%PATH%
 set GNUWIN32_DIR=d:\program\gnuwin32

The new path will pick up both GnuWin32 libraries and executables. The environement variable is used by yzis\cmake\modules\FindGNUWIN32.cmake to locate the installation of GnuWin32.

The packages that you need to download:

  • libmagic, part of the file utility. Take both the dep and developer package.
  • libintl, internationalisation with Gettext. Take both the dep and developer package.

Compiling

Before compiling, you might want to check your environment variables. Most importantly, you may want to add the following variables:

  • QTDIR (open a "Qt XX command prompt" to see the actual value)
  • GNUWIN32 (see the previous part about installing gnuwin32)
  • PATH : add the path for qt bin and gnuwin32

To configure env variables under windows XP, you need to go to the "start menu" to select the "control panel", then use the "system" icon, click on the "Advanced" tab, there's a "environment variables" button hidden at the bottom of the window.

Remember that you must use the make and gcc of the mingw installation (not of a cygwin installation).

When using cmake, you need to specify the generator as mingw, else CMake will try to generate projects for Visual C++:

 cmake -G "MinGW Makefiles" ..

You will probably need to specify the lua libraries explicitely. An exemple would be only one line) :

 cmake -G "MinGW Makefiles"
 -DLIBLUA51_LIBRARIES="D:/program/luabin/lua51/lua.5.1.lib"
 -DLIBLUA51_INCLUDE_DIR="D:/program/luabin/lua51/include"
 -DENABLE_NYZIS=off -DENABLE_QYZIS=on -DCMAKE_VERBOSE_MAKEFILE=off
 -DCMAKE_BUILD_TYPE=Debug ..

It seems you can't do that from within an MSYS terminal. But it works fine from a normal Windows console or, even better, a Qt console. I keep my line in build/doorzel.bat and do 'doorzel' in build to configure.

to compile, i need to run

 mingw23-make

although this may depend on your actual installation.

Running the tests

The unittest executable does not depend on libyzis. So, you can run it standalone.

The script tests need an yzis frontend and the libyzis library to work. The proper way to run them is the tests/scripts/run_scriptests.sh which unfortunately needs a cygwin bash shell to work. This will be fixed in the future.

You need a dos window to compile yzis. Then you need a bash shell in yzis/tests/scripts to run them.

Troubleshooting

Cygwin

You don't need cygwin for Yzis, but it is usually practical to have it.

I have never managed to compile yzis while in a cygwin shell though. Lot of the program used by Yzis are available both for windows as standalone and as part of cygwin. The version in cygwin will not work for several reasons:

  • cygwin only works with file in unix line endings. All the generated files on windows with tools other than cygwin will have dos line endings. If a shell script of makefile looks right but the tools can not execute it, it might be because of wrong line ending. Use vim or files to find out which line ending to use.
  • all the utilities of cygwin depend on cygwin1.dll . All the utilities of GnuWin32 do not depend on external dll apart from the package dependencies.

So, if you have cygwin, I recommend not to use it to compile Yzis. Use a dos window. Beware in particular that gcc, make and cmake come as their windows standalone version and not as their cygwin version. Else, you'll go into trouble.

DLL problems

One important thing to check when running into trouble on windows is which DLL you are using. Fortunately, there is Dependency Walker to make the job easy (see next section about utilities).

If you try to run any yzis frontend without having installed Yzis, it will pick up whatever library it finds. If you just recompiled yzis, chances are that this is not the one you wanted.

Windows looks for DLL and EXE with the same mechanism: the PATH variable. So, setup your path intelligently so that the right DLL are picked up.

Utilities

Dependency Walker is a very useful tool on windows to diagnose DLL problem.

See also those two pages for more windows for linux freaks information:

Personal tools