Building EDuke32 on Windows

From EDukeWiki
Jump to navigation Jump to search

Building on Windows with MinGW/GNU Make

To compile EDuke32 on Windows, you will need to install the following:

The following updates should also be installed to your MSYS directory. They can be downloaded here. You are looking for the files *.bin.tar.lzma. (.lzma and .tar files can be extracted with 7-Zip)

  • bash
  • coreutils
  • make
  • msysCORE (BaseSystem)

For these files you are looking for *.dll.tar.lzma.

  • regex
  • termcap

After everything has been installed, a shortcut should be on your desktop titled MSYS. Run the shortcut and run these commands, replacing src-dir with the folder where the EDuke32 source code resides:

mount c: /c
cd /c/src-dir
make

This will build the binaries for EDuke32 and Mapster32 to the source directory.

If you want to compile by typing make at a normal command prompt from the source folder, go to the MinGW\bin folder after the MSYS postinstall and rename mingw32-make.exe to make.exe.

Building on Windows with MinGW/GNU Make -- alternative way

This method is similar to the one above but uses only "official" MinGW packages and is a hybrid of automatic and manual installation. Choose whichever you're more comfortable with. --Helixhorned

base installation

First, install MinGW and MSYS using the automated installer from the MinGW downloads. This should be relatively straightforward and will install MSYS (the shell and utility commands) and MinGW (the compiler suite). I assume here that they're installed in C:/MSYS and C:/MinGW -- from the wording on their page, anything else is BAD.

GCC 4

Since the automatic installer gives us GCC 3.x as of time of writing, we need to install GCC 4.x alongside. If you don't mind using the older compiler, you can skip this section. Note though, that the development takes place using the newer version and thus GCC 3 builds may break without the developers noticing.

First, create a new directory, for example C:/MinGW_new. This will be the base directory for the MinGW featuring GCC 4. Afterwards, if you want to use the new version of the compiler, simply rename its directory to C:/MinGW (renaming the original to something like C:/MinGW_old before, of course). Nothing needs to be changed for MSYS, since it only provides tools that aren't specific to the compilation process itself ("meta-tools", if you want).

Now the only thing left to do is to hunt down a bunch of archive files whose contents will have to be extracted to C:/MinGW_new. For these, the base place is here. The following files are needed to compile Eduke32 and debug it using GDB. The version numbers are merely an example -- simply pick the latest stable version; the important parts are the name and the type (DLL, binary or headers/libs).

binutils-2.20.51-1-mingw32-bin
gcc-c++-4.5.0-1-mingw32-bin
gcc-core-4.5.0-1-mingw32-bin
gdb-7.1-2-mingw32-bin
libexpat-2.0.1-1-mingw32-dll-1
libgcc-4.5.0-1-mingw32-dll-1
libgmp-5.0.1-1-mingw32-dll-10
libmpc-0.8.1-1-mingw32-dll-2
libmpfr-2.4.1-1-mingw32-dll-1
libssp-4.5.0-1-mingw32-dll-0
libstdc++-4.5.0-1-mingw32-dll-6
mingwrt-3.18-mingw32-dev
mingwrt-3.18-mingw32-dll
w32api-3.14-mingw32-dev

You can now start the MSYS console and the compiler will be chosen according to which one is in C:/MinGW.

configuration

In order to finally build EDuke32, some adaptations need to be made to the files describing the build process, the Makefiles. Usually, only two files need to be edited: Makefile and build/Makefile. For each of them, the line in question sets the path where the DirectX SDK is located (for installation see article above), like this:

DXROOT=c:/sdks/directx/dx8

Simply change it to your DX SDK installation path.

compiling

Now that we've got everything together, go to the base directory containing the EDuke32 source code, type

make

and cross fingers: this will attempt to build EDuke32 and Mapster32. To compile only either the game or the editor, simply give make the name of the executable, like

make eduke32.exe

To compile a version suitable for later debugging with GDB, prepend RELEASE=0 to the command, like this:

RELEASE=0 make mapster32.exe

troubleshooting

If something doesn't go as planned, don't despair. Most issues are resolved rather quickly.

  • If you see a barrage of error messages saying that some symbols are not defined, check whether you have all necessary prerequisites like the DirectX SDK installed and that the paths in the Makefile point to the right location.
  • If you get errors at the end of the build process (technically, at link time), there's usually a problem with the libraries -- the linker can't find one or more .a files [needs explanation].
  • Finally, if the executable starts but aborts shortly thereafter, a dynamic link library may be missing. Usually you'll get a helpful message with its name: check the MinGW download page then.

debugging

The most insidious types of bugs are those that occur randomly and with no apparent pattern. To help the developers tracing down crashes happening this way, you could try running a debug version of the executable under the GNU debugger until the crash happens. To do this, start it like this (mapster32.exe being an example):

gdb --args mapster32.exe [additional arguments...]

and enter the

r

(run) command at the GDB prompt. When the program crashes, you will be taken back to the prompt. Enter

bt

(backtrace) there. This will print out the location where the crash occurred and serve as a first diagnostic to the developers.

Building on Windows with Microsoft Visual C++

note: this was what worked for me, there are probablly better ways. If you want to document them go right ahead --plugwash.

get visual c++ express edition from http://www.microsoft.com/express/download/ and install it. The paths in theese instructions assume it is installed in the default location.

unfortunately ml.exe is missing from the express edition, lukilly there is a copy in the freely downloadable windows server 2003 ddk which can be obtained from http://www.microsoft.com/whdc/devtools/ddk/default.mspx . Install this and copy ml.exe to your visual studio bin directory

