Skip to main content

History: Cross-Compiling OGRE on Debian

Source of version: 3 (current)

Copy to clipboard
            %prevogre%
This does not work yet. Maybe someone can use it as a starting point.
For a guide on how to compile your application using a precompiled OGRE SDK see ((Cross Compiling OGRE on Linux|Cross Compiling in Linux)).

First, install the MinGW package:
{CODE(wrap="1", colors="bash")} apt-get install mingw32{CODE}
Now you have two options for obtaining the dependency libraries: either get pre-built ones from the homepage, or build them from source.
!!Building dependencies yourself

Useful information can be found on this page: ((Build OGRE dependencies using MSYS)).

First, get dependency library sources:
* [http://www.ijg.org/|jpeg-6b]
* lcms
* libmng
* libpng
* tiff
* [http://openil.sourceforge.net/|DevIL]
* freetype
* [http://www.cegui.org.uk/|CEGUI]
* zlib
* zziplib
* Cg

For each library, run:
{CODE(wrap="1", colors="bash")} ./configure --prefix=/usr/i586-mingw32msvc/ --host=i586-mingw32msvc
 make
 make install (as root){CODE}
Because of non-standard configure scripts this does not work for jpeg and reportedly not for zlib, so let's try FreeImage instead:
* Download and extract FreeImage
* Edit Makefile.cygwin
* Change
{CODE(wrap="1", colors="make")} CC = gcc
 CXX = g++
 AR = ar
 
 INSTALLDIR = /usr{CODE}
to
{CODE(wrap="1", colors="make")} CC = i586-mingw32msvc-gcc
 CXX = i586-mingw32msvc-g++
 AR = i586-mingw32msvc-ar
 
 INSTALLDIR = /usr/i586-mingw32msvc{CODE}
* Now run 
{CODE(wrap="1", colors="bash")} make -f Makefile.cygwin{CODE}
* This results in several errors similar to this:
{CODE(wrap="1", colors="bash")} Source/FreeImage.h:221: error: conflicting declaration ‘typedef int* PBITMAPINFO’
 /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/wingdi.h:1392:
 error: ‘PBITMAPINFO’ has a previous declaration as ‘typedef struct tagBITMAPINFO* PBITMAPINFO’
{CODE}

!!Download pre-built dependencies
* Visit [http://www.ogre3d.org/index.php?option=com_content&task=view&id=412&Itemid=132|this] page and download "Code::Blocks + MingW C++ Toolkit Precompiled Dependencies 1.4.x"
* Move everything from "Dependencies/include" to "/usr/i586-mingw32msvc/include/"
* Move everything from "Dependencies/lib/Release/" to "/usr/i586-mingw32msvc/lib"
* Rename libFreeImage.a to libfreeimage.a
* Move everything from "Samples/Common/bin/Release" to "/usr/i586-mingw32msvc/lib"
* rename cg.dll to Cg.dll

Configure fails here because FreeImage_Load cannot be found in libfreeimage.a.
!!Build OGRE
Get the OGRE sources and run
{MONO()}  ./configure --prefix=/usr/i586-mingw32msvc/ --host=i586-mingw32msvc --with-platform=Win32{MONO}