Jump to content
Eternal Lands Official Forums
Aislinn

Linux Compiling Guide

Recommended Posts

LINUX COMPILING

(assumes current updated libs, and installation of glew, make, cmake, boost, glm, git, and gdb)

 

Update January 2, 2020: Also please install the following libs for the sdl2 porting. Nothing else will change.

libsdl2-dev (sdl2 in Arch Linux)

libsdl2-net-dev (sdl2_net in Arch)

libsdl2-image-dev (sdl2_image in Arch)

 

Current Official Client

 

[sb@precision330 ~]$ git clone git://github.com/raduprv/Eternal-Lands.git
[sb@precision330 ~]$ cd Eternal-Lands
[sb@precision330 Eternal-Lands]$ make -f Makefile.linux
 

 

End result in your terminal should look something like this:

 CXX  engine/hardwarebuffer.o
 LINK el.x86.linux.bin
[sb@precision330 Eternal-Lands]$ 
 

 

Pastebin file of everything as it spits out in my terminal:

http://pastebin.com/ZXumkk6z

 

 

Copy el.x86.linux.bin over into your el_linux directory.

If it is not executable already (which it should be), make it executable:

[sb@precision330 el_linux]$ chmod 755 el.x86.linux.bin
 

 

 

 

Opengl2 Testing Client

 

[sb@precision330 ~]$ git clone git://github.com/xaphier/Eternal-Lands.git
[sb@precision330 ~]$ cd Eternal-Lands
[sb@precision330 Eternal-Lands]$ cmake ./
[sb@precision330 Eternal-Lands]$ make
 

 

End result in your terminal should look something like this:

Linking CXX executable el_client
[100%] Built target el_client
[sb@precision330 Eternal-Lands]$
 

 

<No pastebin file currently as I can get the client to compile but it's not working right so I don't want to post something not working well.>

 

 

Copy el_client over into your el_linux directory.

If it is not executable already (which it should be), make it executable:

[sb@precision330 el_linux]$ chmod 755 el_client
 

Copy shaders directory to /path/to/el_linux/shaders (this only applies for the opengl2 test client)

 

 

Additional tricks:

 

If you need to run or are asked to run your client with dbg (debugging tool), here's how to:

[sb@precision330 ~]$ cd el_linux

[sb@precision330 el_linux]$ gdb el_client

<gdb info spits out at you here and when it finishes type run after it says (gdb)>

(gdb) run

<stuff spits out here too and when it finishes, type bt full after it says (gdb)>

(gdb) bt full

<more stuff spits out>

 

If you want to connect the client to the test server, you can do a

(gdb) run test

 

 

Important Notes:

1. Notice the two different github addresses you are pulling from (one raduprv and one xaphier) distinguishing which is current client and which is opengl2.

 

2. However, notice both get dumped into a directory called Eternal-Lands. This is the default but this is not good. If you are compiling BOTH versions, you need to keep them separated. To do this, you can set an extra parameter in your gitclone command to create better named directories like these:

[sb@precision330 ~]$ git clone git://github.com/raduprv/Eternal-Lands.git EL-official
 

and

 

[sb@precision330 ~]$ git clone git://github.com/xaphier/Eternal-Lands.git opengl2-client
 

 

That way, your files will go to the newly created EL-official and opengl2-client directories rather than an Eternal-Lands directory. (You can choose for yourself what you want to name these directories.) Then the next time you need to update, you just $cd into the directories you created and you can just compile or gitpull from there.

 

3. If you already have a version of the code from github, you can update it (versus deleting it and starting over as above) by running:

[sb@precision330 ~]$ cd EL-official
[sb@precision330 EL-official]$ git pull
 

