Building EDuke32 on Windows: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
 
(61 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==Building on Windows with MinGW/GNU Make==
{{Distribution intro}}


*'''[http://sourceforge.net/downloads/mingw/ automated MinGW installer]
There are several options available to develop EDuke32 on Windows. Before you begin, you will need to [[Acquiring the EDuke32 Source Code|acquire the EDuke32 source code]].
*'''[http://www.nasm.us/ NASM]'''
*'''[http://alleg.sourceforge.net/files/dx70_mgw.zip DirectX 7 SDK for MinGW]'''
*'''[http://alleg.sourceforge.net/files/dx80_mgw.zip DirectX 8 SDK for MinGW]'''


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.
==[https://www.visualstudio.com/ Microsoft Visual Studio]==


Next, download NASM and extract its contents to the MinGW/bin folder, so nasm.exe is located there.
For many developers, Visual Studio will be the easiest and most familiar way to work with the source. While the EDuke32 team prefers GCC for production builds, the VS IDE is a valuable and useful resource for development.


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


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/'''.
[https://www.visualstudio.com/downloads/ Visual Studio can be downloaded from Microsoft's website.] The free version, ''Visual Studio Community'', works perfectly. If you don't want the IDE, the ''Build Tools for Visual Studio'' will install the toolchain by itself.


====configuration====
Visual Studio 2013 is the minimum supported version for building EDuke32, but the newest version is always recommended.
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
===building===
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.
====from the IDE====


The alternate method is to make some adaptations to the files describing the build process, the ''Makefile''s. 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:
Either click on the green play button, or navigate '''Build → Build eduke32''' in the menus to start the build process.
DXROOT=c:/MinGW/sdks/dx80_mgw
Simply change it to your DX SDK installation path.


====compiling====
====from the command line====
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====
You will need to set up your paths to contain the VS toolchain. Newer versions provide shortcuts in the start menu to start a terminal with the appropriate settings. Doing so manually is out of scope of this article.
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.
Navigate to ''platform/Windows'' in the EDuke32 source code and enter:
* 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====
  nmake -f msvc.mak
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++==
==MinGW-w64/GCC with MSYS2==


note: this was what worked for me, there are probablly better ways. If you want to document them go right ahead --plugwash.
For a more Unix-like style of development, [http://www.msys2.org/ MSYS2] provides a bash shell, native GCC and clang builds, and the ''pacman'' package manager originally from Arch Linux.


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.
===tips to remember===


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
*You can press the middle mouse button to paste text into the MSYS2 terminal, or right-click for more options.
*You can navigate folders using the <code>cd</code> command (short for ''change directory''), or the <code>pushd</code> command, which adds the new path you specify to a stack, allowing you to return to your previous location with <code>popd</code>.
*Paths use forward slashes (<code>/</code>) instead of backslashes (<code>\</code>) and drive letters take the form <code>/c/</code> instead of <code>C:\</code>, though it will likely understand either way if you put your path in <code>"quotes"</code>.


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.
===setup===


I had to modify ws2tcpip.h to add the following typedef just before the final #ENDIF
#First, [http://www.msys2.org/ install MSYS2], following the instructions on that page fully. Install whichever architecture matches your computer; both can cross-compile to the other.
#The installer will create three shortcuts in the Start Menu. Ignore '''MSYS2 MSYS'''. Open '''MSYS MinGW (32-bit)''' or '''(64-bit)''' to select which architecture you would like to target while building during the shell session that begins. Unfortunately, one deficiency in MinGW-w64 is that the each of the two targets (32-bit and 64-bit) require their own separate executables, instead of using one binary with the <code>-arch</code> parameter as on other platforms.
#Try updating all packages with <code>pacman -Syuu</code> to verify you've completed the instructions. If all is well, you should see <code>there is nothing to do</code>. Otherwise, accept the update and repeat until there is nothing further to update.
#Next, we will need to install some additional packages. The ''pacman'' package manager covers all of MSYS2 and is not affected by which shortcut you chose in the previous item.
#*These packages are necessary to build:
#**<code>pacman -S --needed --noconfirm mingw-w64-{i686,x86_64}-toolchain make nasm yasm</code>
#*If you would like to use Subversion and Git directly from the MSYS2 shell:
#**<code>pacman -S --needed --noconfirm subversion git</code>
#*If you would like ''clang'' as an additional compiler option:
#**<code>pacman -S --needed --noconfirm mingw-w64-{i686,x86_64}-{clang,lld}</code>
#*EDuke32 includes prebuilt Windows static libraries for all external dependencies with its source code, and therefore installing them through the package manager is superfluous. However, for reference:
#**<code>pacman -S --needed --noconfirm `pacman -Ssq sdl` `pacman -Ssq flac` `pacman -Ssq libvpx`</code>


typedef int socklen_t;
You should now be all set.


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.
===building===
Now that we've got everything together, you can try building EDuke32 and Mapster32. Navigate to the base directory containing [[Acquiring the EDuke32 Source Code|the EDuke32 source code]], type the following and ''eduke32.exe'' and ''mapster32.exe'' should be created.
make
For quick testing of changes, it is recommended to build a debug executable, which skips all compiler optimizations for a much faster compile time, and also includes information about the source code called ''debug symbols'' for debugging with GDB. Append ''RELEASE=0'' to the command, like this:
make RELEASE=0
You can enable parallelism and build multiple objects at the same time with '-j'. The flag by itself will use the total number of threads available, or you can specify a number, such as '-j2'.
make RELEASE=0 -j4
To compile only either the game or the editor, simply give ''make'' the name of the executable, like
make RELEASE=0 -j4 eduke32.exe
To build with clang, append the setting <code>CLANG=1</code> to your ''make'' invocation.
make RELEASE=0 -j4 eduke32.exe CLANG=1


I also had to modify windows.h to not include winpref.h which I didn't have
===troubleshooting===
If something doesn't go as planned, don't despair. Most issues are resolved rather quickly.


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)
* 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]''.
start the visual studio 2005 command prompt
* 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.
 
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:
 
* '''[http://www.vorbis.com/files/1.0.1/windows/OggVorbis-win32sdk-1.0.1.zip 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:
* '''[http://ankhsvn.open.collab.net/ AnkhSVN]'''
 
Install AnkhSVN, you can find help for installing it from it's website.
 
# Launch Microsoft Visual Studio.
# Navigate through the menus: '''File &rarr; Subversion &rarr; Open from Subversion...'''
# Type in the URL of the EDuke32 SVN.
# 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 [http://en.wikipedia.org/wiki/8.3_filename 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 &rarr; Properties''' menu as usual, but you will need to add the includes in the global properties:


# Navigate to '''Tools &rarr; Options'''.
===debugging===
# Click on '''Show all settings''' to show the settings we need to change.
# Open the '''Projets and Solutions''' category and choose '''VC++ Directories'''.


Now we need to link the Include directories.
''See [[Troubleshooting EDuke32#Debugging|Troubleshooting EDuke32]].''


====General Include directories====
==MinGW-w64/GCC (Standalone)==


Make sure the Platform is set to Win32 and select '''Include files''' from the '''Show directories for:''' -drop down menu.
It is also possible to build with nothing but a standalone MinGW-w64 toolchain and [[Working with the Windows Command Prompt|cmd.exe]].


Click on an empty row and add the local directory names for OGGVorbis and DirectX SDK. For example:
===setup===
* 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.
====GCC====


The new linked directories are saved automatically so don't click on OK, it will only close the Options menu.
#First, download [http://www.winlibs.com/ a MinGW-w64 package]. You will generally want Win64 unless you specifically need a 32-bit binary. Recent packages come with clang too.
#You are going to want to extract these in an organized fashion. For example:
#*<code>C:\MinGW-w64\mingw32\bin\gcc.exe</code>
#*<code>C:\MinGW-w64\mingw64\bin\gcc.exe</code>
#If you are interested in building 32-bit binaries, also download '''[http://www.nasm.us/ NASM]''' and extract its contents to the i686 bin folder, so nasm.exe is located there.
#*<code>C:\MinGW-w64\mingw32\bin\nasm.exe</code>
#Unfortunately, one deficiency in MinGW-w64 is that the each of the two targets (32-bit and 64-bit) require their own separate executables, instead of using one binary with the <code>-arch</code> parameter as on other platforms. You will need to set up your PATH variables for a session that can use the toolchain you have set up. For example, <code>set PATH=C:\MinGW-w64\mingw64\bin;%PATH%</code>. When building, the executables generated will match the target of whatever compiler is the highest in PATH, with no extra make parameters needed.
#*Power users can permanently set up their PATH to one or the other toolchain through ''Advanced system settings'' (aka ''sysdm.cpl'') if desired. If you have enabled the "Launch folder windows in a separate process" option in Windows Explorer, you will need to restart explorer.exe (either by terminating and relaunching it in Task Manager, or restarting your computer) for changes made to persistent PATH to take effect in command prompt windows launched from within Explorer.
#MinGW-w64 comes with GNU Make, but it is named ''mingw32-make.exe''. If you don't want to type <code>mingw32-make</code> where you would normally type <code>make</code>, feel free to <code>copy mingw32-make.exe make.exe</code>.
#One final note: If you are trying to build '''ebacktrace1.dll''' and are getting errors about a missing "bfd.h", you need to copy the following files from <code><nowiki><root>\include\</nowiki></code> to <code><nowiki><root>\<target>-w64-mingw32\include\</nowiki></code>:


Next up, we need to link the libaries.
ansidecl.h
bfd.h
bfdlink.h
dis-asm.h
symcat.h


====Library directories====
====clang====


Next, Select '''Library files''' from the '''Show directories for:''' -drop down menu.
It is also possible to use mainline releases of LLVM/clang. However, recent releases of clang for Windows default to acting as a drop-in replacement for Visual Studio rather than the preferred GCC as with MinGW-w64. However, for the adventurous:


Click on an empty row and add the local directory names for OGGVorbis and DirectX SDK. For example:
#Download [http://releases.llvm.org/download.html clang for Windows].
* C:\Program Files\oggvorbis-win32sdk-1.0.1\lib
#Extract your choice of 32-bit and/or 64-bit binaries to the ''bin'' folder of the corresponding MinGW-w64 toolchain installed above.
* C:\Program Files\DirectX 7 SDK\lib
#When building EDuke32, append <code>CUSTOMOPT="-target i686-w64-mingw32"</code> (targeting a 32-bit build) or <code>CUSTOMOPT="-target x86_64-w64-mingw32"</code> (targeting 64-bit) in addition to <code>CLANG=1</code> so clang tries to use GCC's headers instead of Visual Studio's headers.


Notice how each directory has the library subdirectory chosen (either '''lib''' or '''libs''').
Since primary purpose of a standalone setup is producing the most optimized production binaries possible, clang on Windows may or may not be stable, robust, and mature enough to be worth it in this setting. For simple development aids such as clang's very nice diagnostic output, using it in MSYS2 should be sufficient.


Now click on OK to exit the Options menu.
===building===


===Compiling===
Open a [[Working with the Windows Command Prompt|command prompt window]] in the source code's location. Once there, building is the same as with MSYS2, with the exception of using <code>mingw32-make</code> instead of <code>make</code> if you did not copy it.


Either click on the green play button, or navigate the menus to '''Build &rarr; Build eduke32''' and VS08 starts compiling the executables.
In order to allow building in the absence of an ''sh.exe'', the PRETTY_OUTPUT colorful build process message feature provided by EDuke32's Makefile is disabled with this setup. Advanced users can open the ''MSYS2 MSYS'' shortcut, if installed above, or [https://git-scm.com/download/win Git Bash], in combination with manually configuring their Unix-style PATH variable, to get colorful output with a standalone toolchain.


You will probably see alot of warnings with wrong datatype conversions but these don't affect the outcome.
[[Category:Distribution documentation]]

Latest revision as of 04:53, 29 May 2023

EDuke32 Distribution

Download · Source Code · APT repository · Packages
Building from source on: Linux · Windows · macOS


There are several options available to develop EDuke32 on Windows. Before you begin, you will need to acquire the EDuke32 source code.

Microsoft Visual Studio

For many developers, Visual Studio will be the easiest and most familiar way to work with the source. While the EDuke32 team prefers GCC for production builds, the VS IDE is a valuable and useful resource for development.

setup

Visual Studio can be downloaded from Microsoft's website. The free version, Visual Studio Community, works perfectly. If you don't want the IDE, the Build Tools for Visual Studio will install the toolchain by itself.

Visual Studio 2013 is the minimum supported version for building EDuke32, but the newest version is always recommended.

building

from the IDE

Either click on the green play button, or navigate Build → Build eduke32 in the menus to start the build process.

from the command line

You will need to set up your paths to contain the VS toolchain. Newer versions provide shortcuts in the start menu to start a terminal with the appropriate settings. Doing so manually is out of scope of this article.

Navigate to platform/Windows in the EDuke32 source code and enter:

nmake -f msvc.mak

MinGW-w64/GCC with MSYS2

For a more Unix-like style of development, MSYS2 provides a bash shell, native GCC and clang builds, and the pacman package manager originally from Arch Linux.

tips to remember

  • You can press the middle mouse button to paste text into the MSYS2 terminal, or right-click for more options.
  • You can navigate folders using the cd command (short for change directory), or the pushd command, which adds the new path you specify to a stack, allowing you to return to your previous location with popd.
  • Paths use forward slashes (/) instead of backslashes (\) and drive letters take the form /c/ instead of C:\, though it will likely understand either way if you put your path in "quotes".

setup

  1. First, install MSYS2, following the instructions on that page fully. Install whichever architecture matches your computer; both can cross-compile to the other.
  2. The installer will create three shortcuts in the Start Menu. Ignore MSYS2 MSYS. Open MSYS MinGW (32-bit) or (64-bit) to select which architecture you would like to target while building during the shell session that begins. Unfortunately, one deficiency in MinGW-w64 is that the each of the two targets (32-bit and 64-bit) require their own separate executables, instead of using one binary with the -arch parameter as on other platforms.
  3. Try updating all packages with pacman -Syuu to verify you've completed the instructions. If all is well, you should see there is nothing to do. Otherwise, accept the update and repeat until there is nothing further to update.
  4. Next, we will need to install some additional packages. The pacman package manager covers all of MSYS2 and is not affected by which shortcut you chose in the previous item.
    • These packages are necessary to build:
      • pacman -S --needed --noconfirm mingw-w64-{i686,x86_64}-toolchain make nasm yasm
    • If you would like to use Subversion and Git directly from the MSYS2 shell:
      • pacman -S --needed --noconfirm subversion git
    • If you would like clang as an additional compiler option:
      • pacman -S --needed --noconfirm mingw-w64-{i686,x86_64}-{clang,lld}
    • EDuke32 includes prebuilt Windows static libraries for all external dependencies with its source code, and therefore installing them through the package manager is superfluous. However, for reference:
      • pacman -S --needed --noconfirm `pacman -Ssq sdl` `pacman -Ssq flac` `pacman -Ssq libvpx`

You should now be all set.

building

Now that we've got everything together, you can try building EDuke32 and Mapster32. Navigate to the base directory containing the EDuke32 source code, type the following and eduke32.exe and mapster32.exe should be created.

make

For quick testing of changes, it is recommended to build a debug executable, which skips all compiler optimizations for a much faster compile time, and also includes information about the source code called debug symbols for debugging with GDB. Append RELEASE=0 to the command, like this:

make RELEASE=0

You can enable parallelism and build multiple objects at the same time with '-j'. The flag by itself will use the total number of threads available, or you can specify a number, such as '-j2'.

make RELEASE=0 -j4

To compile only either the game or the editor, simply give make the name of the executable, like

make RELEASE=0 -j4 eduke32.exe

To build with clang, append the setting CLANG=1 to your make invocation.

make RELEASE=0 -j4 eduke32.exe CLANG=1

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.

debugging

See Troubleshooting EDuke32.

MinGW-w64/GCC (Standalone)

It is also possible to build with nothing but a standalone MinGW-w64 toolchain and cmd.exe.

setup

GCC

  1. First, download a MinGW-w64 package. You will generally want Win64 unless you specifically need a 32-bit binary. Recent packages come with clang too.
  2. You are going to want to extract these in an organized fashion. For example:
    • C:\MinGW-w64\mingw32\bin\gcc.exe
    • C:\MinGW-w64\mingw64\bin\gcc.exe
  3. If you are interested in building 32-bit binaries, also download NASM and extract its contents to the i686 bin folder, so nasm.exe is located there.
    • C:\MinGW-w64\mingw32\bin\nasm.exe
  4. Unfortunately, one deficiency in MinGW-w64 is that the each of the two targets (32-bit and 64-bit) require their own separate executables, instead of using one binary with the -arch parameter as on other platforms. You will need to set up your PATH variables for a session that can use the toolchain you have set up. For example, set PATH=C:\MinGW-w64\mingw64\bin;%PATH%. When building, the executables generated will match the target of whatever compiler is the highest in PATH, with no extra make parameters needed.
    • Power users can permanently set up their PATH to one or the other toolchain through Advanced system settings (aka sysdm.cpl) if desired. If you have enabled the "Launch folder windows in a separate process" option in Windows Explorer, you will need to restart explorer.exe (either by terminating and relaunching it in Task Manager, or restarting your computer) for changes made to persistent PATH to take effect in command prompt windows launched from within Explorer.
  5. MinGW-w64 comes with GNU Make, but it is named mingw32-make.exe. If you don't want to type mingw32-make where you would normally type make, feel free to copy mingw32-make.exe make.exe.
  6. One final note: If you are trying to build ebacktrace1.dll and are getting errors about a missing "bfd.h", you need to copy the following files from <root>\include\ to <root>\<target>-w64-mingw32\include\:
ansidecl.h
bfd.h
bfdlink.h
dis-asm.h
symcat.h

clang

It is also possible to use mainline releases of LLVM/clang. However, recent releases of clang for Windows default to acting as a drop-in replacement for Visual Studio rather than the preferred GCC as with MinGW-w64. However, for the adventurous:

  1. Download clang for Windows.
  2. Extract your choice of 32-bit and/or 64-bit binaries to the bin folder of the corresponding MinGW-w64 toolchain installed above.
  3. When building EDuke32, append CUSTOMOPT="-target i686-w64-mingw32" (targeting a 32-bit build) or CUSTOMOPT="-target x86_64-w64-mingw32" (targeting 64-bit) in addition to CLANG=1 so clang tries to use GCC's headers instead of Visual Studio's headers.

Since primary purpose of a standalone setup is producing the most optimized production binaries possible, clang on Windows may or may not be stable, robust, and mature enough to be worth it in this setting. For simple development aids such as clang's very nice diagnostic output, using it in MSYS2 should be sufficient.

building

Open a command prompt window in the source code's location. Once there, building is the same as with MSYS2, with the exception of using mingw32-make instead of make if you did not copy it.

In order to allow building in the absence of an sh.exe, the PRETTY_OUTPUT colorful build process message feature provided by EDuke32's Makefile is disabled with this setup. Advanced users can open the MSYS2 MSYS shortcut, if installed above, or Git Bash, in combination with manually configuring their Unix-style PATH variable, to get colorful output with a standalone toolchain.