Build OGRE dependencies using MSYS         Building the dependencies using MSYS and MinGW

Original version by Trevor Dearham (WhiteKnight)

MinGW And MSYS

Packages Used For MinGW

autoconf-2.59
automake-1.9.6
binutils-2.16.91
gcc-core-3.4.4
gcc-g++-3.4.4
gcc-g77-3.4.4
gettext-0.14.1
libiconv-1.9.2
libtool-1.5.20
mingw-runtime-3.9
mingw-utils-0.3
w32api-3.5

Packages Used For MSYS

bison-2.0
flex-2.5.4a
perl-5.6.1
MSYS-1.0.11
pkg-config-0.20

Where To Get Packages From

mingw-runtime-3.9 and w32api-3.5 where obtained from MinGW. pkg-config-0.20 can be obtained from GTK+ for Windows. The rest where from the package mingw-install-20050907.tar.gz obtained from MinGW-install.

-- Link for acquiring pkg-config seems obsolete, fresher link at 2009/10/15 is http://www.gtk.org/download-windows.html

Installing Packages

  1. Uncompress mingw-install-20050907.tar.gz
  2. Move mingw-runtime-3.9.tar.gz and w32api-3.5.tar.gz into the mingw-install-20050907/mingw directory
  3. Delete ming-runtime-3.8.tar.gz, w32api-3.3.tar.gz and zlib-1.2.3-20050723-1.tar.gz, which are in the mingw-install-20050907/mingw directory
  4. Run mingw-install-20050907/setup/MSYS-1.0.11-2004.04.30-1.exe
  5. Yes to the continue with post install question.
  6. No to the do you have MinGW installed question.
  7. Run MSYS
  8. Using MSYS run mingw-install-20050907/msys/install.sh
  9. Using MSYS run mingw-install-20050907/mingw/install.sh
  10. Uncompress pkg-config-0.20.zip into "your MSYS directory"/1.0 e.g. msys/1.0
  11. Copy /share/aclocal/pkg.m4 to /mingw/share/aclocal/
  12. Then similar to Step 4 of this link:

1. Create a file /bin/pkg-config.sh, with the contents

#!/bin/sh
 if pkg-config "$@" > /dev/null 2>&1 ; then
   res=true
 else
   res=false
 fi
 pkg-config "$@" | tr -d \\r && $res

2. Make a copy of /etc/profile, in case something goes wrong, and then open /etc/profile and change line 43 from:
export HOME LOGNAME MSYSTEM HISTFILE
to:
PKG_CONFIG=/bin/pkg-config.sh
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export HOME LOGNAME MSYSTEM HISTFILE PKG_CONFIG PKG_CONFIG_PATH

3. Quit msys and then rerun it, so that the environment variables get set.

OGRE Dependencies

Packages Used

For OGRE

cegui_mk2-0.4.1

DevIL-1.6.7

freetype-2.1.10

ode-0.5

zlib-1.2.3

zziplib-0.13.44

Cg 1.4

Additional Packages For DevIL

jpeg 6b

lcms-1.14

libmng-1.0.9

libpng-1.2.8

tiff-3.7.4

Additional Package For cegui

xerces 2.7.0

Building Packages

The steps in this section assume that you have uncompressed the relevant package and that you have changed to that directory in MSYS. Also most of these packages, by default, will install to the /usr/local directory to change this use add --prefix={some directory} e.g.
--prefix=/mingw
to the configure script. Also note that MinGW, by default, will only read includes that are in the /mingw/include directory and libraries that are in the /mingw/lib directory. I will show you how to install to the /usr/local directory, as then this directory will then contain all the dependencies and as a result you will need to manually copy to the includes and libs to the /mingw directory or use the -I compiler option to specify the include file directory and the -L linker option to specify the link library directory.

The steps in this section also assume that you follow the installation of the packages in the order they are listed below.

Also, it is advisable to only keep the library files you wish to use, so if a particular package creates more that on library file, then delete the ones you don't want, e.g. zlib creates a static library (-+libz.a+-) and a dynamic link library (-+libzdll.a+- for linking at link time and zlib1.dll for runtime), so pick which one you want to keep and delete the other.

