How to build Irrlicht for Windows x64 (64-bit) in 6 steps

A forum to store posts deemed exceptionally wise and useful
Post Reply
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

How to build Irrlicht for Windows x64 (64-bit) in 6 steps

Post by lug »

This is using Visual Studios 2005 on Windows XP Pro x64 Edition (AMD x2 4200+ dual core processors).

I've finally got it to build after many attempts. They've been documented unceremoniously forever in the threads below:

1st attempts:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=11562

2nd attempts:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15042

Drum roll please...and here are the 8 steps (updated to irrlicht v1.2 release):

1. Add "WIN64" to Preprocessor Definitions (and remove "WIN32") from the "C/C++"->"Preprocessor" on the project property page:

2. Two paths -- take "a" if you don't want DX8.1 support or take "b" if you want DX8.1 support but no shaders or reduced shader functionality:

a) Comment out the following line in "D:\Irrlicht\include\IrrCompileConfig.h" ("D" is where I extracted irrlicht to) which will disable Direct3D 8 support in irrlicht:

//#define _IRR_COMPILE_WITH_DIRECT3D_8_

b) Make changes to the following files:

i. source\Irrlicht_64\CD3D8Driver.h -- change "WIN32_LEAN_AND_MEAN" to "WIN64_LEAN_AND_MEAN"

ii. source\Irrlicht_64\CD3D8ShaderMaterialRenderer.cpp -- comment out the following lines:

D3DXAssembleShader(pxsh, strlen(pxsh), 0, 0, &code, &errors);
D3DXAssembleShader(vtxsh, strlen(vtxsh), 0, 0, &code, &errors);

iii. source\Irrlicht_64\CD3D8Texture.cpp -- change the following line from

#ifndef _IRR_USE_D3DXFilterTexture_

to

#ifdef _IRR_USE_D3DXFilterTexture_

which removes the "n" in "#ifndef."

3. Comment out the following line in "D:\Irrlicht\include\IUnknown.h":

//_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0) // someone is doing bad reference counting.

4. Comment out the following line in "D:\Irrlicht\include\irrArray.h" (this may cause problems during runtime):

//_IRR_DEBUG_BREAK_IF(index>=used) // access violation

5. Comment out the following line in "D:\Irrlicht\include\irrString.h" (this may cause problems during runtime):

//_IRR_DEBUG_BREAK_IF(index>=used) // bad index

6. Remove the following from the Additional options under the "Linker"->"Command Line" in the project property page:

/MACHINE:I386

result:

0 errors 109 warnings

Finally, here's an excerpt from the build log:

Code: Select all


Linking...
LINK : ..\..\bin\Win64-visualstudio\Irrlicht.dll not found or not built by the last incremental link; performing full link
Irrlicht.obj : warning LNK4224: /COMMENT is no longer supported;  ignored
   Creating library ..\..\lib\Win64-visualstudio\Irrlicht.lib and object ..\..\lib\Win64-visualstudio\Irrlicht.exp

I guess next up is to see if any of the example runs with the 64-bit lib. Then if that works, I'll go about fixing all the warnings. Then if that bolds well, I'll see if I can add back OpenGL support. And if I feel brave enough, I'll try to add back DX3D 8 support. Then I might email niko and see if he'll add the 64-bit dll to a future irrlicht release. :shock:

How to build Irrlicht .NET for Windows x64 in 4 steps (updated to irrlicht v1.2 release):

1. perform either of the following in "Linker->Input->Additional Dependencies" in your project property:

a. for x64 debug build:

i. change "msvcrt.lib" to "msvcrtd.lib" (added a "d" for debug).
ii. add "msvcmrtd.lib" ("d" version)

b. for x64 release build:

i. change "msvcrtd.lib" to "msvcrt.lib" (removed the "d").
ii. add "msvcmrt.lib" (no "d" version)

2. perform a search and replace on project for "[Paramflag::Out]" and replace with "[Out]". This should touch the following files (14 places total):

\source\Irrlicht.NET\ISceneCollisionManager.cpp (4 places)
\source\Irrlicht.NET\ISceneCollisionManager.h (4 places)
\source\Irrlicht.NET\Line3D.h (1 places)
\source\Irrlicht.NET\Plane3D.h (5 places)

3. peform either of the following:

a. for x64 debug build:

