diff --git a/build-additional-dependencies.md b/build-additional-dependencies.md new file mode 100644 index 0000000000000000000000000000000000000000..bf0619d83f82a506b2f3bcfb8935d4e3af5fe57b --- /dev/null +++ b/build-additional-dependencies.md @@ -0,0 +1,186 @@ +--- +title: "Monado - Building Additional Dependencies" +layout: main +--- + +* TOC +{:toc} + +## Dependencies needed to build Monado's additional drivers + +[checked on Fedora 38] + +### 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 + +### For the libsurvive driver + +Some other dependencies are needed. + +* On Debian/Ubuntu: + + sudo apt install liblapacke-dev libopenblas-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 + +### For the Realsense driver + +* On Debian/Ubuntu: ```...``` +* On Fedora: ```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 + +### For SLAM tracking support, using Basalt + +Some other dependencies are needed. + +* On Debian/Ubuntu: + + ... + +* On Fedora: + + 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). + + Add `#include <cstdint>` near the other inclusions in: + * thirdparty/Pangolin/src/image/image_io_jpg.cpp + * thirdparty/Pangolin/include/pangolin/log/packetstream_tags.h + +\ +Then, Basalt can be built and installed: + + 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 + +### For 'Mercury' Hand Tracking, using the ONNX Runtime + +Some other dependencies are needed. + +* On Debian/Ubuntu: + + ... + +* On Fedora: + + sudo dnf install gmock-devel patch + +\ +Then, onnxruntime can be built and installed: + + 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 + + +### To use Tracy as a tracing backend + +Some other dependencies are needed. + +* On Debian/Ubuntu: + + ... + +* On Fedora: + + sudo dnf install glfw-devel freetype-devel capstone-devel dbus-devel + +\ +Then, tracy can be built and installed: + + git clone git clone https://github.com/wolfpld/tracy.git + cd tracy + cd profiler/build/unix + sudo make LEGACY=1 + +**Note**: Monado needs to be built with tracing support: + + cmake .... -DXRT_HAVE_TRACY=ON -DXRT_FEATURE_TRACING=ON + diff --git a/getting-started.md b/getting-started.md index 10cfa7377ab4138e7ebc6d43551f22af2e7d8b72..26a4f3eb2d0d33937bb34ee96929704529640b25 100644 --- a/getting-started.md +++ b/getting-started.md @@ -73,16 +73,29 @@ Other useful packages: Install the CMake and ninja build tools - apt install cmake ninja-build +* On Debian/Ubuntu, use: + + apt install cmake ninja-build + +* On Fedora, use: + + 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. -This command will install required and some optional dependencies that will enable most of the commonly used functionality of monado on Debian/Ubuntu. -Some features and drivers are only compiled with additional dependencies like libsurvive or librealsense. +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 + +* On Fedora, 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 + 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 -then compile and install Monado. Monado can be built with either cmake or meson. +Then compile and install Monado. Monado can be built with either cmake or meson. git clone https://gitlab.freedesktop.org/monado/monado.git cmake -G Ninja -S monado -B build -DCMAKE_INSTALL_PREFIX=/usr