DevIL

zlib 1.2.3

  1. Open win32/Makefile.gcc and change line 34 from:

CFLAGS = $(LOC) -O3 -Wall
to:
CFLAGS = $(LOC) -mms-bitfields -O3 -Wall

  1. Run:

mkdir /usr/local
 mkdir /usr/local/include
 mkdir /usr/local/lib
 make -f win32/Makefile.gcc
 INCLUDE_PATH=/usr/local/include LIBRARY_PATH=/usr/local/lib make -f win32/Makefile.gcc install

jpeg 6b



Run:

./configure CFLAGS=-mms-bitfields
 make
 make install-lib

tiff 3.7.4


1. Open jmorecfg.h from your /usr/local/include directory.
1. Change line 161 from
typedef long INT32
to
typedef int INT32
to make it comply with the MS Windows header files.
2. Change line 226 from

#ifndef HAVE_BOOLEAN
 typedef int boolean;
 #endif
to
//#ifndef HAVE_BOOLEAN
 typedef int boolean;
 //#endif
2. Run
./autogen.sh
 ./configure CFLAGS=-mms-bitfields CXXFLAGS=-mms-bitfields
 make
 make install

Note: Read DevIL's note before building this library.

libpng 1.2.8

  1. Get libpng-1.2.8-mingwPORT.tar.bz2 from MinGW.
  2. Uncompress it to the same directory as libpng.
  3. Run:

patch -p1 < mingwPORT/mingwPORT.patch
 make -f scripts/makefile.mingw CFLAGS=-mms-bitfields
 make -f scripts/makefile.mingw prefix=/usr/local install

lcms 1.14


1. Open include/lcms.h and change line 149 from
typedef unsigned int DWORD, *LPDWORD;
to:
typedef unsigned long DWORD, *LPDWORD;
to make it comply with the MS Windows header files.
2. Open msys\1.0\mingw\include\sys\stat.h and then add the following to line 194

#define S_IXOTH 0000001
 #define S_IXGRP 0000010
 #define S_IXUSR 0000100
3. Run
./configure CFLAGS=-mms-bitfields
 make
 make install

libmng 1.0.9

1. Open /usr/local/include/icc34.h and change line 236 from
typedef u_int8_t   icUInt8Number;
 typedef u_int16_t  icUInt16Number;
 typedef u_int32_t  icUInt32Number;
 typedef u_int32_t  icUInt64Number[2];
to
typedef unsigned char  icUInt8Number;
 typedef unsigned short icUInt16Number;
 typedef unsigned int   icUInt32Number;
 typedef unsigned int   icUInt64Number[2];
2. Open makefiles/makefile.mingw
1. Change line 20 from
OPTIONS = -DMNG_NO_CMS -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS
to
OPTIONS = -DMNG_FULL_CMS -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS
2. Change line 33 from
#LCMSLIB=-llcms
to
LCMSLIB=-llcms
3. Change line 55 from
CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN)
to
CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN) -mms-bitfields
3. Run
make -f makefiles/makefile.mingw
 make -f makefiles/makefile.mingw install

Note: This make install will install to /mingw.

DevIL 1.6.7

  1. Copy /usr/local/include/lcms.h to /usr/local/include/lcms/lcms.h
  2. Change /usr/local/include/jmorecfg.h line 161 from:
    typedef long INT32;
    to:
    typedef int INT32;
    to make it comply with the MS Windows header files.
  3. Run

 ./autogen.sh
 ./configure CFLAGS=-mms-bitfields
 make
 make install

Note: I could only get TIF to be a supported format was by linking tiff's dll files, as tiff's static library files have unresovled externals for zlib and jpeg.

cegui

xerces 2.7.0

  1. Download the mingw-msys patch from here.
  2. Put the patch in your xerces directory e.g. ~/xerces-c-src_2_7_0.
  3. Go to that directory and run:
    patch -p1 < xerces-c-src_2_6_0.patch
  4. Run export XERCESCROOT={fill in your path to the base of xerces} e.g.
    export XERCESCROOT=/home/Trevor/xerces-c-src_2_7_0
    Note: Don't use ~, as it will not resolve to being your home directory.
  5. Then go to src/xercesc and run:

 ./runConfigure -p mingw-msys -c gcc -x g++ -z -mms-bitfields
 make
 make install

