From rAthena Wiki
Jump to: navigation, search



Using configure & make

Configure and make are commands used commonly to configure, build and install Linux applications.


Main article: Configure.

To avoid errors in server-client communication, PACKETVER must be set to date the client you're going to use has been released at (in YYYYMMDD format), eg 20100730 for 2010-07-30aRagexeRE. Instead of editing mmo.h directly, PACKETVER can be set to desired date with configure switch --enable-packetver=YYYYMMDD.

Run following command, replacing YYYYMMDD with your client release date, eg 20100730.

 ./configure --enable-packetver=YYYYMMDD

Configure script will perform necessary tests and generate makefiles.


make server

You should be now noticing that you have 3 new files: char-server, map-server, and login-server. Make install is not yet supported.

Using cmake & make

Cmake is a cross-plateform configure.

Start creating a new sub directory and move there

  mkdir build
  cd build

Building makefiles

Generate the make files by cmake

  cmake -G"Unix Makefiles" -DINSTALL_TO_SOURCE=ON ..
-- The C compiler identification is GNU
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting system MYSQL
-- Found MYSQL: /usr/lib/ (found version "5.5.48-MariaDB")
-- Detecting system MYSQL - done
-- Configuring for system MYSQL
-- Configuring for system MYSQL - done
-- Detecting system PCRE
-- Found PCRE: /usr/lib/x86_64-linux-gnu/ (found version "8.31")
-- Detecting system PCRE - done
-- Configuring for system PCRE
-- Configuring for system PCRE - done
-- Detecting system ZLIB
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/ (found version "1.2.8")
-- Detecting system ZLIB - done
-- Configuring for system ZLIB
-- Configuring for system ZLIB - done
-- Creating svnversion.h
-- Creating svnversion.h - done
-- Creating target common_base
-- Creating target common_base - done
-- Creating target common
-- Creating target common - done
-- Creating target login-server
-- Creating target login-server - done
-- Creating target char-server
-- Creating target char-server - done
-- Creating target map-server
-- Enabled PCRE code
-- Creating target map-server - done
-- Creating target mapcache
-- Creating target mapcache - done

-- Available targets:
--      common_base
--      common
--      login-server
--      char-server
--      map-server
--      mapcache
-- Configuring done
-- Generating done
-- Build files have been written to: /home/*/ra/build


Then compile

  make install
Scanning dependencies of target common_base
[  1%] Building C object src/common/CMakeFiles/common_base.dir/__/__/3rdparty/mt19937ar/mt19937ar.c.o
[  1%] Building C object src/common/CMakeFiles/common_base.dir/core.c.o
[  2%] Building C object src/common/CMakeFiles/common_base.dir/db.c.o
[  3%] Building C object src/common/CMakeFiles/common_base.dir/des.c.o
[ 98%] Building C object src/tool/CMakeFiles/mapcache.dir/__/common/grfio.c.o
[ 99%] Building C object src/tool/CMakeFiles/mapcache.dir/__/common/utils.c.o
[100%] Building C object src/tool/CMakeFiles/mapcache.dir/mapcache.c.o
-- Installing: ~/rathena/./login-server
-- Installing: ~/rathena/./char-server
-- Installing: ~/rathena/./map-server
-- Installing: ~/rathena/./mapcache

You'll see nice green output progression then finally login-server, map-server, char-server, in main folder


For compiling on Windows, Visual Studio is the preferred method, although using Cygwin is also possible.

Using Visual Studio

MS Visual Studio 2010: Compile configuration (red) and solution (blue) with it's child projects.

rAthena ships with solution and project files for Visual Studio from 9 onwards to Visual Studio 2015. Usage of both the paid and free (express) versions is same, although the paid one produces more efficient code [1].

  • Download MS Visual Studio 2010 and .NET Framework 4 Training Kit and install it, if you do not have Visual Studio/Visual C++ already installed.
  • Open rAthena-10.sln in your rAthena folder.
  • Select the desired compile configuration (marked red). Use Release when you compile the server, where players will be playing on. Debug compiles the server without optimizations and with debugging information.
  • Right-click the solution node (marked blue) and select Build solution. If you have compiled the server before, it is recommended to use Rebuild solution, as it forces the compiling of all components, not just those, which seem to have changed since last compile.
  • If the compilation was successful, the resulting executables are in the same folder as the solution named login-server_sql.exe, char-server_sql.exe, map-server_sql.exe and mapcache.exe.

Note: Visual Studio 2015 is supported by rAthena. Make sure you use rAthena-14.sln as the solution file for the project in that case.

Using Cygwin

Cygwin is a Linux environment emulation for Windows. As such it enables compiling the way it would be done on Linux. Compiling in Cygwin is not recommended due to lower performance and increased installation complexity.

  • Download Cygwin and install it, if not already done so. When installing, select following packages:
    • from Devel: cmake, gcc and make
    • from Lib: libidn-devel, libpcre-devel, readline, zlib-devel
  • Running Cygwin Terminal will create folder home/user inside Cygwin installation folder, where user is the name currently logged on Windows user.
  • SQL server needs to be installed in Cygwin so the compiler can access the SQL libraries. Download the .tar.gz archive from the MySQL website, such as mysql-5.5.20.tar.gz.
  • Place the archive into /home/user and execute following inside Cygwin Terminal to unpack it:
 cd ~
 tar xvzf mysql-5.5.20.tar.gz
  • Navigate to directory with unpacked archive:
 cd mysql-5.5.20
  • To avoid conficts, replace dtoa() with _dtoa() in strings/dtoa.c file:
 sed -i 's/dtoa(/_dtoa(/g' ./strings/dtoa.c
  • Build MySQL with following commands:
 cmake .
 make mysqlclient libmysql
 make install
  • After everything completes, Cygwin is ready for compiling rAthena. Navigate to the rAthena folder in Cygwin. Windows drives are accesible as /cygdrive/x where x is the letter assigned to the drive by Windows.
  • Execute following commands inside rAthena folder to compile it:
 ./configure --with-mysql=/usr/local/mysql/bin/mysql_config
 make server
  • If the compilation was successful, the resulting executables are in the rAthena folder named login-server_sql.exe, char-server_sql.exe and map-server_sql.exe.
  • Server executables can be run inside Cygwin Terminal or directly, but in this case you need to copy required libraries to rAthena folder:
    • cygwin1.dll, cygz.dll, cyggcc_s-1.dll, cygpcre-0.dll from /bin
    • cygmysqlclient-18.dll from /usr/local/mysql/lib
Personal tools