• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling [Linux] Ultimate compile guide for Debian (Ubuntu included)

elf

Sing, sing blue silver
Senator
Joined
Dec 11, 2007
Messages
3,666
Solutions
1
Reaction score
125
Location
Warsaw, Poland
GitHub
tayandenga
Twitch
tayandenga
I would like to note its my own guide, not copied from any other site, though, I gathered everything needed from many other tutorials- when compiling for the first time at my own server.
I want also to doubt success on other debian-like distributions just because I didn't test them, but it shouldn't fail.
It surely works, beause I can compile everything starting TFS 0.3 through otserv, so if it doesn't for You, then its probably only Your fault.
Okay, here it goes.

Pre. If you're using Ubuntu and you aren't logged on root user, do it by following command and type your password:
Code:
sudo su

1. On the begining, you need to update your packets database, then upgrade your operating system.
Code:
apt-get update
Code:
apt-get upgrade
If update fails, you have to increase apt cache size. To do it, perform following actions:
Code:
cd /etc/apt
Code:
pico apt.conf
and paste there:
Code:
APT::Cache-Limit "125829120";
Now press F2 to close Nano and answer YES/NO to save the file.

2. Now you have to install some (maybe even alot of them :D) packets.
Code:
apt-get install libboost1.41-dev libboost-system1.41-dev libboost-filesystem1.41-dev libboost-date-time1.41-dev libboost-regex1.41-dev libboost-thread1.41-dev libgmp3-dev liblua5.1-0 liblua5.1-0-dev liblua50 liblua50-dev liblualib50 liblualib50-dev lua50 lua5.1 libsqlite0-dev libsqlite3-dev sqlite3 libmysql++-dev libmysqlclient-dev mysql-client-5.1 mysql-server-5.1 mysql-common libxml2-dev libxml++2.6-dev cpp gcc g++ make automake autoconf pkg-config subversion liblua5.1-sql-mysql-dev liblua5.1-sql-sqlite3-dev zlib1g-dev zlib1g libcrypto++-dev libcrypto++8
If your apt says some packages are missing, make sure you have set repositories in /etc/sources.list. After you fix things around (distribution-independent), perform again step 1.

3. Ok, you have installed everything required to compile- easy, huh? Now you may do 'the job'.
Here's an compilation example for TFS 0.3.5pl1:
Code:
svn co http://svn.otland.net/public/forgottenserver/tags/0.3.5pl1
Code:
mv 0.3.5pl1 source
Code:
mkdir forgottenserver
Code:
mv source forgottenserver
Code:
cd forgottenserver
Code:
./autogen.sh
Code:
./configure --enable-mysql --enable-sqlite --enable-remote-control --enable-server-diag
Code:
make

NOTE! If you are trying to compile TFS 0.2, please skip the step 6 (with autogen) and 7 (with configure) and finish with step 8 (just type make).

