Jump to content

[Wiki] How to Compile on Linux (Ubuntu)


Guest krampf_
 Share

Recommended Posts

*********

NOTE: The MaNGOS source repositories URLs have changed. Cataclysm 4.3.4 is now the master and WoTLK 3.3.5a has been moved to MaNGOS-wotlk. Refer to the Announcements section and the "mangos source/projects list" stickied there for details.

*********

Since I find myself always looking for this guild and most of those out there are a bit dated; here is my attempt. This example assumes you are starting from your user's home directory.

Installing necessary packages to compile and run MaNGOS

sudo apt-get install build-essential gcc g++ automake git-core autoconf make patch libmysql++-dev mysql-server libtool libssl-dev grep binutils zlibc libc6 libbz2-dev cmake

Grabbing the source code of MaNGOS and ScriptDev2. I create a directory called mangos rather than dumping it in your home directory.

mkdir mangos
cd mangos
git clone git://github.com/mangos/server.git
cd server
git clone git://github.com/mangos/scripts.git src/bindings/ScriptDev2

Patching SD2 into MaNGOS

git apply src/bindings/ScriptDev2/patches/MaNGOS-*-ScriptDev2.patch

Compiling (with an install dir of /opt/mangos-server) Note: If /opt/mangos-server does not exist, create it and chown to the user you compile your code with

mkdir objdir
cd objdir
cmake .. -DPREFIX=/opt/mangos-server
make
make install

Extracting dbc, maps, vmaps.

Copy the contents of the server/contrib/extractor_binary directory to your WoW client directory. Then run the following:

C:\\Users\\Public\\Games\\World of Warcraft>ad.exe

C:\\Users\\Public\\Games\\World of Warcraft>vmapExtractor4
C:\\Users\\Public\\Games\\World of Warcraft>vmap_assembler.exe buildings vmaps

You can also just run the ExtractResources.sh; however need to install git bash or some other shell to run under Windows

I like to create a directory just for these files called data in your /opt/mangos-server directory. Move the directories (dbc, maps, and vmaps) that were created with the aforementioned windows commands to your /opt/mangos-server/data directory. (note: the directory location of your data files is set in your /opt/mangos-server/etc/mangosd.conf file) You can delete the files you copied from /contrib/extractor_binary and the directories when finished as they are not needed to run the client.

Grabbing the database.

cd ~/mangos
git clone git://github.com/mangos/database.git

Configuring the Databases

There are four databases that need to be set up. Characters, mangos, and realmd are found in your sql directory; ScriptDev2 is in your src/bindings/ScriptDev2/sql directory

Creating the databases and base structure

cd ~/mangos/server/sql
mysql -u root -p < create_mysql.sql
mysql -u root -p characters < characters.sql
mysql -u root -p mangos < mangos.sql
mysql -u root -p realmd < realmd.sql

ScriptDev2 Database

cd ~/mangos/server/src/bindings/ScriptDev2/sql
mysql -u root -p < scriptdev2_create_database.sql
mysql -u root -p scriptdev2 < scriptdev2_create_structure_mysql.sql
mysql -u root -p scriptdev2 < scriptdev2_script_full.sql

MaNGOS Database

cd ~/mangos/database
./make_full_db.sh
mysql -u root -p mangos < full_db.sql

Configuration files

Finally before running the server, you need to modify the .conf files in /opt/mangos-server/etc directory. First copy the mangosd.conf.dist, realmd.conf.dist and scriptdev2.conf.dist to just *.conf

cd /opt/mangos-server/etc
cp mangosd.conf.dist mangosd.conf
cp realmd.conf.dist realmd.conf
cp scriptdev2.conf.dist scriptdev2.conf

These files contain the information on how the server talks to the database, what ip and port your server runs on, and various other customizable game settings.

Here is the first few lines of my mangosd.conf file (of course with my password and actual domain removed). If you run your database on a seperate server, remember to change 127.0.0.1 to reflect the database server's correct IP address.