freetype 2.1.10



Run:

 ./autogen.sh
 ./configure CFLAGS=-mms-bitfields
 make
 make install

cegui 0.4.1



I could only get this to build with the help of Code::Blocks, which uses MinGW. I couldn't get MinGW to import and export correctly with MSYS, but it did compile it and therefore it should be possible to build cegui with MSYS.

  1. Download the patch for cegui here and put it in your cegui source directory.
  2. Using MSYS run the following from your cegui source directory:
    patch -p1 < cegui.patch
  3. Download the latest Code::Blocks project files (CB_mingw_files.zip) from here.
  4. Extract the Code::Blocks project files to the cegui directory.
  5. Create a dependencies directory inside your cegui source directory and inside that directory create an include and a lib directory.
  6. Copy the contents freetype's include directory and xerces's src into dependencies/include and freetype's objs\.libs\libfreetype.a and xerces's xerces-c-src_2_7_0\lib\libxerces-c.dll into dependencies/lib.
  7. Open makefiles\win32\CB_Mingw\CEGUI.workspace with Code::Blocks.
  8. Go to Build options of CEGUIBase.
    1. Open the Linker tab and change freetype.dll to freetype and add xerces-c for both build targets.
    2. Open the Compiler tab and then the #defines tab inside and add the follow define, so that xerces will be used instead of tinyxml:
      CEGUI_WITH_XERCES
  9. Right click on DirectX9GUIRenderer and select Activate Project and then hold down the crtl and shift keys and then press the down arrow until DirectX9GUIRenderer is below FalagardBase. Use the sample technique to move OpenGLGUIRenderer below FalagardBase. This should allow you to only build CEGUIBase, TaharezLook, WindowsLook and FalagardBase, as this is all you should need.
  10. Build the workspace.




Note:

  1. If you get a link error when building CEGUIBase which contains the following text: undefined reference to inflate, inflateEnd, inflateReset and inflateInit2_, then add open the Build options for CEGUIBase and then the Linker tab and add zdll and then copy libzdll.a to dependencies/lib.
  2. You don't need to build CEGUISampleHelper, the samples and the DirectX and OpenGL renderers, and therefore it goes out of the scope of this wiki and therefore above I haven't mention the changes necessary to build them.



OGRE Dependencies Not Already Built

zziplib 0.13.44

I could only get this to build with the help of Code::Blocks, which uses MinGW.

1. Import msvc7/zziplib.sln into Code
:Blocks.
2. Go to the Build options and select the Directories tab and then the Compiler tab inside it and then do the following for all build targets.
1. Add the directory where you have put the include files for zlib.
2. Add
..\zzip
to the directories list.
3. Open the Directories tab's Linker tab and then add zlib's library file for all buld targets.
4. Open the Compiler tab's Other options tab and add the following for all build targets
-mms-bitfields
5. Open zzip\_config.h and change line 9 from



 #ifndef ZZIP_HAVE_BYTESWAP_H 
 #define ZZIP_HAVE_BYTESWAP_H  1 
 #endif
to



 //#ifndef ZZIP_HAVE_BYTESWAP_H 
 //#define ZZIP_HAVE_BYTESWAP_H  1 
 //#endif
6. Build the workspace.



ode 0.5

  1. Open config/user-settings.
    1. Change line 14 from:
      PLATFORM=unix-gcc
      to:
      PLATFORM=mingw
      .
    2. Change line 44 from:
      #OPCODE_DIRECTORY=OPCODE
      to:
      OPCODE_DIRECTORY=OPCODE
  2. Run:

 make configure
 make ode-lib

Cg 1.4


  1. Using MinGW, go to Cg's lib directory.
  2. Run:
    reimp -c cg.lib


This should create two files, namely cg.def and libcg.a.