• 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 TFS 1.1 on Raspberry Pi or Debian 7

forgee

Veteran OT User
Joined
May 9, 2011
Messages
328
Solutions
18
Reaction score
286
Location
Sweden
GitHub
forgee
A few days ago I got curious as to whether it would be possible to run TFS on a Raspberry Pi (2). As it turns out it is, and since a few people showed some interest here I decided to share how I did it.

The usefulness of running TFS off a Raspberry Pi is admittedly limited. It might be viable for some testing but this is mostly meant as a fun experiment.
I used a Raspberry Pi 2 with 1 GB of RAM, but it would likely work on the older Model B/B+ devices too, although 256/512 MB of RAM would really be pushing it.

Note: Although this is written for Raspberry Pi it should work fine on any Debian 7 system. The only thing we really need to do is to install a newer version of gcc than the 4.6 that is found in the Debian 7 "wheezy" repositories.

You should have a SD card with Raspbian "wheezy" installed (Raspbian is a version of Debian 7 optimized for Raspberry Pi).
If you don't, then you first need to download and install it.
With Raspbian running you can follow these steps on the Pi with a keyboard and monitor connected, or through SSH. SSH should be enabled by default and the default username/password is pi/raspberry unless you changed it.

I will only cover building TFS 1.1 from source. To set up a fully working server follow the excellent tutorial by @dominique120.

With that out of the way, let's get started!
First make sure your system is up-to-date.
Code:
sudo apt-get update
sudo apt-get upgrade
Install the packages required to compile TFS.
Code:
sudo apt-get install git cmake build-essential liblua5.2-dev libgmp3-dev libmysqlclient-dev libboost-system-dev
We need to get gcc from the jessie repositories, so open sources.list and replace wheezy with jessie.
Code:
sudo nano /etc/apt/sources.list
Update package lists and install gcc 4.9.
Code:
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
Now change jessie back to wheezy in sources.list and update package lists again.
Code:
sudo nano /etc/apt/sources.list
sudo apt-get update
Now we are ready to compile, so grab the source and create the build directory as usual.
Code:
git clone https://github.com/otland/forgottenserver.git
cd forgottenserver
mkdir build && cd build
We tell cmake to use g++ 4.9 that we installed earlier as the c++ compiler, instead of the default 4.6. Then run make as usual.
Code:
cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.9
make
Take a break! This will take a while.

Now you're ready to move the executable and config.lua to your preferred location and drop in a datapack of your choice (when choosing a map, remember that you don't have a whole lot of RAM on a Raspberry Pi!).
Raspbian comes with SSH filetransfer enabled by default so you can use FileZilla or another SFTP/SSH filetransfer client to move the files. Remember to use SFTP/SSH (port 22), I don't know if it has FTP (port 21) installed by default but we might as well just use SFTP either way.
Or you can use the command line, for example:
Code:
mkdir /home/pi/tfs && mv /home/pi/forgottenserver/build/tfs /home/pi/tfs/tfs
cp /home/pi/forgottenserver/config.lua /home/pi/tfs/config.lua
cp -R /home/pi/forgottenserver/data /home/pi/tfs
Credits to @Mark for the GitHub Wiki compile guide that I used as a base.
If anyone feels that I used their work, just let me know and I'll add your credits.

Now, why run TFS on a Raspberry Pi? Because we can.
 
Because we can! Love it! Amazing tutorial, this is awesome makes me want to go drop the money on five raspberry pi's for the hell of it!
 
i got a problem. could you help me to fix it? Thanks in advance
7ECprlZch.jpg
 
solved adding: -lpthread -lm on cmakelist.txt; line 38

target_link_libraries(tfs ${MYSQL_CLIENT_LIBS} ${LUA_LIBRARIES} ${Boost_LIBRARIES} ${GMP_LIBRARIES} -lpthread -lm)
 
Please Help

g++-4.9: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
CMakeFiles/tfs.dir/build.make:119: recipe for target 'CMakeFiles/tfs.dir/src/ban.cpp.o' failed
make[2]: *** [CMakeFiles/tfs.dir/src/ban.cpp.o] Error 4
CMakeFiles/Makefile2:122: recipe for target 'CMakeFiles/tfs.dir/all' failed
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
 
Please Help
Looks like you might be running out of RAM.
Could you provide some more information? What system are you working with? Are you using a Rapberry Pi or a regular PC with Debian? How much RAM do you have?
You can run the command 'free -m' to see how much free RAM you have.

I don't know how much RAM is required, but it is possible that Raspberry Pi model A/B/B+ simply do not have enough.
I have tried this successfully on Raspberry Pi 2 with 1 GB RAM but that's really all I have to go on.
 
Wtf that guy is trying to compile on 16M memory

If I may, I suggest having a look on distcc cross-compiling, I've successfully ran Gentoo (the one that requires compiling every single package) with distributed compilation on a Raspberry, so much faster and easy as Pi.
 
I've been trying to update cmake without success, any tips?

1621mvm.jpg



Edit: I'm not sure I can get a newer verion than 2.8.9 on rpi. Is there still a link to get 1.1 sources instead of 1.2?

Another edit: It's been years I don't do anything on Linux. I manually installed cmake 2.8.12. Now I'm missing libpugixml-dev, which is required to compile (the github tutorial for compiling TFS in Linux says to install it, but apt-get isn't working). Gonna try to find a tar.gz
 
Last edited:
Which Linux distribution are you running?

I have compiled TFS 1.2 on Raspberry Pi 2 running Raspbian Jessie Lite without issue. Compiling TFS 1.1 on Raspbian Wheezy (Debian 7), the only thing I had to fiddle with was gcc.

I would suggest that you get the latest Raspbian as it is based on Debian 8 and has all the required packages available out of the box.
https://www.raspberrypi.org/downloads/raspbian/

You can get older TFS releases here.
https://github.com/otland/forgottenserver/releases
 
@forgee
I used jessie now
Code:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
And then I got the stuff I needed (libpugixml-dev), and it's compiled now :)
Thank you very much, I'll test the server today.
 
@forgee
I used jessie now
Code:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
And then I got the stuff I needed (libpugixml-dev), and it's compiled now :)
Thank you very much, I'll test the server today.
confirmed
 
Back
Top