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

Revision Diff: EOSERV From Scratch - Windows

Revision by at 6th Feb 2015 05:08 am
DeletionsAdditions
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.
# Download the mingw-get Installer: [[http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download]].
# Install it to the default path: '''C:\MinGW'''. If you change the path, Code::Blocks will fail to auto-detect it later on.
# 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"
# Locate the following packages in the GUI, using the side-bar to navigate between sections. Ensure you check the class column is correct:
## Package: '''mingw32-gcc-g++''' (Class: '''bin''') (Basic Setup)
## Package: '''mingw32-libz''' (Class: '''dll''') (All Packages/MinGW/MinGW Libraries/MinGW Standard Libraries)
## Package: '''mingw32-pthreads-w32''' (Class: '''dev''') (All Packages/MinGW/MinGW Libraries/MinGW Standard Libraries)
# Click on Installation -> Apply Changes in the menu bar
# The installer will automatically download and install the required components (approx. 40MB)
# 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.
# 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:
# '''RECOMMENDED''': Download the latest version of our custom-packaged version of SQLite from [[SQLite Library]]
# Extract the zip file to a memorable path (We use '''C:\sqlite3''' in our examples)
Alternatively,
# Download the official amalgamation release from [[http://www.sqlite.org/download.html]].
# 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.
# 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.
# 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.
# 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)
# Code::Blocks can wait until the source code is obtained next...
== Obtaining the Source Code ==
There are two options for getting the EOSERV source:
# '''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).
# Follow the instructions on [[EOSERV_TortoiseSVN]] for instructions on obtaining the source code and keeping it up to date.
Alternatively,
# Visit [[http://files.eoserv.net/snaps/]] and download the latest snapshot. You may use [[http://www.rarlab.com/|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).
# Click on Project -> Build Options in the menu bar.
# Ensure that "eoserv" is selected on the left side-panel.
# Click on the '''Search Directories''' tab, and ensure you are on the '''Compiler''' tab.
# 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!
# Click on '''Add''' and enter the path you extracted the SQLite 3 library to (example: C:\sqlite3)
# Switch to the '''Linker''' tab
# 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!
# Click on '''Add''' and enter the path you extracted the SQLite 3 library to (example: C:\sqlite3)
# 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.
# 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 [[http://eoserv.net/forum/forum/EOSERV|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.
=== Makefile (No IDE) ===
'''Note:''' This method of building is liable to be removed in favour of CMake in the future.
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:
# Press '''Win+Pause/break''' to open System Properties (or, right click '''My Computer''' and click '''Properties''').
# Click on '''Advanced System Settings'''
# Go to the '''Advanced''' tab
# Click on the '''Environment Variables''' button
# Locate '''Path''' under '''System variables'''
# 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.
# It should look something like this: %SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SYSTEM32\WBEM;%SYSTEMROOT%\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\MinGW\bin
# After changing it, you should log out and in for the changes to take effect.
Navigate to the EOSERV source directory and type the command '''.\configure mingw''', which will generate the Makefile you need. From then on, you can build EOSERV by typing '''mingw32-make MYSQL=1 SQLITE=1'''.
You may need to modify Makefile.mgw to locate third-party libraries:
* Add '''"-IC:\path\to\include\directory"''' to the end of the CXXFLAGS line to add compiler search directories
* Add '''"-IC:\path\to\lib\directory"''' to the end of the LDFLAGS line to add linker search directories
EOSERV Wiki > Page: EOSERV From Scratch - Windows > History > Revision Diff