windows.h, windef.h, winnt.h,basetsd.h,guiddef.h, pshpack4.h, pshpack1.h, pshpack2.h, pshpack4.h, pshpack8.h, poppack.h, winbase.h, winerror.h, wingdi.h, winuser.h, tvout.h, winnls.h, wincon.h, winver.h, winreg.h, winnetwk.h, winsvc.h, mcx.h, imm.h, shlobj.h, ole2.h, objbase.h, rpc.h, rpcdce.h, rpcdcep.h, rpcnsi.h, rpcnterr.h, rpcasync.h, rpcndr.h, rpcnsip.h, wtypes.h, unknwn.h, cguid.h, urlmon.h, oleidl.h, servprov.h, msxml.h , oaidl.h, propidl.h, oleauto.h, prsht.h, commctrl.h, shlguid.h, isguids.h, exdisp.h, ocidl.h, docobj.h, shldisp.h, specstrings.h, winsock2.h, qos.h, ws2tcpip.h, ddraw.h, dinput.h, windowsx.h, shellapi.h, winresrc.h, winuser.rh, commctrl.rh, dde.rh, winnt.rh, dlgs.h, mmsystem.h, dsound.h, d3dtypes.h, user32.lib, gdi32.lib, shell32.lib, dxguid.lib, winmm.lib, wsock32.lib, commctl32.lib, glu32.lib, uuid.lib, cderr.h, dde.h, ddeml.h, lzexpand.h, nb30.h, winperf.h, winsock.h, wincrypt.h, winscard.h, winioctl.h, winsmcard.h, commdlg.h and the whole gl include directory also seem to be missing, again theese can be obtained from the windows server 2003 ddk. With the exception of cderr.h, ddeml.h, winperf.h and lzexpand.h which I got from the wnet directory and a few files that were only found in a generic crt directory in the ddk I used the win2K versions from that ddk.

I had to modify ws2tcpip.h to add the following typedef just before the final #ENDIF

typedef int socklen_t;

This was fixed in the "winxp" version of that file included with the ddk but trying to use the winxp version resulted in a demand for another header that I could not meet with bits from the ddk.

I also had to modify windows.h to not include winpref.h which I didn't have

download http://www.vorbis.com/files/1.0.1/windows/OggVorbis-win32sdk-1.0.1.zip and extracted it (I extracted it in c:\ and work on that assumption in theese instructions)

start the visual studio 2005 command prompt

clean up some environment variables that the vs command prompt forgets to clean, add the include paths for vorbis to the include file path and add the path for the vorbis libs to the library path

PATH=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
set INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;C:\oggvorbis-win32sdk-1.0.1\include
set LIB=C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;C:\oggvorbis-win32sdk-1.0.1\lib

change to the build subdirectory of your eduke32 tree and run

nmake -f Makefile.msvc
cd ..\
nmake -f Makefile.msvc

Building on Windows with Microsoft Visual Studio 2008

To compile EDuke32 with VS08, you will need to install the following:

  • OggVorbis-win32sdk-1.0.1.zip - Ogg Vorbis libraries
  • Plus a DirectX SDK (note that you need the SDK- Source Development Kit, not the DDK- Driver Development Kit), DirectX March 2009 or a previous version, such as the DirectX 7 SDK which is confirmed to work.

Install each of these locally to somewhere where you can find them easily, such as the Program Files directory.

Using SVN

If you want to use an SVN to build the game read this section. If you already have the latest source files or don't want to use an SVN, skip to the next part.

First, you need to download a free SVN plugin for Visual Studio, such as:

Install AnkhSVN, you can find help for installing it from it's website.

  1. Launch Microsoft Visual Studio.
  2. Navigate through the menus: File → Subversion → Open from Subversion...
  3. Type in the URL of the EDuke32 SVN.
  4. Select the eduke32.vcproj file and click Open.

AnkhSVN now asks you where to save the project locally.

IMPORTANT! EDuke32 is a makefile project, as such, it needs to be located in a directory with only 8 characters (for example C:\EDuke32\ or D:\Source\EDuke32).

Choose the local directory, the Type drop-down menu should be set to Latest Version, click on OK to save the project on your hard drive. The program now downloads the latest files from the SVN.

When done, EDuke32 is shown as your current solution, now you can continue onto either fiddling with the source or just compiling it.

Includes

As already mentioned before, EDuke32 is a makefile project so you cannot include OGGVorbis in the Project → Properties menu as usual, but you will need to add the includes in the global properties:

  1. Navigate to Tools → Options.
  2. Click on Show all settings to show the settings we need to change.
  3. Open the Projets and Solutions category and choose VC++ Directories.

Now we need to link the Include directories.

General Include directories

Make sure the Platform is set to Win32 and select Include files from the Show directories for: -drop down menu.

Click on an empty row and add the local directory names for OGGVorbis and DirectX SDK. For example:

  • C:\Program Files\oggvorbis-win32sdk-1.0.1\include
  • C:\Program Files\DirectX 7 SDK\include

Notice how each directory has the include subdirectory chosen ("\include\"). If your version differs, try finding the correct directory for each or the program will not compile properly.

The new linked directories are saved automatically so don't click on OK, it will only close the Options menu.

Next up, we need to link the libaries.

Library directories

Next, Select Library files from the Show directories for: -drop down menu.

Click on an empty row and add the local directory names for OGGVorbis and DirectX SDK. For example:

  • C:\Program Files\oggvorbis-win32sdk-1.0.1\lib
  • C:\Program Files\DirectX 7 SDK\lib

Notice how each directory has the library subdirectory chosen (either lib or libs).

Now click on OK to exit the Options menu.

Compiling

Either click on the green play button, or navigate the menus to Build → Build eduke32 and VS08 starts compiling the executables.

You will probably see alot of warnings with wrong datatype conversions but these don't affect the outcome.