i. create a folder called "debug" in the "\source" folder.
ii. copy over the "Irrlicht.lib" debug build from "lib\Win64-visualstudio" (you should have this built already if you follow the non-.NET build steps at the top of this post) to the folder created in step ii.

b. for x64 release build:

i. add the following (this is the path to your non-.NET x64 library release build) to the "Linker->Input->Additional Dependencies" in your project property (note the "Release" folder is something I made for my builds; the folder does not exist with the official irrlicht distribution):

D:\irrlicht\lib\Win64-visualStudio\Release\Irrlicht.lib

4. build and you should have a .NET version (debug or release depending on which path you took) of Irrlicht without any errors or warnings.

Update:

Thanks to hgc (see 2 posts below this one), OpenGL and DX8.1 are now functional in Windows x64. I've updated the instruction to include DX8.1 or not and include OpenGL or not.

I would recommend downloading the latest DX SDK (currently october 2006 as of this post):

http://msdn.microsoft.com/directx/sdk/

and latest Platform SDK:

for vista:

http://www.microsoft.com/downloads/deta ... laylang=en

or

http://www.microsoft.com/downloads/deta ... laylang=en

for other windows os:

http://www.microsoft.com/downloads/deta ... laylang=en

Update 2 (Dec 01 2006):

Removed steps 3 and 6 since hgc's fix appears to have made it into the v1.2 release.

Changed the warnings from 93 to 109.

Update 3 (Dec 01 2006):

Added steps to build release/debug build of irrlicht x64 .NET. Most of the info was pulled from my post here:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=14615

I thought it would be convenient to put them in one thread. :D
Last edited by lug on Fri Dec 01, 2006 8:46 pm, edited 3 times in total.
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Yay! I've tried building the "CustomSceneNode" example that comes with irrlicht v1.1 for x64 with success! Some picks for all to see (note all pics shows win32 on the left and x64 on the right):

performance view:

Image

stack view:

Image
hgc
Posts: 7
Joined: Wed Oct 11, 2006 9:05 am
Location: Madrid, Spain

Post by hgc »

There is a very easy way to compile Irrlicht for x64 without disabling the OpenGL.

1) Download the original Irrlicht 1.1 files.

2) If you do not want to use DirectX 8.1, do not install the Microsoft DirectX 8.1 SDK and comment the following line (37) at "IrrCompileConfig.h" file:

Code: Select all

#define _IRR_COMPILE_WITH_DIRECT3D_8_
Otherwise, install the Microsoft DirectX 8.1 SDK.

3) Install the Microsoft DirectX 9.0 SDK.

4) To make the project compile at x64 with OpenGL, add the following lines to the "COpenGLDriver.h" file (at line 24):

Code: Select all

#ifdef WIN64
// include windows headers for HWND
#define WIN64_LEAN_AND_MEAN
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "GLu32.lib")
#endif
I have tested the 64 bits version under Windows XP x64 and it works, also for OpenGL!!
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Thanks, hgc! I've updated the original post with your findings. I've tried it with one of my project and it worked fine (look towards the bottom of the following link for download-ables x64 version):

http://irrlicht.sourceforge.net/phpBB2/ ... hp?p=96404
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

I've updated the OP to include how to build Irrlicht .NET for x64 platform.
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

I've just uploaded a x64 DLL and LIB pack built via the instruction above for anyone to use/compare with their own version. Please note this is an unofficial build of the official v1.2 build of irrlicht. So, use at your own risk. The official Irrlicht release currently (1.2) does not contain any .dll or .lib files for x64 windows.

The pack includes the following DLLs and LIBs:

\Win64-VisualStudio\release\Irrlicht.dll
\Win64-VisualStudio\debug\Irrlicht.dll

\Win64-visualStudio_dotnet\Release\Irrlicht.NET.dll
\Win64-visualStudio_dotnet\Debug\Irrlicht.NET.dll

\Win64-visualStudio_lib\Debug\Irrlicht.lib
\Win64-visualStudio_lib\Debug\Irrlicht.exp
\Win64-visualStudio_lib\Release\Irrlicht.lib
\Win64-visualStudio_lib\Release\Irrlicht.exp

Download from here (1,550 KB):

http://rapidshare.com/files/5649283/Irr ... k.rar.html
Post Reply