Building EDuke32 on Windows: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
Line 66: Line 66:


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


Visual Studio 2013 is the minimum supported version for building EDuke32, but the newest version is always recommended. The free "Community" version is entirely sufficient. If you don't want the IDE, the [https://www.visualstudio.com/downloads/ Build Tools for Visual Studio] will install the toolchain by itself.
[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.
 
Visual Studio 2013 is the minimum supported version for building EDuke32, but the newest version is always recommended.


===building===
===building===

Revision as of 13:01, 15 October 2017

EDuke32 Distribution

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


Before you begin, you will need to acquire the EDuke32 source code.

MinGW/GCC

This setup is personally used by Hendricks266.

setup

MinGW-w64

MinGW-GCC is the de facto standard for free compilers on Windows.

  1. First, install MSYS using the automated MinGW installer. Make sure all MSYS components are installed. This should be relatively straightforward and will install the shell and utility commands.
    • This guide assumes that they're installed in c:/MinGW and c:/MinGW/msys -- from the wording on their page, anything else is BAD.
  2. Next, download NASM and extract its contents to MSYS' bin folder, so nasm.exe is located there.
    • Sample path: C:\MinGW\msys\1.0\bin\nasm.exe
  3. Download any and all MinGW-w64 packages you would like. These contain the entire toolchain. Win32 threads are preferred to POSIX threads, and seh (for 64-bit) and dwarf (for 32-bit) exception handling methods are preferred to sjlj.
  4. You are going to want to extract these in an organized fashion. Use these paths unless you are prepared to make edits to the batch files included with the Setup Helper below.
    • C:\MinGW-w64\mingw32\bin\gcc.exe
    • C:\MinGW-w64\mingw64\bin\gcc.exe
  5. After that, download, extract, and run the MinGW EDuke32 Setup Helper. (You may need to run it as an administrator for it to take full effect.) It will help ensure that everything is installed correctly as well as modify your PATH environment variable for you so you can run the compiler from any directory allowing you to compile EDuke32.
  6. 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. When building EDuke32, the executables generated will match the target of whatever compiler is the highest in PATH--no extra make parameters needed.
    • The Setup Helper sets up the 64-bit compiler by default. If you would like to change the default, run the included i686-MinGW-w64.bat. You can revert with x86_64-MinGW-w64.bat.
      • If you have configured Windows Explorer so that the "Launch folder windows in a separate process" option is enabled, 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.
    • Otherwise, for a quick test, execute the commands override32 and override64 to change the selected compiler for the current command prompt window only. (These are installed by the Setup Helper.)
  7. 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

Clang is another compiler that complements and works closely in tandem with MinGW. It is mainly used for its highly human readable diagnostic descriptions of compiler errors and warnings.

Installation is simple. Download the binaries marked for "Mingw32/x86", which may be marked "Experimental". From here you have two options. You can extract the contents of the archive in such a way so that its directory structure merges with MinGW's--you will have C:\MinGW\msys\1.0\bin\clang.exe and so on. The other is to extract the data to its own folder, possibly simplifying the name, and adding it on its own to PATH--C:\clang\bin\clang.exe.

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

building

Now that we've got everything together, navigate a command prompt window to the base directory containing the EDuke32 source code, type

make

and cross your fingers: this will attempt to build EDuke32 and Mapster32. If you ran the MinGW EDuke32 Setup Helper earlier in the instructions, it should work.

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

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

See Troubleshooting EDuke32.

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 settins. Doing so manually is out of scope of this article.

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

nmake -f Makefile.msvc