EOSERV Wiki > Page: EOSERV From Scratch - Windows > History > View Revision

View Revision: EOSERV From Scratch - Windows

This tutorial will walk you through everything you need to build EOSERV on Windows. It assumes you have no development tools installed.

Note: MSVC (Microsoft Visual Studio) is '''not''' supported.

Installing MinGW

''Skip this section if you already have MinGW with GCC 4.8 or later installed.''

MinGW is a Windows port of several open source software development toolchains and libraries. It provides the C and C++ compiler, system library and threading library needed by EOSERV.

  1. Download the mingw-get Installer: http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download.
  2. Install it to the default path: '''C:\MinGW'''. If you change the path, Code::Blocks will fail to auto-detect it later on.
  3. Run mingw-get, either through start menu or desktop shortcuts if you created them, or browsing to C:\mingw\bin and running "mingw-get.exe"
  4. Locate the following packages in the GUI, using the side-bar to navigate between sections. Ensure you check the class column is correct:
    1. Package: '''mingw32-gcc-g++''' (Class: '''bin''') (Basic Setup)
    2. Package: '''mingw32-libz''' (Class: '''dll''') (All Packages/MinGW/MinGW Libraries/MinGW Standard Libraries)
    3. Package: '''mingw32-pthreads-w32''' (Class: '''dev''') (All Packages/MinGW/MinGW Libraries/MinGW Standard Libraries)
  5. Click on Installation -> Apply Changes in the menu bar
  6. The installer will automatically download and install the required components (approx. 40MB)
  7. Ensure the download and installation completed successfully. If not, the simplest option is to delete the MinGW directory and start over.

After installation, you should have everything you need to build EOSERV, apart from some third-party libraries and an IDE. Ensure '''C:\MinGW\bin''' is now populated with around 50 files, including: '''mingw32-g++.exe''', '''zlib1.dll''' and '''pthreadGC2.dll'''.

MariaDB Client Library

''You may skip this section if you already have MariaDB's C Connector installed, or you wish to use MySQL's client library.''

You may also skip this section if you do not require MySQL database support.

  1. Download and install the latest MariaDB C Connector from https://downloads.mariadb.org/connector-c/ (approx. 3MB).

'''NOTE:''' Version 2.1.0 has a problem that requires working around later on. Version 2.0.0 is the recommended version for now.

SQLite3 Library

''You may skip this section if you already have an SQLite library available.''

You may also skip this section if you do not require SQLite database support.

There are two options for getting the SQLite3 library:

  1. '''RECOMMENDED''': Download the latest version of our custom-packaged version of SQLite from SQLite_Library
  2. Extract the zip file to a memorable path (We use '''C:\sqlite3''' in our examples)

Alternatively,

  1. Download the official amalgamation release from http://www.sqlite.org/download.html.
  2. Remember to copy the files in to the EOSERV src directory later on, and add sqlite3.c to the project to be built with the C compiler.
  3. Or, also download the win32 DLL release, visit SQLite_Library_Method and follow the instructions to build a stub library for the sqlite3 DLL.

Installing Code::Blocks

''Skip this section if you already have Code::Blocks installed''

Using Code::Blocks is the primary method of building EOSERV presently.

  1. Download Code::Blocks from http://www.codeblocks.org/downloads/binaries (approx. 30MB). '''Do not download the version with MinGW bundled!'''. As of writing, the latest release is 13.12. "Nightly" builds from http://forums.codeblocks.org/index.php/board,20.0.html work well and are more recent.
  2. Run Code::Blocks, you should get a dialog that says "GNU GCC Compiler" was detected. If you don't, you should go back and make sure MinGW is installed in the right location (C:\MinGW)
  3. Code::Blocks can wait until the source code is obtained next...

Obtaining the Source Code

There are two options for getting the EOSERV source:

  1. '''RECOMMENDED''': Download the latest version of TortoiseSVN from http://tortoisesvn.net/downloads.html (approx. 15MB). Ensure you get the correct version for your operating system (32-bit or 64-bit).
  2. Follow the instructions on EOSERV_TortoiseSVN for instructions on obtaining the source code and keeping it up to date.

Alternatively,

  1. Visit http://files.eoserv.net/snaps/ and download the latest snapshot. You may use WinRAR (approx. 2MB) to extract the archives.

Snapshots are not recommended for serious work as it is difficult to update the code without destroying any of your own alternations.

Setting up the Project

Once the EOSERV source code is obtained, you can open the Code::Blocks project under the '''project''' directory. Either double-click on mingw.cbp, otherwise, click the Open Project link on the Code::Blocks start page, browse to mingw.cbp, and open it.

