Difference between revisions of "Building EDuke32 on Windows"

From EDukeWiki
Jump to navigation Jump to search
(→‎Building on Windows with Microsoft Visual C++: update to work with the latest eduke32 source and with currently available downloads)
Line 66: Line 66:
 
download http://www.vorbis.com/files/1.0.1/windows/OggVorbis-win32sdk-1.0.1.zip and extract it (These instructions assume it was extracted in c:\)
 
download http://www.vorbis.com/files/1.0.1/windows/OggVorbis-win32sdk-1.0.1.zip and extract it (These instructions assume it was extracted in c:\)
  
copy lib.exe from C:\Program Files\Microsoft Visual Studio 9.0\VC\bin to C:\WinDDK\7600.16385.1\bin\x86
+
copy lib.exe from C:\Program Files\Microsoft Visual Studio 9.0\VC\bin to C:\WinDDK\7600.16385.1\bin\x86<br>
 
copy mt.exe from C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin to C:\WinDDK\7600.16385.1\bin\x86
 
copy mt.exe from C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin to C:\WinDDK\7600.16385.1\bin\x86
  
Line 76: Line 76:
 
  set Lib=C:\WinDDK\7600.16385.1\lib;C:\WINDDK\7600.16385.1\lib\wxp\i386;C:\WINDDK\7600.16385.1\lib\wlh\i386;C:\oggvorbis-win32sdk-1.0.1\lib;C:\WINDDK\7600.16385.1\lib\Crt\i386
 
  set Lib=C:\WinDDK\7600.16385.1\lib;C:\WINDDK\7600.16385.1\lib\wxp\i386;C:\WINDDK\7600.16385.1\lib\wlh\i386;C:\oggvorbis-win32sdk-1.0.1\lib;C:\WINDDK\7600.16385.1\lib\Crt\i386
 
  PATH=C:\WinDDK\7600.16385.1\tools\sdv\bin;C:\WinDDK\7600.16385.1\bin\x86\oacr;C:\WinDDK\7600.16385.1\tools\pfd\bin\bin\x86;C:\WinDDK\7600.16385.1\tools\tracing\i386;C:\WinDDK\7600.16385.1\bin\x86;C:\WinDDK\7600.16385.1\bin\x86\x86;C:\WinDDK\7600.16385.1\bin\SelfSign;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
 
  PATH=C:\WinDDK\7600.16385.1\tools\sdv\bin;C:\WinDDK\7600.16385.1\bin\x86\oacr;C:\WinDDK\7600.16385.1\tools\pfd\bin\bin\x86;C:\WinDDK\7600.16385.1\tools\tracing\i386;C:\WinDDK\7600.16385.1\bin\x86;C:\WinDDK\7600.16385.1\bin\x86\x86;C:\WinDDK\7600.16385.1\bin\SelfSign;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
 
  
 
change to the directory containg your eduke32 source tree and run
 
change to the directory containg your eduke32 source tree and run

Revision as of 02:42, 10 November 2011

Building on Windows with MinGW/GNU Make

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

Next, download NASM and extract its contents to the MinGW/bin folder, so nasm.exe is located there.

After that, download, extract, and run File:MinGW EDuke32 Setup Helper.zip. It will help ensure that everything is installed correctly.

Finally, download the above DirectX SDKs and extract them to directories, such as c:/MinGW/sdks/dx70_mgw and c:/MinGW/sdks/dx80_mgw. If you don't want to take an additional step later on of configuring these directories, copy them (7 first, then 8) over c:/MinGW/.

configuration

If you opted to keep your compiler clean in the previous paragraph, you will need to tell EDuke32 where to find the SDK. The recommended way to do this is to append the definition the make command when building, like the following examples:

make DXROOT_OVERRIDE=c:/MinGW/sdks/dx80_mgw
make RELEASE=0 DXROOT_OVERRIDE=c:/MinGW/sdks/dx80_mgw

If your directory is different, change it to yours. Keep in mind the lowercase drive letter and the forward slashes instead of backslashes.

The alternate method is to make some adaptations 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 8 SDK is located, like this:

DXROOT=c:/MinGW/sdks/dx80_mgw

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 your 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, append RELEASE=0 to the command, like this:

make RELEASE=0

To have more useful function names when doing a backtrace (see debugging below), it is also advisable to disable stack protectors, like this:

make F_STACK_PROTECTOR_ALL=-fno-stack-protector RELEASE=0

Finally, if you are building on GCC 3, append GCC_MAJOR=3.

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 command line compilers

Eduke32 can be built using freely downloadable MS tools. Unfortunately MS does not appear to offer a single package containing all the needed tools so it is nessacery to get them from serveral different places.

download and install the windows SDK from http://www.microsoft.com/download/en/confirmation.aspx?id=11310 accept the defaults in the installer.

download and install the WDK from http://www.microsoft.com/download/en/details.aspx?id=11800 select the "full development environment" option in the installer.

download and install visual c++ 2008 express from http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express

Note that the following instructions assume the above programs were installed in the default locations on a 32-bit windows system. If they are installed in other locations then paths in later instructions will need to be adjusted.

download http://www.vorbis.com/files/1.0.1/windows/OggVorbis-win32sdk-1.0.1.zip and extract it (These instructions assume it was extracted in c:\)

copy lib.exe from C:\Program Files\Microsoft Visual Studio 9.0\VC\bin to C:\WinDDK\7600.16385.1\bin\x86
copy mt.exe from C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin to C:\WinDDK\7600.16385.1\bin\x86

start the "windows XP x86 free build environment" from the WDK

set up paths etc

set Include=C:\WinDDK\7600.16385.1\inc\api;C:\WINDDK\7600.16385.1\inc\crt;C:\oggvorbis-win32sdk-1.0.1\include
set Lib=C:\WinDDK\7600.16385.1\lib;C:\WINDDK\7600.16385.1\lib\wxp\i386;C:\WINDDK\7600.16385.1\lib\wlh\i386;C:\oggvorbis-win32sdk-1.0.1\lib;C:\WINDDK\7600.16385.1\lib\Crt\i386
PATH=C:\WinDDK\7600.16385.1\tools\sdv\bin;C:\WinDDK\7600.16385.1\bin\x86\oacr;C:\WinDDK\7600.16385.1\tools\pfd\bin\bin\x86;C:\WinDDK\7600.16385.1\tools\tracing\i386;C:\WinDDK\7600.16385.1\bin\x86;C:\WinDDK\7600.16385.1\bin\x86\x86;C:\WinDDK\7600.16385.1\bin\SelfSign;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

change to the directory containg your eduke32 source tree and run

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.