-
Notifications
You must be signed in to change notification settings - Fork 10
How to Compile libxayagame in Ubuntu
This will help you to compile libxayagame
in Ubuntu so you can use it in other tutorials and in your own games.
Most dependencies can simply be installed, but some you will need to build and install from source.
You can optionally download the install-libxayagame.sh script and run it. It runs the same commands as below, but will prompt you to continue at each new stage.
The following build instructions assume a fresh installation of Ubuntu 20.04.3 LTS.
NOTE: For the most current information, refer to the libxayagame repository here:
https://github.com/xaya/libxayagame
sudo apt-get -y update
You can upgrade, but it's not required, and was not used for this build.
sudo apt-get upgrade
The following will install most dependencies for you. Some others must be built from source.
sudo apt-get -y install build-essential libargtable2-dev libzmq3-dev zlib1g-dev libsqlite3-dev liblmdb-dev libgoogle-glog-dev libgflags-dev libprotobuf-dev protobuf-compiler python3 python-protobuf autoconf autoconf-archive automake cmake git libtool pkg-config libcurl4-openssl-dev libssl-dev libmicrohttpd-dev make
The Bitcoin-Core libsecp256k1 library is an optimised C library for ECDSA signatures and secret/public key operations on curve secp256k1.
cd ~/
git clone https://github.com/bitcoin-core/secp256k1.git
cd secp256k1
./autogen.sh
./configure --disable-tests --disable-benchmark \
--enable-module-recovery
make
sudo make install
The Xaya Eth-Utils library is a small C++ library that implements basic building blocks for working with Ethereum from C++.
cd ~/
git clone https://github.com/xaya/eth-utils.git
cd eth-utils
./autogen.sh
./configure
make -j4
libxayagame requires JSONCPP v1.7.5 or higher, but only v1.7.4 is available to install via apt.
Further, the build process is somewhat odd, so make certain to follow the instructions below, or ensure that any changes you make don't break the libxayagame build process.
Specifically, v1.9.4 has a broken pkg-config file which must be specifically fixed. The following is currently a "hack" until a new version is released. You can refer to https://github.com/xaya/libxayagame/blob/ubuntu-build/Dockerfile for version updates.
cd ~/
mkdir jsoncpp && cd jsoncpp
git clone -b 1.9.4 https://github.com/open-source-parsers/jsoncpp .
git config user.email "[email protected]"
git config user.name "Cherry Picker"
git cherry-pick ac2870298ed5b5a96a688d9df07461b31f83e906
cmake . -DJSONCPP_WITH_PKGCONFIG_SUPPORT=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF
make -j4
sudo make install/strip
JSON-RPC-CPP must be built from source because the available packages are not fresh enough. Specifically, they must include commit 4f24acaf4c6737cd07d40a02edad0a56147e0713
.
cd ~/
git clone https://github.com/cinemast/libjson-rpc-cpp
cd libjson-rpc-cpp
cmake . -DREDIS_SERVER=NO -DREDIS_CLIENT=NO -DCOMPILE_TESTS=NO -DCOMPILE_EXAMPLES=NO -DWITH_COVERAGE=NO
make -j4
sudo make install/strip
googletest
must be built from source.
cd ~/
git clone https://github.com/google/googletest
cd googletest
cmake .
make -j4
sudo make install/strip
The following will install the ZMQ C++ bindings.
cd ~/
git clone -b v4.7.1 https://github.com/zeromq/cppzmq
cd cppzmq
sudo cp zmq.hpp /usr/local/include
The following is a clean-up step and will make our installed dependencies visible for when we build libxayagame.
sudo ldconfig
With the above accomplished, building and installing libxayagame is simple and straight forward.
cd ~/
git clone https://github.com/xaya/libxayagame.git
cd ~/libxayagame
./autogen.sh
./configure
make -j4
sudo make install
Similar to the clean-up step above, this does the same and will make libxayagame visible for when you write your GSP.
sudo ldconfig
Congratulations! You've just built and installed libxayagame. You can now proceed on to the Hello World in C++ tutorial where we'll put libxayagame to good use!
We update libxayagame periodically. If you wish to update your build, enter the following into a terminal.
cd ~/libxayagame
git pull
make clean
./autogen.sh
./configure
make -j4
sudo make install
sudo ldconfig
You're now up-to-date with the latest version!
NOTE: Should the update build break, refer to the libxayagame repository as it is always up-to-date:
https://github.com/xaya/libxayagame
You can also refer to the libxayagame Docker build file for further specifics:
https://github.com/xaya/libxayagame/blob/ubuntu-build/Dockerfile
- Step 0: Blockchain Basics
- Step 1: xayad <⸺ start here
- Step 2: The Game State Processor
- Step 3a: libxayagame Component Relationships
- Step 3b: Compile libxayagame in Windows
- Step 3b: Compile libxayagame in Ubuntu
- Step 4: Run xayad for Games
- Step 5: Hello World! in C++
- Step 5: Hello World! in C#
- Step 5: Hello World! with SQLite
- Step 6a: Mover Overview
- Step 6b: Mover Console
- Step 6c: Mover Unity
- libxayagame Component Relationships
- How to Compile libxayagame in Ubuntu 20.04.03
- How to Compile libxayagame in Ubuntu 22.04
- How to Compile libxayagame in Windows
- Xayaships (How to get started playing)