Skip to content

Latest commit

 

History

History
442 lines (322 loc) · 9.44 KB

BUILD_LINUX.md

File metadata and controls

442 lines (322 loc) · 9.44 KB

Build Linux

Last Updated on September 28, 2022

Please read the general build guide for information on dependencies required for all platforms. Only Linux specific instructions are found in this file. Check out the notes for other important information.

Ubuntu 20.04 Server guide | Ubuntu 18.04 guide | Arch guide


Ubuntu 20.04 Server Only

Steps for building server components on Ubuntu 20.04 server version (probably won't work as is on the desktop version, and is not enough to build the interface properly).

Install build tools, OpenGL and OpenSSL libraries.

sudo apt install cmake g++ zip libgl-dev libssl-dev

Install Qt 5.15.

sudo apt-add-repository ppa:beineri/opt-qt-5.15.2-focal
sudo apt update
sudo apt upgrade
sudo apt install qt515base qt515connectivity qt515declarative qt515imageformats qt515multimedia qt515tools qt515webengine qt515websockets qt515xmlpatterns qt515svg qt515script

Optionally expand the default volume to all available space. This is a quirk of default ubuntu server configuration, that may cause the build to run out of disk space.

sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

Clone the repository and move to project root.

git clone --recursive https://github.com/vircadia/vircadia
cd vircadia

Configure the build. This will download and install more dependencies using VCPKG in ~/vircadia-files.

mkdir build
cd build
export VIRCADIA_QT_PATH=/opt/qt515
cmake ..

Build the domain server and the assignment client (the -j option specifies the number of parallel processes to run).

make domain-server assignment-client -j2

Optionally build the ICE server.

make ice-server -j2

Ubuntu 18.04

This guide focuses on Ubuntu 18.04 only.

Ubuntu 18.04 Server only

Add the universe repository: (This is not enabled by default on the server edition.)

sudo add-apt-repository universe
sudo apt-get update

Install build tools

  • First update the repositories:
sudo apt-get update -y
sudo apt-get upgrade -y

Git

sudo apt-get install git -y

Verify Git was installed by running git --version.

g++

sudo apt-get install g++ -y

Verify g++ was installed by running g++ --version.

CMake

sudo apt-get install cmake -y

Verify CMake was installed by running cmake --version.

Install build dependencies

OpenSSL

sudo apt-get install libssl-dev

Verify OpenSSL was installed by running openssl version.

OpenGL

sudo apt-get install libgl1-mesa-dev -y

Verify OpenGL:

  • First install mesa-utils with the command sudo apt install mesa-utils -y.
  • Then run glxinfo | grep "OpenGL version".

Extra dependencies to compile Interface on a server

Install the following:

sudo apt-get -y install libpulse0 libnss3 libnspr4 libfontconfig1 libxcursor1 libxcomposite1 libxtst6 libxslt1.1

Misc dependencies:

sudo apt-get install libasound2 libxmu-dev libxi-dev freeglut3-dev libasound2-dev libjack0 libjack-dev libxrandr-dev libudev-dev libssl-dev zlib1g-dev

Python 3

Install Python 3 and required packages:

sudo apt-get install python python3 python3-distro

Node.js

Install Node.js as it is required to build the jsdoc documentation:

sudo apt-get install nodejs

Get code and checkout the branch you need

Clone this repository, including submodules:

git clone --recursive https://github.com/vircadia/vircadia.git

Then checkout the master branch with:

git checkout master

If you need a different branch, you can get a list of all tags with:

git fetch --tags
git tag

Using a custom Qt build

Qt binaries are only provided for Ubuntu. In order to build on other distributions, a Qt5 install needs to be provided by setting the VIRCADIA_QT_PATH environment variable to a directory containing a Qt install.

Using the system's Qt

The system's Qt can be used, if the development packages are installed, by setting the VIRCADIA_USE_SYSTEM_QT environment variable. The minimum recommended version is Qt 5.15.2, which is also the last version available in the Qt 5 branch. It is expected that Linux distributions will have Qt 5.15.2 available for a long time.

Compiling

Create the build directory:

cd vircadia
mkdir build
cd build

Prepare makefiles:

cmake ..

If cmake fails with a vcpkg error, then delete ~/vircadia-files/vcpkg/.

Vircadia Server

To compile the Domain server:

make domain-server assignment-client

Vircadia Interface

Note: For a server, it is not necessary to compile the Interface as it is a client used only for visiting the world.

To compile the Interface client:

make interface

The commands above will compile with a single thread. If you have enough memory, you can decrease your build time using the -j flag. Since most x64 CPUs support two threads per core, this works out to CPU_COUNT*2. As an example, if you have a 2 core machine, you could use:

make -j4 interface

Running the software

Domain server

Running Domain server:

./domain-server/domain-server

Assignment clients

Launch Assignment Clients:

./assignment-client/assignment-client -n 6

Interface

Running Interface:

./interface/interface

Go to "localhost" in the running Interface to visit your newly launched Domain server.


Arch Linux

Install build tools:

  • First update the system:
sudo pacman -Syu

Git

sudo pacman -S git

Verify Git was installed by running git --version.

GCC

sudo pacman -S gcc

Verify GCC was installed by running gcc --version.

CMake

sudo pacman -S cmake

Verify CMake was installed by running cmake --version.

Install build dependencies:

OpenSSL

sudo pacman -S openssl

Verify OpenSSL was installed by running openssl version.

OpenGL

sudo pacman -S mesa-demos

Verify OpenGL:

  • First install mesa-utils with the following command:
sudo pacman -S mesa-utils
  • Then run:
glxinfo | grep "OpenGL version"

Extra dependencies to compile Interface on a server

Install the following:

sudo pacman -S libpulse libnss_nis nspr fontconfig libxcursor libxcomposite libxtst libxslt

Misc dependencies:

sudo pacman -S libxmu libxi freeglut libxrandr zlib jack2

Python 3

Install Python 3 and required packages:

sudo pacman -S python python3 python-pip

Node.js

  • Install Node.js as it is required to build the jsdoc documentation:
sudo pacman -S nodejs

Make

sudo pacman -S make

Unzip

sudo pacman -S unzip

Get code and checkout the branch you need

Clone this repository, including submodules:

git clone --recursive https://github.com/vircadia/vircadia.git

Enter the repository folder:

cd vircadia

Then checkout the master branch with:

git checkout master

If you need a different branch, you can get a list of all tags with:

git fetch --tags
git tag

Install Qt5

sudo pacman -S qt5

Compiling

Create the build directory:

mkdir build
cd build

Define path to Qt:

export VIRCADIA_USE_SYSTEM_QT=1

Prepare makefiles:

cmake ..

Vircadia Server

To compile the Domain server:

make domain-server assignment-client

Vircadia Interface

Note: For a server, it is not necessary to compile the Interface as it is a client used only for visiting the world.

To compile the Interface client:

make interface

The commands above will compile with a single thread. If you have enough memory, you can decrease your build time using the -j flag. Since most x64 CPUs support two threads per core, this works out to CPU_COUNT*2. As an example, if you have a 2 core machine, you could use:

make -j4 interface

Running the software

Domain server

Running Domain server:

./domain-server/domain-server

Assignment clients

Running an Assignment client:

./assignment-client/assignment-client -n 6

Interface

Running the Interface:

./interface/interface

Go to "localhost" in the running Interface to visit your newly launched Domain server.

Notes

vcpkg

If your goal is to set up a development environment, it is desirable to set the directory that vcpkg builds into with the HIFI_VCPKG_BASE environment variable. For example, you might set HIFI_VCPKG_BASE to /home/$USER/vcpkg.

By default, vcpkg will build in the ~/vircadia-files/vcpkg/ directory.

Architecture support

If the build is intended to be packaged for distribution, the VIRCADIA_CPU_ARCHITECTURE CMake variable needs to be set to an architecture specific value. For example you can set it to -msse3. This will help ensure that the build can run on all reasonably modern CPUs.

By default, it is set to -march=native -mtune=native, which yields builds optimized for a particular machine, but these builds will not work on machines lacking same CPU instructions.

Setting VIRCADIA_CPU_ARCHITECTURE to an empty string will use the default compiler settings and yield maximum compatibility.