If you receive a linker error saying something with 'libboost', try pasting the following commands to terminal and then move back to compiling again:
Code:
cd ~
Code:
wget http://garr.dl.sourceforge.net/sourceforge/asio/boost_asio_1_0_0.tar.gz
Code:
tar -xzf boost_asio_1_0_0.tar.gz
Code:
cp -ar boost_asio_1_0_0/boost/* /usr/include/boost/
Code:
g++ boost_asio_1_0_0/libs/system/src/error_code.cpp -c -o /usr/lib/libboost_system.a
Code:
ln /usr/lib/libboost_date_time-mt.so /usr/lib/libboost_date_time.so
Code:
ln /usr/lib/libboost_date_time-mt.a /usr/lib/libboost_date_time.a
Code:
ln /usr/lib/libboost_filesystem-mt.so /usr/lib/libboost_filesystem.so
Code:
ln /usr/lib/libboost_filesystem-mt.a /usr/lib/libboost_filesystem.a
Code:
ln /usr/lib/libboost_regex-mt.so /usr/lib/libboost_regex.so
Code:
ln /usr/lib/libboost_regex-mt.a /usr/lib/libboost_regex.a
Code:
ln /usr/lib/libboost_thread-mt.so /usr/lib/libboost_thread.so
Code:
ln /usr/lib/libboost_thread-mt.a /usr/lib/libboost_thread.a
Code:
ldconfig
Code:
cd ~
Code:
rm -rf boost_asio_1_0_0

4. Congratulations! You've just compiled your engine. Yet you need to move files from 'source' directory...
Code:
mv data doc mods schemas config.lua forgottenserver.s3db theforgottenserver theforgottenserver.s3db ..
Now its up to run, you just have to configure it :)

NOTE! If you're trying to run 0.2, please use the following:
Code:
mv data doc config.lua forgottenserver.s3db forgottenserver.sql schema.sqlite forgottenserver ..
 
Last edited:
Why remove the source files? And, you don't have to use sudo anywhere if you are root or turn into.
 
Hmm... Updated :)
And about sudo - as far as I know (I doubt it, since I've only heard it), Ubuntu doesn't have a root user...
 
Last edited:
You cant use the gui manager to log in as root however if you are running Ubuntu Desktop Edition. And by default root isn't configured you have to go in and set a password for root.
 
Welcome
i can't compile TFS on Ubuntu 7.04
i do all how it is on this tutorial

My error:

root@h1315069:~/forgottenserver/forgottenserver/tags/0.2# make
rm -rf *.o
g++ -I. -I/usr/include/libxml2 -I/usr/include/lua5.1 -D__NO_HOMEDIR_CONF__ -D__USE_MYSQL__ -D__USE_SQLITE__ -Werror -O1 -c account.cpp
g++ -I. -I/usr/include/libxml2 -I/usr/include/lua5.1 -D__NO_HOMEDIR_CONF__ -D__USE_MYSQL__ -D__USE_SQLITE__ -Werror -O1 -c actions.cpp
g++ -I. -I/usr/include/libxml2 -I/usr/include/lua5.1 -D__NO_HOMEDIR_CONF__ -D__USE_MYSQL__ -D__USE_SQLITE__ -Werror -O1 -c admin.cpp
In file included from /usr/local/include/boost/asio/impl/io_service.ipp:25,
from /usr/local/include/boost/asio/io_service.hpp:517,
from /usr/local/include/boost/asio/basic_io_object.hpp:20,
from /usr/local/include/boost/asio/basic_socket.hpp:20,
from /usr/local/include/boost/asio/basic_datagram_socket.hpp:25,
from /usr/local/include/boost/asio.hpp:18,
from connection.h:25,
from admin.cpp:24:
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:29:59: error: boost/date_time/posix_time/posix_time_types.hpp: No such file or directory
/usr/local/include/boost/asio/detail/timer_queue_base.hpp:43: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/timer_queue_base.hpp:43: error: âtime_durationâ declared as a âvirtualâ field
/usr/local/include/boost/asio/detail/timer_queue_base.hpp:43: error: expected â;â before âwait_durationâ
/usr/local/include/boost/asio/detail/timer_queue.hpp:103: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/timer_queue.hpp:103: error: âtime_durationâ declared as a âvirtualâ field
/usr/local/include/boost/asio/detail/timer_queue.hpp:103: error: expected â;â before âwait_durationâ
/usr/local/include/boost/asio/detail/timer_queue.hpp:110: error: expected `;' before âvirtualâ
/usr/local/include/boost/asio/detail/epoll_reactor.hpp: In member function âint boost::asio::detail::epoll_reactor<Own_Thread>::get_timeout()â:
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:547: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:547: error: expected `;' before âminimum_wait_durationâ
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:552: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:552: error: expected `;' before âwait_durationâ
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:554: error: âwait_durationâ was not declared in this scope
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:554: error: âminimum_wait_durationâ was not declared in this scope
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:558: error: âminimum_wait_durationâ was not declared in this scope
/usr/local/include/boost/asio/detail/epoll_reactor.hpp:558: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/select_reactor.hpp: In member function âtimeval* boost::asio::detail::select_reactor<Own_Thread>::get_timeout(timeval&)â:
/usr/local/include/boost/asio/detail/select_reactor.hpp:374: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/select_reactor.hpp:374: error: expected `;' before âminimum_wait_durationâ
/usr/local/include/boost/asio/detail/select_reactor.hpp:379: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/select_reactor.hpp:379: error: expected `;' before âwait_durationâ
/usr/local/include/boost/asio/detail/select_reactor.hpp:381: error: âwait_durationâ was not declared in this scope
/usr/local/include/boost/asio/detail/select_reactor.hpp:381: error: âminimum_wait_durationâ was not declared in this scope
/usr/local/include/boost/asio/detail/select_reactor.hpp:385: error: âminimum_wait_durationâ was not declared in this scope
/usr/local/include/boost/asio/detail/select_reactor.hpp:385: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/time_traits.hpp: At global scope:
/usr/local/include/boost/asio/time_traits.hpp:35: error: âposix_timeâ is not a member of âboostâ
/usr/local/include/boost/asio/time_traits.hpp:35: error: âposix_timeâ is not a member of âboostâ
/usr/local/include/boost/asio/time_traits.hpp:35: error: template argument 1 is invalid
/usr/local/include/boost/asio/detail/deadline_timer_service.hpp: In member function âvoid boost::asio::detail::deadline_timer_service<Time_Traits, Timer_Scheduler>::wait(boost::asio::detail::deadline_timer_service<Time_Traits, Timer_Scheduler>::implementation_type&, boost::system::error_code&)â:
/usr/local/include/boost/asio/detail/deadline_timer_service.hpp:144: error: âboost::posix_timeâ has not been declared
/usr/local/include/boost/asio/detail/deadline_timer_service.hpp:144: error: expected `;' before âtimeoutâ
/usr/local/include/boost/asio/detail/deadline_timer_service.hpp:147: error: âtimeoutâ was not declared in this scope
/usr/local/include/boost/asio/deadline_timer.hpp: At global scope:
/usr/local/include/boost/asio/deadline_timer.hpp:32: error: âposix_timeâ is not a member of âboostâ
/usr/local/include/boost/asio/deadline_timer.hpp:32: error: âposix_timeâ is not a member of âboostâ
/usr/local/include/boost/asio/deadline_timer.hpp:32: error: template argument 1 is invalid
/usr/local/include/boost/asio/deadline_timer.hpp:32: error: template argument 2 is invalid
/usr/local/include/boost/asio/deadline_timer.hpp:32: error: template argument 3 is invalid
/usr/local/include/boost/asio/deadline_timer.hpp:32: error: invalid type in declaration before â;â token
make: *** [admin.o] Error 1


Sory for my english
 
/usr/bin/ld: cannot find -llua5.1-sql-sqlite
ye? ^^ tried to fix those one by one etc, but tbh, i have no clue what I'm doing. :D
 
On the first apt-get commands I got these errors:

Code:
E: Imposs?*vel achar pacote libboost-date-time1.34.1
E: Imposs?*vel achar pacote libboost-regex1.34.1
E: Imposs?*vel achar pacote libboost-signals1.34.1
E: Imposs?*vel achar pacote libboost-thread1.34.1

Translation:

Code:
E: Unable to find package libboost-date-time1.34.1
E: Unable to find package libboost-regex1.34.1
E: Unable to find package libboost-signals1.34.1
E: Unable to find package libboost-thread1.34.1
 
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
 
@up: Debian is a GNU/Linux distribution, it's far from Windows which I assume you're using.
 
/usr/bin/ld: cannot find -llua5.1-sql-sqlite
ye? ^^ tried to fix those one by one etc, but tbh, i have no clue what I'm doing. :D

I'm getting this error too when i compile
Someone knows the solution?
Thanks

Edit:
Resolved
 
Last edited:
I keep getting "virtual memory exhausted: Cannot allocate memory"

I've got a small VPS and when I get to ~/forgottenserver and run the make command it gets to game.o and stops and gives me the memory error. Am I screwed, or should I just try to reboot the VPS? What do you guys think?

Also - I'm using Ubuntu 8.04 And so far up until this point everything's been running smoothly, no problems :/


EDIT
Uninstalled Ubuntu, installed Debian. Same memory error.
 
Last edited:
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Probably you must type 'sudo' before command

When I tried download packages i got this bug:
Code:
root@keraxel-desktop:/home/keraxel# apt-get install libboost-date-time-dev libboost-date-time1.34.1 libboost-dev libboost-regex-dev libboost-regex1.34.1 libboost-signals-dev libboost-signals1.34.1 libboost-thread-dev libboost-thread1.34.1 libxml2 liblua5.1-0 liblua5.1-0-dev liblua50 liblua50-dev liblualib50 liblualib50-dev lua50 libsqlite0 libsqlite0-dev libsqlite3-0 libsqlite3-dev sqlite3 lua5.1 libmysql++-dev libgmp3-dev subversion make g++ libxml2-dev libxml++2.6-dev liblua5.1-sql-mysql-dev liblua5.1-sql-mysql-2 liblua5.1-sql-sqlite-dev liblua5.1-sql-sqlite2 libmysqlclient15-dev mysql-client-5.0 mysql-common mysql-server-5.0 gcc cpp
Czytanie list pakietów... Gotowe
Budowanie drzewa zależności       
Reading state information... Gotowe
libxml2 jest już w najnowszej wersji.
libsqlite3-0 jest już w najnowszej wersji.
make jest już w najnowszej wersji.
E: Nie udało się odnaleźć pakietu liblua5.1-sql-mysql-2
How to solve it?
 
Last edited:
Back
Top