Building MTASA Server on GNU Linux: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 66: Line 66:


<syntaxhighlight lang="lua">yum install glibc-devel curl-devel pcre-devel sqlite3-devel readline-devel lua-devel subversion</syntaxhighlight>
<syntaxhighlight lang="lua">yum install glibc-devel curl-devel pcre-devel sqlite3-devel readline-devel lua-devel subversion</syntaxhighlight>




Line 75: Line 74:
The MTA:SA server currently cannot be properly compiled in 64-bit mode. Instead, you should compile it in 32-bit mode and run it using 32-bit compatibility mode (use the -m32 flag).
The MTA:SA server currently cannot be properly compiled in 64-bit mode. Instead, you should compile it in 32-bit mode and run it using 32-bit compatibility mode (use the -m32 flag).


== General instructions for 1.1 ==
== General instructions for 1.3 ==


'''Downloading the source.'''
'''Downloading the source.'''


First you need to download the source.
First you need to download the source.
<!-- This is done to enable templates inside something which looks like a code block -->
<pre&lt;noinclude&gt;&lt;/noinclude&gt;>
svn checkout <nowiki>http</nowiki>://mtasa-blue.googlecode.com/svn/branches/{{Current Version|full}}/ mtasa-blue
cd mtasa-blue
</pre&lt;noinclude&gt;&lt;/noinclude&gt;>
'''Prepare the sparsehash library'''


'''Note:''' You can skip this step if you downloaded sparehash through package manager.
svn checkout <nowiki>http</nowiki>://mtasa-blue.googlecode.com/svn/branches/{{Current Version|full}}/ mtasa-blue
cd mtasa-blue


<syntaxhighlight lang="lua">cd vendor/sparsehash/current
Then compile it thus:
autoreconf -fi
autoreconf -fiv
./configure
export PKG_CONFIG_PATH=/usr/lib32/pkgconfig
make install
./configure LDFLAGS="-m32" CPPFLAGS="-m32" CFLAGS="-m32" CXXFLAGS="-m32" $@
cd ../../..</syntaxhighlight>
make
make -C MTA10_Server install
make -C Shared/XML install


Get the net.so like this:
wget <nowiki>http</nowiki>://nightly.mtasa.com/?multitheftauto_linux-{{Current Version|full}}-rc-latest -O multitheftauto_linux-{{Current Version|full}}-latest.tar.gz
tar -xzf multitheftauto_linux-{{Current Version|full}}-latest.tar.gz --transform 's:[^/]*:latest_nightly:'
mv latest_nightly/net.so .
rm -rf latest_nightly multitheftauto_linux-{{Current Version|full}}-latest.tar.gz


'''Prepare the PCRE library'''
Copy config files
cp MTA10_Server/mods/deathmatch/acl.xml MTA10_Server/output/mods/deathmatch/acl.xml
cp MTA10_Server/mods/deathmatch/mtaserver.conf MTA10_Server/output/mods/deathmatch/mtaserver.conf


<syntaxhighlight lang="lua">cd vendor/pcre
Get resources
autoreconf -fi
cd MTA10_Server/output
./configure --disable-shared
svn export <nowiki>http</nowiki>://mtasa-resources.googlecode.com/svn/trunk/ mods/deathmatch/resources
make libpcre.la
cd ../..</syntaxhighlight>
 
 
'''Compile the server'''
 
<syntaxhighlight lang="lua">autoreconf -fi
./configure
make install</syntaxhighlight>
 
Your vanilla server will now be compiled and installed into the MTA10_Server/output/ directory.
 
 
'''Run the server'''
 