(instead of the whole $ git clone git://github.com/.../Eternal-Lands.git)

 

As always, many thanks to Sir_Odie and bluap for their help and patience.

Edited by Aislinn
Updated for sdl2 porting

Share this post


Link to post
Share on other sites

For the Ubuntu distributions you need to install a few packages before fetching the code and building it. This procedure has been tested on a clean live-cd version of Ubuntu 11.10. First open the software-sources application and make sure the line "Community-maintained Open Source Software (Universe)" is ticked. Then install the required packages (several additional packages will get included as dependencies).

 

For the current official client.

[paul@hagrid ~]$ sudo apt-get update
[paul@hagrid ~]$ sudo apt-get install build-essential git libcal3d12-dev libsdl-image1.2-dev libsdl-net1.2-dev libxml2-dev libopenal-dev libvorbis-dev

For the Opengl2 testing client, in addition to those above.

[paul@hagrid ~]$ sudo apt-get install cmake libboost-dev libfreetype6-dev libglew1.6-dev libglm-dev

Edited by bluap
libfontconfig1-dev nolonger needed

Share this post


Link to post
Share on other sites

[paul@hagrid ~]$ sudo apt-get install cmake libboost-dev libfreetype6-dev libglew1.6-dev libglm-dev libfontconfig1-dev

 

The packages libglew1.6-dev and libglm-dev are not available in Natty (11.04).

Share this post


Link to post
Share on other sites

The packages libglew1.6-dev and libglm-dev are not available in Natty (11.04).

Nope, afraid not. I'm using Lucid so I appreciate the problem. You can download glew here and glm here. You need to build the glew from source, glm is just headers. At the cmake configuration stage of the build point at your local version of the libraries. I have a build directory, the el source and the local libraries all in the same directory so my cmake line is:

cmake -D GLM_INCLUDE_DIR=../glm-0.9.2.7 -D GLEW_INCLUDE_PATH=../glew-1.6.0/include -D GLEW_LIBRARY=../glew-1.6.0/lib/libGLEW.a ../elc

Edited by bluap
link to static glew library

Share this post


Link to post
Share on other sites

The most recent client to compile is now working with the SDL2.  Linux compiling instructions remain the same,  with the addition of these libraries that must be installed before compiling:

libsdl2-dev (sdl2 in Arch Linux)

libsdl2-net-dev (sdl2_net in Arch)

libsdl2-image-dev (sdl2_image in Arch)

**Other distros may have even different names but you can see the gist of what you are looking for here.

 

Please see this thread:

 

 

Share this post


Link to post
Share on other sites

Hi guys,

 

A few days ago, after pulling from github master branch, I was no longer able to compile... apparently a json lib for c++ (https://github.com/nlohmann/json) is now being used... and the compilation complained about not finding a nlohman/json.hpp to include on my OS. Some ppl might experience the same issue, so here's how I solved it...

 

1- clone nlhoman/json project...

git clone https://github.com/nlohmann/json.git

 

2- run cmake, make and make install

cd json
cmake .
make
sudo make install

Alternatively, I believe you could just copy the file single_include/nlohmann/json.hpp to /usr/local/include/nlohmann... All make seems to do is build unit test executables, which you won't need!

 

3- Lastly, the usage of this lib will require files to be compiled with c++11 support, or you'll get a lot of syntax errors during compilation. To do this, edit your Makefile.linux, find the line where the CXXFLAGS variable is defined and add the -std=c++11 option to it.

CXXFLAGS=$(PLATFORM) $(CXXWARN) -O0 -ggdb -pipe $(OPTIONS) -fno-strict-aliasing -std=c++11 $(EXTRA_INCLUDES)

Done... make -f Makefile.linux should now be able to compile the client again.

I hope that helps

Edited by RuiDo

Share this post


Link to post
Share on other sites

You might first want to check your favourite package manager if you are running Linux...

 

OpenSuse Leap 15.1 has the package "nlohmann_json-devel", which is all you need

(it's a header-only library according to the github readme).

 

Alternatively, you can use one of the github releases from the lohmann github pages.

Imo, this is preferable to just grabbing the header from current github master, as a release is supposedly stable and tested,

(the version in master can be temporarily broken, you are dealing there with an active project under modification).

 

Once that is installed, the client download from github compiles w/o further modifications (on my system, GCC 7)

Edited by revi
added link to github release for the json library

Share this post


Link to post
Share on other sites
Quote

You might first want to check your favourite package manager if you are running Linux...

OpenSuse Leap 15.1 has the package "nlohmann_json-devel", which is all you need

 

Sure, you should totally do that first :) Thanks for the reminder, revi

Sadly, it's not on my Mint19, and probably not in Ubuntu either (which is mint's "daddy" repo), unless it's under some other more generic name :-/

Share this post


Link to post
Share on other sites

Sorry for the inconvenience, I could have handle this change better.  Thanks for posting the information.  I'm replacing the various binary file formats used for user configuration files with JSON files (having got extremely fed up working around the fragile nature of dumping raw C structures) .  I'm using Ubuntu 20.04 and the package is included in the main repros as nlohmann-json3-dev.  It wasn't until later I realised the version in the current LTS is not recent enough but its relatively (extremely) easy to install from source so I didn't think it would be a blocker.

 

I should add, I don't get the errors you reported during compile either.  While I updated and tested Makefile.linux (clean build), I always use the cmake version now.

Edited by bluap

Share this post


Link to post
Share on other sites

The compile errors depend probably on the compiler version used.

Recent versions of GCC, at least since version 5, use C++11 (or higher) by default.

Such versions wouldn't need the  -std=c++11 option (of course...)

Then again, OpenSuse jumped from 4.96 to 7 as system compiler, skipping V5 and V6,

so the switch to C++11 in distributions can be more recent (iirc GCC 4.96 could deal with

most of C++11, but not all, so default was still C++03).

 

Share this post


Link to post
Share on other sites

Yeah, my gcc kinda old...

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)

 

I've haven't been compiling much C/C++ lately :-p

Share this post


Link to post
Share on other sites

This works on a fresh Ubuntu 16.04 install with

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609

I do not get any compiler warning or errors.

 

Set up packages:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt install build-essential git unzip cmake
sudo apt install libcal3d12-dev libsdl2-dev libsdl2-image-dev libsdl2-net-dev libsdl2-ttf-dev libxml2-dev libopenal-dev libvorbis-dev libpng16-dev

 

Download and build the client:

mkdir -p ~/basedir
cd ~/basedir
git clone git://github.com/raduprv/Eternal-Lands.git
mkdir ~/basedir/build
cd ~/basedir/build
cmake ../Eternal-Lands/ -DLOCAL_NLOHMANN_JSON=On
make -j $(nproc)

Resulting in the client executable el.linux.bin

 

You can download the data, sound and music files from the releases on github:

https://github.com/raduprv/Eternal-Lands/releases

You may have to look to previous release assets depending on when the files were last changed.

 

Of course, use your preferred file locations.

Edited by bluap

Share this post


Link to post
Share on other sites

One build dependency is: nlohmann_json

 

May I ask where I can find up to date el game data files as zip please? I searched a bit but only found a shell script. Thank you

Edited by roman_gruber

Share this post


Link to post
Share on other sites
8 hours ago, roman_gruber said:

One build dependency is: nlohmann_json

 

May I ask where I can find up to date el game data files as zip please? I searched a bit but only found a shell script. Thank you

The nlohmann_json dependency is now included in the source but you now need to install the libsdl2-ttf-dev package.

The data files are includes as assets for github releases.

https://github.com/raduprv/Eternal-Lands/releases

You may have to look to previous release assets depending on when the files were last changed.

 

I've updated the previous post.

Edited by bluap

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×