Before building EOSERV, you must specify the MariaDB and/or SQLite3 search directories ('''NOTE:''' You must have at least one of those two libraries).

  1. Click on Project -> Build Options in the menu bar.
  2. Ensure that "eoserv" is selected on the left side-panel.
  3. Click on the '''Search Directories''' tab, and ensure you are on the '''Compiler''' tab.
  4. Click on '''Add''' and enter the path of your MariaDB include directory (example: C:\Program Files\MariaDB\MariaDB C Client Library\include). Note that the version 2.1 path is different!
  5. Click on '''Add''' and enter the path you extracted the SQLite 3 library to (example: C:\sqlite3)
  6. Switch to the '''Linker''' tab
  7. Click on '''Add''' and enter the path of your MariaDB '''lib''' directory (example: C:\Program Files\MariaDB\MariaDB C Client Library\'''lib'''). Note the difference: include -> lib!
  8. Click on '''Add''' and enter the path you extracted the SQLite 3 library to (example: C:\sqlite3)
  9. If you are using version 2.1.0 of the MariaDB Client Library, click '''Compiler Settings''', '''#defines''', and add '''MARIADB_CC_2_1_0_WORKAROUND''' as the fourth line of text.
  10. Click OK to close the project settings dialog

As one last step, check for a drop-down box that says "MYSQL+SQLITE" in the Code::Blocks toolbars. If you are building without MariaDB, select "SQLITE", or if you are building without SQLite3, select "MYSQL". You may also select one of the debug variants if you wish.

Once everything is set correctly, press F9 and the build should begin. Keep an eye on the Build log for any problems. After 1-2 minutes, EOSERV should open. If not, you might be able to find help on the EOSERV Forum.

Note: Don't panic if you get an error about missing DLL files! In order for EOSERV to run outside of the IDE environment, you should copy the following DLLs from their original location to the EOSERV directory along-side eoserv.exe. These will need to be bundled with EOSERV wherever you move it:

  • C:\mingw\bin\'''libgcc_s_dw2-1.dll''' ''(You may remove this dependency by adding -static-libgcc to the linker flags)''
  • C:\mingw\bin\'''libstdc++.dll''' ''(You may remove this dependency by adding -static-libstdc++ to the linker flags)''
  • C:\mingw\bin\'''pthreadGC2.dll'''
  • C:\sqlite3\'''sqlite3.dll''' (This DLL is not required if you used a statically linked version of the library, or the amalgamation)
  • C:\Program Files\MariaDB\''(MariaDB C Client Library or MariaDB Connector C)''\lib\'''libmariadb.dll'''

Note: It is completely normal at this point for EOSERV to immediately stop with the error: '''[ERR] Could not load file: ./data/pub/dat001.eif'''. See the next section for setting up EOSERV.

Configuring EOSERV

See the page Configuring_EOSERV for what to do after EOSERV has been successfully built.

Alternatives

This section discusses some alternatives than the recommended ways of building EOSERV.

Clang: C and C++ compiler

Windows releases of clang are available from http://llvm.org/releases/download.html. Clang on Windows still requires a full MinGW installation to provide the system library.

After installation to a standard path, Code::Blocks should detect it

MySQL Client Library

If you have MySQL Server installed, the client libraries should be available to use in place of MariaDB.

Simply substitute the MariaDB compiler/linker search path with the MySQL equivalents, and replace each instance of "mariadb" under the project linker settings of all four "MYSQL" targets with "mysql"

Note: You cannot re-distribute a closed-source fork of EOSERV that uses the MySQL Client Library.

CMake

Installing MinGW-Make

Re-run mingw-get and select '''mingw32-make''' (Class: '''bin''') for installation (only visible directly under "All Packages").

In order to operate MinGW from the command line, you'll need to add its path to your system's PATH variable. The exact method differs depending on your operating system, but should go something like this:

  1. Press '''Win+Pause/break''' to open System Properties (or, right click '''My Computer''' and click '''Properties''').
  2. Click on '''Advanced System Settings'''
  3. Go to the '''Advanced''' tab
  4. Click on the '''Environment Variables''' button
  5. Locate '''Path''' under '''System variables'''
  6. Double click on it to edit its value, leave the original value alone, but append ''';C:\MinGW\bin''' (including the semicolon) to the end of it and click OK.
  7. It should look something like this: %SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SYSTEM32\WBEM;%SYSTEMROOT%\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\MinGW\bin
  8. After changing it, you should log out and in for the changes to take effect.

Using CMake

CMake can be downloaded and installed from http://cmake.org/ and comes with a GUI.

Use CMake's GUI to select a source directory (the directory EOSERV has been extracted to), and a build directory (a directory you want to build EOSERV in). To avoid problems, make sure the build directory is not the same as the source directory.

Click "Configure", and select your toolchain (GCC and Clang should be automatically detected, or compiler paths can be specified manually), and output format (MinGW Makefiles). Various build options can be changed using the GUI (such as toggling MySQL/SQLite support) before clicking "Generate".

If you get any errors about missing libraries, you should use the GUI to manually specify locations to headers and libraries. e.g. SQLITE3_LIBRARY can be set to sqlite3.dll (e.g. "C:\sqlite3\sqlite3.dll"), and SQLITE3_INCLUDES to a path containing sqlite3.h (e.g. "C:\sqlite3\"). If the pthreads library is missing, it should be installed through mingw-get.

Building

Once the project has been successfully configured, you can build EOSERV by typing '''mingw32-make''' in a command line in the build directory.

EOSERV Wiki > Page: EOSERV From Scratch - Windows > History > View Revision