RealmID = 1
DataDir = "/opt/mangos-server/data"
LogsDir = "/opt/mangos-server/logs"
LoginDatabaseInfo     = "127.0.0.1;3306;mangos;PASSWORD;realmd"
WorldDatabaseInfo     = "127.0.0.1;3306;mangos;PASSWORD;mangos"
CharacterDatabaseInfo = "127.0.0.1;3306;mangos;PASSWORD;characters"
LoginDatabaseConnections = 1
WorldDatabaseConnections = 1
CharacterDatabaseConnections = 1
MaxPingTime = 30
WorldServerPort = 8085
BindIP = "mangos.YOURDOMAIN.com"

If you don't want your server to be seen from the outside world, you can just use the IP address in the BindIP variable. To get your sever seen from the outside, I modified my /etc/hosts file and added

192.168.0.2    mangos.YOURDOMAIN.com

You will also need to modify your DNS so your routable IP gets resolved to mangos.YOURDOMAIN.com as well. I just created a CNAME record for my mangos.XXXXXX.com

Server Logs

As you notice, I configure logging as it is helpful in troubleshooting. Create /opt/mangos-server/logs directory. Then set "LogsDir = "/opt/mangos-server/logs"" in your mangosd.conf and realmd.conf files.

Need to also modify your realmd database, realmlist table, address record. Unlike WotLK, this MUST be the IP address of the server.

Router config

If you want to share this server with the outside world you will need to forward TCP 8085 and TCP 3724 for mangosd and realmd, respectively to your server.

Client Configuration

Need to modify "World of Warcraft\\Data\\enUS\\realmlist.wtf" to point to your server.

set realmlist mangos.YOURDOMAIN.com
set patchlist mangos.YOURDOMAIN.com
set realmlistbn ""
set portal us

Also if you are using mangos.YOURDOMAIN.com in your .conf files, you either need to make sure your DNS has your server IP pointing to mangos.YOURDOMAIN.com or you can modify your C:\\Windows\\System32\\drivers\\etc\\hosts file to include the same line you put on your server's /etc/hosts file.

Remember to run Wow.exe and not Launcher.exe when starting the client. Running Launcher.exe will start a patch process and you do not what this to happen.

To update source code and database

cd ~/mangos/server
git pull
cd src/bindings/ScriptDev2
git pull
cd ~/mangos/database
git pull

Running the server using screen. Create the following two files and make them +x (chmod +x {filename}) and place them in /usr/local/bin

mangos-world

#!/bin/sh
cd /opt/mangos-server/bin
screen -A -m -d -S mangosworld ./mangosd

mangos-realm

#!/bin/sh
cd /opt/mangos-server/bin
screen -A -m -d -S mangosrealm ./realmd

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

My Debian install steps (need to be fixed by the professionals) :-)

cd /opt
git clone git://github.com/mangos/server -b master mangos
cd mangos/
mkdir src/bindings/ScriptDev2
git clone git://github.com/mangos-three/scriptdev2.git src/bindings/ScriptDev2
git apply src/bindings/ScriptDev2/patches/MaNGOS-11167-ScriptDev2.patch
cd /opt/mangos
mkdir build
cd build
cmake -DPREFIX=/opt/mangos -DPCH=1 -DACE_USE_EXTERNAL=1 ..
make -j5
make install
cd..
cp etc/mangosd.conf.dist etc/mangosd.conf
cp etc/realmd.conf.dist etc/realmd.conf
cp etc/scriptdev2.conf.dist etc/scriptdev2.conf
nano etc/mangosd.conf
nano etc/realmd.conf
nano etc/scriptdev2.conf
git clone git://github.com/mangos-three/database.git database
mysql -u root -padmin1 < /opt/mangos/sql/create_mysql.sql
mysql -u root -padmin1 < /opt/mangos/src/bindings/ScriptDev2/sql/scriptdev2_create_database.sql
mysql -u mangos -pmangos mangos < /opt/mangos/sql/mangos.sql
mysql -u mangos -pmangos characters < /opt/mangos/sql/characters.sql
mysql -u mangos -pmangos realmd < /opt/mangos/sql/realmd.sql
mysql -u mangos -pmangos scriptdev2 < /opt/mangos/src/bindings/ScriptDev2/sql/scriptdev2_create_structure_mysql.sql
mysql -u mangos -pmangos scriptdev2 < /opt/mangos/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql
mysql -u mangos -pmangos mangos < /opt/mangos/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql
cd database/
chmod +x make_full_db.sh
mysql -u root -padmin1 mangos < full_db.sql
./make_full_db.sh
mysql -u root -padmin1
   use realmd;
   UPDATE realmlist SET name = 'Your Realm Name' WHERE id = 1;
   UPDATE realmlist SET address = 'Your IP' WHERE id = 1;
   exit
