diff --git a/build-additional-dependencies.md b/build-additional-dependencies.md index bf0619d83f82a506b2f3bcfb8935d4e3af5fe57b..da5f38a70a0d70262a2de7328fda53b0a4d189bb 100644 --- a/build-additional-dependencies.md +++ b/build-additional-dependencies.md @@ -8,177 +8,174 @@ layout: main ## Dependencies needed to build Monado's additional drivers -[checked on Fedora 38] +#### Preliminary notes: +These recipes have been checked on Ubuntu 22.04 LTS and Fedora 39. + +Using the commands listed below, packages are installed in ```/usr/local```. Fedora, by default, does not search libraries or package config files in ```/usr/local```. You could adapt /etc/ld.so.conf, or change the commands to install in ```/usr```, or, more simply, you can set two envvars in your ```.bashrc```: +```sh +export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig +``` ### For the OpenHMD driver - git clone https://github.com/OpenHMD/OpenHMD.git - cd OpenHMD - cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON - sudo ninja -C build install - sudo ln -s /usr/lib/pkgconfig/openhmd.pc /usr/lib64/pkgconfig +```sh +git clone https://github.com/OpenHMD/OpenHMD.git +cd OpenHMD +cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON +ninja -C build +sudo ninja -C build install +``` ### For the libsurvive driver Some other dependencies are needed. * On Debian/Ubuntu: - - sudo apt install liblapacke-dev libopenblas-dev - + ```sh + sudo apt install libopenblas-dev liblapacke-dev libopenvr-dev + ``` * On Fedora: - - sudo dnf install openblas-devel lapack-devel - -Then, libsurvice can be built and installed: - - git clone https://github.com/cntools/libsurvive.git - cd libsurvive - cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DOPENVR_INCLUDE_PATH=/home/degrande/Projects/VAirDraw/vairdraw-src/externals/openvr/headers - sudo ninja -C build install + ```sh + sudo dnf install openblas-devel lapack-devel openvr-devel + ``` + +Then, libsurvive can be built and installed: +```sh +git clone https://github.com/cntools/libsurvive.git +cd libsurvive +cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local +ninja -C build +sudo ninja -C build install +``` ### For the Realsense driver -* On Debian/Ubuntu: ```...``` -* On Fedora: ```dnf install librealsense-devel``` +* On Debian/Ubuntu: + ```sh +curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null +echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo `lsb_release -cs` main" | \ +sudo tee /etc/apt/sources.list.d/librealsense.list +sudo apt update +sudo apt install librealsense2-dkms +sudo apt install librealsense2-dev +``` +* On Fedora: + ```sh + sudo dnf install librealsense-devel + ``` ### For the DepthAI driver - git clone --recurse-submodules https://github.com/luxonis/depthai-core.git - cd depthai-core - cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON - sudo ninja -C build install +```sh +git clone --recurse-submodules https://github.com/luxonis/depthai-core.git +cd depthai-core +cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON +ninja -C build +sudo ninja -C build install +``` ### For SLAM tracking support, using Basalt Some other dependencies are needed. * On Debian/Ubuntu: - - ... - + ```sh + sudo apt install libtbb-dev libglew-dev libpng-dev liblz4-dev libbz2-dev libboost-dev libboost-regex-dev libboost-filesystem-dev libboost-date-time-dev libboost-program-options-dev libboost-serialization-dev libgtest-dev libfmt-dev libuvc-dev + ``` * On Fedora: + ```sh + sudo dnf install tbb-devel glew-devel libpng-devel lz4-devel bzip2-devel boost-devel boost-regex boost-filesystem boost-date-time boost-program-options boost-serialization gtest-devel fmt-devel libuvc-devel + ``` - sudo dnf install tbb-devel glew-devel libpng-devel lz4-devel bzip2-devel boost-devel boost-regex boost-filesystem boost-date-time boost-program-options boost-serialization gtest-devel fmt-devel - -\ -**Basalt** uses Pangolin, which (in the included version) needs libuvc. On Debian/Ubuntu, it is packaged as ```libuvc-dev```, but it has to be built on Fedora: - - git clone https://github.com/libuvc/libuvc.git - cd libuvc - cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr - sudo ninja -C build install - -\ -**Note** Pangolin (in the included version) fails to compile with GCC 13, due to missing inclusions of ```<cstdint>``` (see https://www.gnu.org/software/gcc/gcc-13/porting_to.html, Header dependency changes). +Then, Basalt can be built and installed: +```sh +git clone --recurse-submodules https://gitlab.freedesktop.org/mateosss/basalt +cd basalt +cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local +ninja -C build +sudo ninja -C build install +``` - Add `#include <cstdint>` near the other inclusions in: - * thirdparty/Pangolin/src/image/image_io_jpg.cpp - * thirdparty/Pangolin/include/pangolin/log/packetstream_tags.h +If you get `fatal error: Killed signal terminated program cc1plus` during the compilation, it could be due to memory exhaustion if too many compilation jobs are running in parallel. Using `ninja -j 1 -C build` to run one single compilation job should solve that issue. -\ -Then, Basalt can be built and installed: +**_Note for Fedora_**: Pangolin (in the included version) fails to compile with GCC 13, due to missing inclusions of ```<cstdint>``` (see https://www.gnu.org/software/gcc/gcc-13/porting_to.html, Header dependency changes).\ +You need to add `#include <cstdint>` near the other inclusions in: - git clone --recurse-submodules https://gitlab.freedesktop.org/mateosss/basalt - cd basalt - cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr - sudo ninja -C build install - sudo ln -s /usr/lib/pkgconfig/basalt.pc /usr/lib64/pkgconfig +* `thirdparty/Pangolin/src/image/image_io_jpg.cpp` +* `thirdparty/Pangolin/include/pangolin/log/packetstream_tags.h` ### For 'Mercury' Hand Tracking, using the ONNX Runtime +**_Note for Ubuntu_**: ONNXRuntime needs a recent `cmake` (at least version 3.26), which is not available on Ubuntu 22.04. If you want to use the handtracking driver, then you'll have to update `cmake` using the Kitware's APT repository: +```sh +wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null +echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null +sudo apt update +sudo apt upgrade cmake +``` + Some other dependencies are needed. * On Debian/Ubuntu: - - ... - + ```sh + sudo apt install libgmock-dev + ``` * On Fedora: + ```sh + sudo dnf install gmock-devel + ``` - sudo dnf install gmock-devel patch - -\ Then, onnxruntime can be built and installed: +```sh +git clone --recurse-submodules https://github.com/Microsoft/onnxruntime.git +cd onnxruntime +./build.sh --config Release --build_shared_lib --parallel --skip_tests --compile_no_warning_as_error --cmake_extra_defines CMAKE_INSTALL_PREFIX=/usr/local --cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF +cd build/Linux/Release +sudo make install +``` - git clone --recurse-submodules https://github.com/Microsoft/onnxruntime.git - cd onnxruntime - ./build.sh --config Release --build_shared_lib --parallel --skip_tests --compile_no_warning_as_error --cmake_extra_defines CMAKE_INSTALL_PREFIX=/usr --cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF - cd build/Linux/Release - sudo make install - -\ -**Note** FlatBuffers fails to compile with GCC 13. A patch is to be applied to ignore a compilation warning (turned into an error). Once `onxxruntime.git` is cloned and before to run `./build.sh ...`, two modifications are needed: - -1. Create a file named onnxruntime/cmake/patches/flatbuffers/flatbuffers_cmake.patch, with the following content: - - diff --git a/CMakeLists.txt b/CMakeLists.txt - index 3987eac..5e5462f 100644 - --- a/CMakeLists.txt - +++ b/CMakeLists.txt - @@ -223,7 +223,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX) - "${CMAKE_CXX_FLAGS} -std=c++0x") - endif(CYGWIN) - set(CMAKE_CXX_FLAGS - - "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow") - + "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow -Wno-error=stringop-overflow") - set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4) - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) - -1. Edit the file onnxruntime/cmake/external/onnxruntime_external_deps.cmake to change: - - #flatbuffers 1.11.0 does not have flatbuffers::IsOutRange, therefore we require 1.12.0+ - FetchContent_Declare( - flatbuffers - URL ${DEP_URL_flatbuffers} - URL_HASH SHA1=${DEP_SHA1_flatbuffers} - FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES Flatbuffers - ) - - into: - - #flatbuffers 1.11.0 does not have flatbuffers::IsOutRange, therefore we require 1.12.0+ - FetchContent_Declare( - flatbuffers - URL ${DEP_URL_flatbuffers} - URL_HASH SHA1=${DEP_SHA1_flatbuffers} - PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/flatbuffers/flatbuffers_cmake.patch - FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES Flatbuffers - ) - -Then, you can proceed with the compilation (`./build.sh ....`). - -### For the UltraLeap driver - -Get the latest Linux version from https://www2.leapmotion.com/v2-developer-beta-linux. \ -Then (adapt the names to the downloaded version number): - - tar -xzf Leap_Motion_SDK_Linux_2.3.1.tgz - cd LeapDeveloperKit_2.3.1+31549_linux/LeapSDK - sudo cp include/Leap.h /usr/include - sudo cp include/LeapMath.h /usr/include - sudo cp lib/x64/libLeap.so /usr/lib64 +### For the UltraLeap v5 driver +* On Debian/Ubuntu: + ```sh + wget -qO - https://repo.ultraleap.com/keys/apt/gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/ultraleap.gpg > /dev/null + echo 'deb [arch=amd64] https://repo.ultraleap.com/apt stable main' | sudo tee /etc/apt/sources.list.d/ultraleap.list > /dev/null + sudo apt update + sudo apt install ultraleap-hand-tracking + ``` + +* On Fedora: + + The Ultraleap v5 driver is not available for Fedora. ### To use Tracy as a tracing backend Some other dependencies are needed. * On Debian/Ubuntu: - - ... + ```sh + sudo apt install libglfw3-dev libfreetype-dev libcapstone-dev libdbus-1-dev + ``` * On Fedora: + ```sh + sudo dnf install glfw-devel freetype-devel capstone-devel dbus-devel + ``` + +Then, tracy can be built: - sudo dnf install glfw-devel freetype-devel capstone-devel dbus-devel +**Note**: Currently (as of 03/21/2024), Monado uses the Tracy protocol version 63 (see ```src/external/tracy/common/TracyProtocol.hpp```), which needs Tracy version 0.9.0 or 0.9.1 -\ -Then, tracy can be built and installed: +```sh +git clone https://github.com/wolfpld/tracy.git +cd tracy +git checkout v0.9.1 +cd profiler/build/unix +make LEGACY=1 +``` - git clone git clone https://github.com/wolfpld/tracy.git - cd tracy - cd profiler/build/unix - sudo make LEGACY=1 +This produces Tracy-release which can be copied in ```/usr/local/bin/``` for instance. **Note**: Monado needs to be built with tracing support: diff --git a/getting-started.md b/getting-started.md index 26a4f3eb2d0d33937bb34ee96929704529640b25..9c61fc53957205ac1150fddad9f0c132a6d7cc71 100644 --- a/getting-started.md +++ b/getting-started.md @@ -71,35 +71,36 @@ Other useful packages: ### Installation from Source -Install the CMake and ninja build tools +Install the needed development and build tools. * On Debian/Ubuntu, use: - apt install cmake ninja-build + apt install build-essential git wget unzip curl patch pkg-config cmake ninja-build python3 ca-certificates * On Fedora, use: - dnf group install "C Development Tools and Libraries + dnf group install "C Development Tools and Libraries" dnf install cmake ninja-build See [https://gitlab.freedesktop.org/monado/monado#getting-started](https://gitlab.freedesktop.org/monado/monado#getting-started) for a list of dependencies. -The next command will install required and some optional dependencies that will enable most of the commonly used functionality of monado. +The next command will install required and some optional dependencies that will enable most of the commonly used functionality of Monado. Some features and drivers are only compiled with [additional dependencies]({% link build-additional-dependencies.md %}) like libsurvive or librealsense. * On Debian/Ubuntu, use: - apt install build-essential git wget unzip cmake ninja-build libeigen3-dev curl patch python3 pkg-config libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev ca-certificates libusb-1.0-0-dev libudev-dev libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev libbsd-dev + apt install libeigen3-dev libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev libegl1-mesa-dev libusb-1.0-0-dev libsystemd-dev libudev-dev libhidapi-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libbsd-dev libbluetooth-dev libopenxr-loader1 libopenxr-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libwayland-dev wayland-protocols * On Fedora, use: - dnf install glslang eigen3-devel systemd-devel libbsd-devel vulkan-loader-devel libglvnd-devel mesa-libGL-devel mesa-libEGL-devel libusb1-devel libv4l-devel bluez-libs-devel libbsd-devel cjson-devel ffmpeg-devel gstreamer1-devel gstreamer1-plugins-base-devel hidapi-devel opencv-devel SDL2-devel wayland-devel wayland-protocols-devel libX11-devel libxcb-devel libXrandr-devel libv4l-devel libjpeg-turbo-devel + dnf install eigen3-devel libX11-devel libxcb-devel libXrandr-devel vulkan-loader-devel glslang libglvnd-devel mesa-libGL-devel mesa-libEGL-devel libusb1-devel systemd-devel hidapi-devel libv4l-devel opencv-devel cjson-devel SDL2-devel libbsd-devel bluez-libs-devel openxr openxr-devel ffmpeg-free-devel libjpeg-turbo-devel gstreamer1-devel gstreamer1-plugins-base-devel wayland-devel wayland-protocols-devel -Then compile and install Monado. Monado can be built with either cmake or meson. +Then compile and install Monado. Monado is built with CMake. git clone https://gitlab.freedesktop.org/monado/monado.git cmake -G Ninja -S monado -B build -DCMAKE_INSTALL_PREFIX=/usr - ninja -C build install + ninja -C build + sudo ninja -C build install ### Monado Service