-
-
Notifications
You must be signed in to change notification settings - Fork 220
Compiling on Ubuntu 20.04
First install required development packages using apt-get
sudo apt install -y build-essential cmake git # basic compiler libraries if needed
sudo apt install -y libasio-dev libphysfs-dev liblua5.1-dev libssl-dev
sudo apt install -y libglew-dev libvorbis-dev libopenal-dev zlib1g-dev
sudo apt install -y liblzma-dev nlohmann-json3-dev
and if you are using 18.04, you may also need sudo apt-get install -y libogg-dev
Protobuf from ubuntu's apt repository is outdated and will fail You'll require installing protobuf as well. To do so you have to compile it by youself.
First, get the source code:
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout v3.19.4 # or find latest stable version
git submodule update --init --recursive
./autogen.sh
To build:
./configure
make
make check
sudo make install
sudo ldconfig # refresh shared library cache.
If you find any problem during this process, you can find more information here.
Check your gcc version with
gcc -v
If it's not gcc-11, you have to install it:
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y gcc-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 6
sudo update-alternatives --config gcc # and then write down number for gcc-11
Verify gcc version:
gcc -v
Get the sources, compile and run
git clone git://github.com/mehah/otclient.git
cd otclient && mkdir build && cd build
cmake ..
make
If you have any error about missing libphysfs.a at the end of the make process, then do install physfs manually like this:
sudo apt install -y libncurses5-dev
git clone https://github.com/icculus/physfs.git
cd physfs; git checkout stable-3.0; mkdir build; cd build
cmake ..
make
sudo make install
- Try again. If the problem persist then do:
sudo mv /usr/local/lib/libphysfs.a /usr/lib/x86_64-linux-gnu/.
If you have any error about libvorbis.a at the end of the make process, then remove everything and run cmake
with these arguments:
cd build;
rm -fr *;
cmake .. -DVORBISFILE_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libvorbisfile.so -DVORBIS_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libvorbis.so
Make sure you did install protobuf from step 2.
If you still have any error when building *.pb.cc or *.pb.h files, maybe you'll need to regenerate those files.
cd src/framework/protobuf/proto/
./generate.sh
- Try compiling again.
Once the make process has finished correctly, you can just execute otclient
file inside the build folder.
./otclient
After any modification or git pull
, just execute make
again to recompile.
If there have been any cmake modifications, you might need to execute the cmake
command again too.
If you want to speed up the make process and you have multiple cores, you can use -j to build using multiple cores.
For example, to build using 8 cores:
make -j8