copied ad.exe vmap_assembler and vmapextractor4 from  /opt/mangos/contrib/extractor_binary/ to my WoW folder
runned ad.exe
runned vmapextractor4.exe (lots of errors about not found blablabla) i need to download msvcr100d.dll and msvcp100d.dll from ddl-files.com to run vmapextractor4.exe
mkdir vmaps (in WoW folder)
runned vmap_assember Buildins vmaps
moved vmaps, dbc and maps to /opt/mangos/bin folder
mysql -u root -admin1
   use mangos;
   ALTER TABLE db_version CHANGE COLUMN required_0177_xxxxx_01_mangos_gameobject_template required_12112_14_mangos_command bit;

Link to comment
Share on other sites

sudo apt-get install build-essential gcc g++ automake git-core autoconf make patch libmysql++-dev mysql-server libtool libssl-dev grep binutils zlibc libc6 libbz2-dev cmake

gives me the following message:

The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.0.0 (= 1.0.1-4ubuntu3) but 1.0.1-4ubuntu5.3 is to be installed
             Recommends: libssl-doc but it is not going to be installed

Edit: nvm, fixed it

Link to comment
Share on other sites

Hello krampf! :)

I'm a user that is new to this mangos business.. but i found this guide working perfectly for me right up to the end of it.

Now.. to make it even more perfect, would it be possible for you (krampf) to finalize it by adding "building the database etc, etc"... well, all you need to make it "turn-key" ready??

It would help alot to a "NooB" like me. and perhaps (hopefully) a bunch of other people!

With best regards Donnarien!

Ps: If this post doesen't fit here, then move it, erase it or what ever.. and let me know. Ds :)

2012-09-10: BIG Thanks krampf, good work.. keep it up! :)

editor's note: It is not necessary to quote krampf's entire tutorial in your post. If you must quote, please use only those specific parts upon which you have a comment or question.

2012-09-19-To editor: Ok, got it!

Link to comment
Share on other sites

from /root/core/cataclism/server/src/bindings/ScriptDev2/base/escort_ai.cpp:12:

/root/core/cataclism/server/src/game/ObjectGuid.h:127: error: integer constant is too large for âlongâ type

