History: Cross Compiling OGRE on Linux
Source of version: 2 (current)
Copy to clipboard
{maketoc} !!Prerequisites This tutorial assumes you have some basic Linux skills such as compiling applications from source and have some basic familiarity with your Linux distribution. !!Introduction You'll need the following things installed before continuing: *[http://www.ogre3d.org/index.php?option=com_remository&Itemid=74&func=selectcat&cat=3|Ogre sdk], preferably built from source *[http://www.mingw.org MinGW cross compiler] *[http://www.winehq.org Wine] __Note:__ This is a howto for [http://www.codeblocks.org|Code::Blocks IDE], if you're using another IDE, refer to it's manual on setting up a new compiler. !!Installing MinGW cross compiler in Ubuntu 6.06 {IMG(src="img/wiki_up/Ogre_mingw_linux.jpg",thumb="y",rel="box",width="200",align="right",alt="thumb|screenshot")}{IMG} I'm using Ubuntu 6.06 so it was preety easy to install the MinGW cross compiler, as explained on [http://wiki.codeblocks.org/index.php?title=Code::Blocks_and_Cross_Compilers|Code::Blocks wiki] !!Installing MinGW cross compiler in other distributions I haven't tried installing MinGW cross compiler on any other distribution, so I leave this paragraph to other enthusiasts :) !!!Gentoo {MONO()}use crossdev.{MONO} !!Setting up the build environment You'll need to download [http://www.ogre3d.org/index.php?option=com_remository&Itemid=57&func=selectcat&cat=1|Ogre Code::Blocks for MS Windows SDK] and extract it. Since this file is an *.exe, use wine: {CODE(wrap="1", colors="bash")} cd DownloadLocation wine OgreSDKSetup1.2.2_CBMingW_STLP.exe{CODE} Extract it to your prefered location ( In further text refered to as: (#OGRE_CB_SDK_DIR) ) Next you'll need to download [http://www.codeblocks.org|Code::Blocks] for MS Windows, again, installing it with Wine (further text: (#CB_DIR) ) !!Setting up Code::Blocks to compile Ogre apps for MS Windows Since MingGW cross compiler is exactly the same as MinGW windows compiler, follow the [http://www.ogre3d.org/wiki/index.php/SettingUpAnApplication#Code::Blocks_.2B_MinGW_3.4.5_.2B_STLPort_5.0|Ogre Code::Blocks for MS Windows tutorial] !!Fixing STLPort compiler errors I don't know why, but when I compile Ogre on MinGW-cross-compiler, after setting (#OGRE_CB_SDK_DIR)/stlport/stlport as a first include directory, headers in that folder report they cant find includes in "../3.44/*". So I solved it the simplest way possibile: {MONO()}copy folder (#CB_DIR)/include/c++/3.4.4 to (#OGRE_CB_SDK_DIR)/stlport{MONO} if anyone has a smarter solution, please let me know. !!Final setup And that's it! All that is left (but not necesarry) is to setup Code::Blocks target to output the executable to *.exe !!Running exe applications Now that you've successfully compiled your first Ogre app for MS Windows, it would be a good idea to see if it works. Ofcourse, the best way to test it is by running it on MS Windows, but it's easier if you test it on your machine first before handing it to others. so: {CODE(wrap="1", colors="bash")} cd (#EXE_DIR) wine exe_name.exe{CODE} you should now see something like that screenshot above. __Note:__ Whilst Wine is a great piece of software, it still isn't perfect, so use Wine to see if your Ogre apps will start, but don't expect them to perform perfecly. eg. On my computer, when running my program using Wine, particles don't show properly, whilst the same exe runs perfectly on MS Windows. !!Ogre 1.2.4 and the MinGW toolkit Ogre3D development team has switched from MinGM + STLPort to MinGM with a modified ~np~libstdc++~/np~ which renders the default MinGW distribution useless. So, you have two options: *Use Ogre's custom MinGW toolkit compiled for MS Windows. You'll have to use wine to run it. It works however it's very slow. *Compile a custom version of MinGW on linux. Since this is a very dificult task, especialy for linux newbies, I've compiled one myself (x86), [http://www.cateia.com/ogre/mingw_toolbox-linux.tar.bz2|DOWNLOAD] __TODO: I've uploaded this file temporarily to my server, someone please move it to a more permanent location.__ !!Troubleshooting if you have any problems, send me an [http://www.ogre3d.org/phpBB2/profile.php?mode=viewprofile&u=9269&sid=584dc7763370baa8ecf67edd68d718a4|e-mail or PM.]