Grab the net.so from the latest 1.1.x nightly and place it in your output directory, install the mtaserver.conf and acl.xml files into the ''mods/deathmatch/'' directory and put the latest resources from [http://code.google.com/p/multitheftauto-resources/ multitheftauto-resources project] into the ''mods/deathmatch/resources/'' directory . You can then run your server.
 
<syntaxhighlight lang="lua">cd MTA10_Server/output
./mta-server</syntaxhighlight>


And the server should be ready in MTA10_Server/output


=== '''Troubleshooting''' ===
=== '''Troubleshooting''' ===
Line 129: Line 112:


If you’re getting any unexpected errors while compiling, please check our [http://bugs.mtasa.com/ Bug tracker] or our [irc://irc.multitheftauto.com/ IRC channel]
If you’re getting any unexpected errors while compiling, please check our [http://bugs.mtasa.com/ Bug tracker] or our [irc://irc.multitheftauto.com/ IRC channel]
== General instructions for 1.2 ==
'''Downloading the source.'''
First you need to download the source.
<syntaxhighlight lang="lua">svn checkout http://mtasa-blue.googlecode.com/svn/trunk mtasa-blue
cd mtasa-blue
</syntaxhighlight>
'''Run the do-everything shell script'''
This will compile the source then download the required net.so and resources.
<syntaxhighlight lang="lua">./initial-install.sh</syntaxhighlight>
When it's completed, your vanilla server will installed into the MTA10_Server/output/ directory.
'''Run the server'''
Install the mtaserver.conf and acl.xml files into the ''mods/deathmatch/'' directory and you can then run your server.
<syntaxhighlight lang="lua">cd MTA10_Server/output
./mta-server</syntaxhighlight>





Revision as of 18:58, 3 March 2012

Preparing your system

In order to build the Multi Theft Auto dedicated server, you will have to set up your system with the correct libraries and tools. How these are installed depends on your distribution.

Our network module (net.dll or net.so) is distributed as a precompiled binary library. The file for GNU/Linux can be found inside the lastest Linux nightly from here. Use the net.so from 1.2 if you are compiling from the trunk, or the net.so from 1.1.x if you are compiling the 1.1.x branch. Be sure the read the top of MTA10_Server/version.h as it contains directions on how to compile the different build types.


Debian Linux


Includes derivative distributions such as Ubuntu.

You will need the necessary build tools, headers and libraries, which are distributed through the following Debian packages (e.g. Debian Lenny):

  • build-essential: contains the necessary tools, headers and libraries to build applications
  • automake: contains the automake tools
  • libtool: contains the libtool software required to build libraries
  • libcurl3-dev: contains the cURL library (version 3 without SSL support)
  • libpcre3-dev: contains the PCRE library (version 3)
  • libsqlite3-dev: contains the SQLite library (version 3)
  • libreadline5-dev: contains the readline library (version 5)
  • subversion: contains the SVN client used to check out our code repository
  • libncurses5-dev: contains software for controlling writing to the console screen
  • libncursesw5-dev: contains support for wide characters
  • libsparsehash-dev: contains support for Google's hash-map (So you don't have to compile sparehash!)
  • libmysqlclient-dev: contains the MySQL library

To install these packages through apt, use the apt-get install <package list> command as in the following example (executed as root):

apt-get install build-essential automake libtool libcurl4-openssl-dev libpcre3-dev libsqlite3-dev libreadline5-dev subversion libncurses5-dev libncursesw5-dev libsparsehash-dev libmysqlclient-dev



Gentoo Linux


You will need the necessary build tools, headers and libraries. Because Gentoo’s portage system is designed to compile any packages on your own system, the necessary build tools will have already been installed. This only leaves you to install the necessary libraries:

  • sqlite: contains the SQLite library
  • subversion: contains the SVN client used to check out our code repository
  • curl: contains the cURL library; to compile with SSL support, apply the net-misc/curl ssl USE flag

To compile and install these packages through emerge, use the emerge -v <package list> command. The -v option shows additional * * information and can be omitted. (If you want to use any USE flags, prepend emerge with USE="use flags here". You can also use the -pv option to verify that you’re using the correct flags.) Refer to the Gentoo Handbook or manual for more information on emerge.

Example:

emerge -v subversion sqlite
USE=“net-misc/curl ssl” emerge -v curl



Fedora


You will need these packages to be able to successfully compile a MTA server on Fedora:

  • glibc-devel:
  • curl-devel: contains the cURL library
  • pcre-devel: contains the PCRE library
  • sqlite3-devel: contains the SQLite library
  • readline-devel: contains the readline library
  • lua-devel: contains the Lua libraries
  • subversion: contains the SVN client to check out the source code

To install these packages through yum, use the yum install <package list> command as in the following example (executed as root):

yum install glibc-devel curl-devel pcre-devel sqlite3-devel readline-devel lua-devel subversion


A warning for x64


The MTA:SA server currently cannot be properly compiled in 64-bit mode. Instead, you should compile it in 32-bit mode and run it using 32-bit compatibility mode (use the -m32 flag).

General instructions for 1.3

Downloading the source.

First you need to download the source.

svn checkout http://mtasa-blue.googlecode.com/svn/branches/1.6.0/ mtasa-blue
cd mtasa-blue

Then compile it thus:

autoreconf -fiv
export PKG_CONFIG_PATH=/usr/lib32/pkgconfig
./configure LDFLAGS="-m32" CPPFLAGS="-m32" CFLAGS="-m32" CXXFLAGS="-m32" $@
make
make -C MTA10_Server install
make -C Shared/XML install

Get the net.so like this:

wget http://nightly.mtasa.com/?multitheftauto_linux-1.6.0-rc-latest -O multitheftauto_linux-1.6.0-latest.tar.gz
tar -xzf multitheftauto_linux-1.6.0-latest.tar.gz --transform 's:[^/]*:latest_nightly:'
mv latest_nightly/net.so .
rm -rf latest_nightly multitheftauto_linux-1.6.0-latest.tar.gz

Copy config files

cp MTA10_Server/mods/deathmatch/acl.xml MTA10_Server/output/mods/deathmatch/acl.xml
cp MTA10_Server/mods/deathmatch/mtaserver.conf MTA10_Server/output/mods/deathmatch/mtaserver.conf

Get resources

cd MTA10_Server/output
svn export http://mtasa-resources.googlecode.com/svn/trunk/ mods/deathmatch/resources

And the server should be ready in MTA10_Server/output

Troubleshooting

Any errors during the compilation of json-c can be solved by calling autoreconf -fi from the json-c directory.

If you’re getting any unexpected errors while compiling, please check our Bug tracker or our IRC channel


Server crashes

If your Linux server crashes, please obtain a backtrace and post a report on our Bug tracker

To obtain a backtrace:

Do you have a core dump file in the the MTA server directory?

It's usually called 'core', and usually over 100MB, and looks something like this:

Core.png

If you have a core dump file in the the MTA server directory:

  • Install gdb. To install gdb on Debian, use this command:
apt-get install gdb
  • And from the MTA install directory do this command
gdb mta-server -c core
  • When gdb launches, do this command to get a backtrace:
bt
  • Save the output
  • (To exit gdb, use the quit command)

If you do not have a core dump file in the the MTA server directory:

  • Install gdb. To install gdb on Debian, use this command:
apt-get install gdb
  • And from the MTA server directory start the mta-server like this:
gdb mta-server --eval-command run
  • Now wait for a crash. (Ignore weird screen output in the meantime)
  • When a crash occurs, do this command to get a backtrace:
bt
  • Save the output
  • (To exit gdb, use the quit command)