make[2]: *** [src/bindings/ScriptDev2/CMakeFiles/mangosscript.dir/include/precompiled.cpp.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[2]: *** [src/bindings/ScriptDev2/CMakeFiles/mangosscript.dir/include/sc_creature.cpp.o] Error 1

make[2]: *** [src/bindings/ScriptDev2/CMakeFiles/mangosscript.dir/include/sc_instance.cpp.o] Error 1

make[2]: *** [src/bindings/ScriptDev2/CMakeFiles/mangosscript.dir/include/sc_grid_searchers.cpp.o] Error 1

make[2]: *** [src/bindings/ScriptDev2/CMakeFiles/mangosscript.dir/base/escort_ai.cpp.o] Error 1

make[2]: *** [src/bindings/ScriptDev2/CMakeFiles/mangosscript.dir/ScriptMgr.cpp.o] Error 1

make[1]: *** [src/bindings/ScriptDev2/CMakeFiles/mangosscript.dir/all] Error 2

make: *** [all] Error 2

Link to comment
Share on other sites

sounds like your version of scriptdev2 doesnt match the version of mangos you are building, see this post to get the correct version:-

http://getmangos.eu/bb/topic/206/mangos-sourceproject-list/

i compiled this tutorial

mkdir mangos

cd mangos

git clone git://github.com/mangos/server.git

cd server

git clone git://github.com/mangos/scripts.git src/bindings/ScriptDev2

git apply src/bindings/ScriptDev2/patches/MaNGOS-*-ScriptDev2.patch

Link to comment
Share on other sites

what is
git apply src/bindings/ScriptDev2/patches/MaNGOS-*-ScriptDev2.patch

for ?

as far as I know, its normally enough to grab the latest versions or Mangos and scriptdev2 and go.

In fact, I can't say i've ever had to patch it like that

I have done as you wrote in this tutorial+

"Grabbing the source code of MaNGOS and ScriptDev2 and patch. I create a directory called mangos rather than dumping it in your home directory.

mkdir mangos

cd mangos

git clone git://github.com/mangos/server.git

cd server

git clone git://github.com/mangos/scripts.git src/bindings/ScriptDev2

git apply src/bindings/ScriptDev2/patches/MaNGOS-*-ScriptDev2.patch

"

Link to comment
Share on other sites

I would do it like this....

mkdir mangos
cd mangos
git clone git://github.com/mangos/server.git
cd server
git clone git://github.com/mangos/scripts.git src/bindings/ScriptDev2

I would not do this bit...

git apply src/bindings/ScriptDev2/patches/MaNGOS-*-ScriptDev2.patch

Link to comment
Share on other sites

Hello krampf.

First of all, sorry for my broken english ;o). I want to thank you for the post. I'm new in Mangos and i think it is very interesting. I tried to compile the project on my ubuntu and i followed all passes of the post but i have a problem, when i extract the dbc, maps and vmaps and run the mangosd it say at the end:

"... VMap file '/opt/mangos-server/data/vmaps/000.vmtree' is missing or point to wrong version vmap file ..."

I think the version of maps i have extract are not the same of the server. The version i have extract is 4.3.4 build 15595. How can i know the version of the server? Am I doing something wrong when extracting the maps? Can anyone help me? :o)

At the end, thanks to the people who maintain the project. Good job guys.

Link to comment
Share on other sites

Hello krampf.

First of all, sorry for my broken english ;o). I want to thank you for the post. I'm new in Mangos and i think it is very interesting. I tried to compile the project on my ubuntu and i followed all passes of the post but i have a problem, when i extract the dbc, maps and vmaps and run the mangosd it say at the end:

"... VMap file '/opt/mangos-server/data/vmaps/000.vmtree' is missing or point to wrong version vmap file ..."

I think the version of maps i have extract are not the same of the server. The version i have extract is 4.3.4 build 15595. How can i know the version of the server? Am I doing something wrong when extracting the maps? Can anyone help me? :o)

At the end, thanks to the people who maintain the project. Good job guys.

There are several versions of Mangos for each of the main versions of wow.

You need the Cataclysm version, please see this post for the latest url:-

http://getmangos.eu/bb/topic/206/mangos-sourceproject-list/

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

never tried any mangos befor, thank you for this tutorial.

I am trying to install classic version using this tutorial, but having this error:

cmake .. -DPREFIX=/opt/mangos-server

-- The C compiler identification is GNU

-- The CXX compiler identification is GNU

-- Check for working C compiler: /usr/bin/gcc

-- Check for working C compiler: /usr/bin/gcc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Detected 32-bit platform.

-- Found Git: /usr/bin/git

This script builds the MaNGOS server.

Options that can be used in order to configure the process:

PREFIX: Path where the server should be installed to

PCH: Use precompiled headers

DEBUG: Debug mode

To set an option simply type -D<OPTION>=<VALUE> after 'cmake <srcs>'.

For example: cmake .. -DDEBUG=1 -DPREFIX=/opt/mangos

-- Using mysql-config: /usr/bin/mysql_config

-- Found MySQL library: /usr/lib/i386-linux-gnu/libmysqlclient_r.so

-- Found MySQL headers: /usr/include/mysql

-- Found OpenSSL library: /usr/lib/i386-linux-gnu/libssl.so

-- Found OpenSSL headers: /usr/include/openssl

-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.3.4")

MaNGOS-Core revision : ff183f617d88ac1bcb7795a50430da464c011a13

Install server to : /opt/mangos-server

