Skip to content

Build from source

Drathian edited this page May 21, 2021 · 51 revisions

Build from source

Preferred IDE (optional): Visual Studio Code with rust-analyzer extension

Build server

On the repository root execute:

cargo xtask build-server --release

ALVR server will be built into /build/alvr_server_windows.

New dashboard experimental build

Install npm.

cargo install wasm-pack
cargo xtask build-server --release --new-dashboard

To debug cd into alvr/dashboard, run npm start and open localhost:8080 in the browser. The ALVR server must be running for the dashboard to load.

Build client

  • Install rustup
  • Install LLVM
  • Latest version of Android Studio, SDK level 30, NDK v22
  • Environment variable JAVA_HOME set to C:\Program Files\Android\Android Studio\jre
  • Environment variable ANDROID_SDK_ROOT set to %LOCALAPPDATA%\Android\Sdk
  • For building Android dependencies (optional): Python

On the repository root execute:

cargo xtask build-android-deps
cargo xtask build-client --release

ALVR client APKs will be built as /build/alvr_client_*.apk.

Note: You can debug the client normally by opening the Android Studio project at alvr/client/android.

Note: If you have problems running build-android-deps:

  • Go to the nightly CI runs list
  • Open the latest workflow run
  • Download the artifact android-deps
  • Create a deps folder on the project root
  • Unzip android-deps.zip inside the deps folder. You should have the file deps/rust-android-gradle/runst-android-0.8.3.jar

Linux experimental build

Supported setups

  • AMD using radv is known to work, with hardware encoding
  • AMD using amdvlk does not work
  • NVIDIA using proprietary driver works, with software encoding
  • Intel is untested

Required dependencies

You need rustup and the following platform specific dependencies:

Ubuntu (20.04)

sudo apt install build-essential pkg-config libclang-dev libssl-dev libasound2-dev libgtk-3-dev libvulkan-dev libunwind-dev gcc-8 g++-8 yasm nasm

Gentoo

  • media-video/ffmpeg >= 4.4 [encode vulkan vaapi]
  • sys-libs/libunwind
  • dev-lang/rust >= 1.51

Nix(OS)

Use the shell.nix in alvr/xtask.

Build command

cargo xtask build-server --release

Or, if the ffmpeg package provided by your distribution does not have vulkan support enabled (such as Ubuntu)

cargo xtask build-server --release --bundle-ffmpeg

Troubleshooting

Steam Native on some distro's runs this a little better. To get Steam Native on Ubuntu run it with:

env STEAM_RUNTIME=0 steam

Dependencies might be missing then, so run:

$ cd ~/.steam/root/ubuntu12_32
$ file * | grep ELF | cut -d: -f1 | LD_LIBRARY_PATH=. xargs ldd | grep 'not found' | sort | uniq