Use PCH : No

Build in debug-mode : No (default)

CMake Error at src/bindings/CMakeLists.txt:19 (add_subdirectory):

add_subdirectory given source "scripts" which is not an existing directory.

-- Configuring incomplete, errors occurred!

Also, while trying patch command, encountered first error:

git apply src/bindings/ScriptDev2/patches/MaNGOSZero-ScriptDevZero.patch

error: patch failed: src/bindings/CMakeLists.txt:16

error: src/bindings/CMakeLists.txt: patch does not apply

Any help is welcomed!

Thank you!!!

Link to comment
Share on other sites

CMake Error at src/bindings/CMakeLists.txt:19 (add_subdirectory):

add_subdirectory given source "scripts" which is not an existing directory.

cmake is telling you it expects to find a directory named "scripts" (which is where scriptdev0 scripts are located) but did not find it. If you want to use scripts, you must clone git://github.com/mangos-zero/scriptdev0.git into src/bindings/scripts

Also, while trying patch command, encountered first error:

git apply src/bindings/ScriptDev2/patches/MaNGOSZero-ScriptDevZero.patch

error: patch failed: src/bindings/CMakeLists.txt:16

error: src/bindings/CMakeLists.txt: patch does not apply

I don't know very much about building for Linux as I use Mac OS X, but this error looks the same to me: git is expecting to find the scripts directory in order to patch it, but the directory is not here.

My advice is the same : try cloning scriptdev0 at the right place.

Also, you'll have to change your patch command for this one:

git apply src/bindings/scripts/patches/MaNGOSZero-ScriptDevZero.patch

Link to comment
Share on other sites

So instead of

git clone git://github.com/mangos-zero/scriptdev0.git src/bindings/ScriptDev2

I should do

git clone git://github.com/mangos-zero/scriptdev0.git src/bindings/scripts

And then apply patch as you suggested.

I will try it tonight.

Thank you!

Link to comment
Share on other sites

Remember that git keeps all info about a repository locally on disk, so now that you've cloned it in ScriptDev2, you can just rename that folder and you should be fine :)

As an alternative, you can edit the CMakeLists.txt file in src/bindings too. You'll see something like add_subdirectory. Change the directory to what you have now and you should be fine too.

Link to comment
Share on other sites

Everything worked well until I tried to connect to server. Connection works, but I was unable to connect to realm.

After a bit looking around i figured out. For some strange reason, all databases in zero are named differently.

Any idea how to easy fix this?

Link to comment
Share on other sites

Update: used config file to connect to correct databases (not sure if I am missing anything this way)

So my config file looks like this: (with correct user/password)

RealmID = 1
DataDir = "/opt/mangos-server/data"
LogsDir = "/opt/mangos-server/logs"
LoginDatabaseInfo     = "127.0.0.1;3306;mangos;mangos;zp_realm"
WorldDatabaseInfo     = "127.0.0.1;3306;mangos;mangos;zp_world"
CharacterDatabaseInfo = "127.0.0.1;3306;mangos;mangos;zp_characters"

On my client I see Mangos realm, but I can't connect to it from log in screen.

Another thing that I noticed when I run server info in mango console:

CLI command under processing...
[0 ms] SQL: SELECT name,security,help FROM command
Table `command` overwrite for command 'modify honor' default security (1) by 2
MaNGOS Zero/ (* * Revision 1842 - *) for Linux_x32 (little-endian)
Using script library: <No Script Library Loaded>
Using World DB: mangos-zero database version 1.1.0 (development) / "Hidden Treasures"
Using creature EventAI: mangos-zero Artificial Creature Intelligence Database based on ACID 1.0.2
Online players: 0 (max: 0) Queued players: 0 (max: 0)

I am not sure why script library shows no script lib loaded.

Link to comment
Share on other sites

Never mind, I figured it out.

Problem is with mangos zero and databases, they have all different names.

Reason I could not connect to realm was that I was using wrong realm db.

Still kind of lost about those scripts, don't have executable to start them. Could not get that patch (apply) part to complete.

Any ideas?

Link to comment
Share on other sites

  • 3 weeks later...
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use