Azure-Kinect-Sensor-SDK icon indicating copy to clipboard operation
Azure-Kinect-Sensor-SDK copied to clipboard

Arch Linux support

Open ichlubna opened this issue 6 years ago • 12 comments
trafficstars

Hello, while Ubuntu belong to the mainstream Linux distros Arch is widely used by programmers too. I guess I am not the only one who'd appreciate an Arch (pacman) package or AUR one. Compiling with CMake seems to be a bit tricky because of various dependencies which might differ on Arch. Thanks and have a nice day!

ichlubna avatar Aug 12 '19 07:08 ichlubna

I've built K4A successfully on an Arch Linux machine at home. I think it's unlikely that we'll officially support Arch Linux, but I can try and get you a list of the equivalent Arch dependencies, which should make building easier.

xthexder avatar Aug 12 '19 18:08 xthexder

Also running Arch here -- an AUR package would be amazing.

ryanmjacobs avatar Aug 12 '19 21:08 ryanmjacobs

As it turns out, I was mistaken about building K4A on arch linux. Since Arch Linux provides extremely recent versions of Clang and GCC, some additional warnings are detected in the source that prevent it from building.

I'll spend some time this week going through the warnings and getting K4A to build.

xthexder avatar Aug 13 '19 05:08 xthexder

Hey I managed to build it after all (still would appreciate AUR package though). My first mistake was that I didn't clone --recursive submodules. Second thing was that I had to edit the build.ninja file and replace all -Werror flags with -Wno-error. The examples seem to be working now despite the warnings. Also had to get the depthengine 2.0 library from the latest NuGet package cause the Debian one had 1.0.

ichlubna avatar Aug 13 '19 07:08 ichlubna

I just built the source code on my Arch machine. Besides some minor fixes, the built went well. I will receive the hardware tomorrow (being excited about it). Here are the steps which were necessary to build on my Arch system:

Prerequisite

Make sure that you have installed the libsoundio (which is not available in the default Arch repo). I just cloned it and performed a make && make install.

Patch source code

Since the default libsoundio headers are installed under /usr/local/soundio, I needed to patch one file:

index c9c2718..011a76e 100644
--- a/tools/k4aviewer/k4asoundio_util.h
+++ b/tools/k4aviewer/k4asoundio_util.h
@@ -16,7 +16,7 @@
 // This disables that behavior.
 //
 #define NOMINMAX
-#include <soundio.h>
+#include <soundio/soundio.h>

 // Project headers
 //

After that, everything compiled and linked like a charm:

mkdir build
cd build
cmake ..

Please make sure to update the LD_LIBRARY_PATH before executing any binary. This is required since libsoundio installs the binaries under /usr/local/lib64

LD_LIBRARY_PATH=/usr/local/lib64 ./bin/k4aviewer

breiting avatar Aug 19 '19 12:08 breiting

I was able to build without any modification by installing the libsoundio AUR package.

xthexder avatar Aug 19 '19 17:08 xthexder

All right, well I took a stab at creating the AUR package (https://github.com/ryanmjacobs/AUR-azure-kinect-sensor-sdk-git). Everything builds and installs fine on my test Arch Linux VM.

This works great for me:

$ yay -S azure-kinect-sensor-sdk-git

I can access the color camera with k4aviewer. However, the depth functionality is broken. I don't have libdepthengine anywhere on my system. Not sure where to grab that.

I also had to create a udev rule in order to access the camera. The AUR package installs it for you, however, you probably need to reload the rules in order for them to take effect without rebooting (sudo udevadm control --reload-rules && sudo udevadm trigger).

# /etc/udev/rules.d/50-kinect-azure.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", TAG+="uaccess"

ryanmjacobs avatar Aug 20 '19 08:08 ryanmjacobs

According to docs/building.md the depth engine is closed source and only available as binary. I will try to get it out from the Ubuntu package and see if it working.

From building.md:

  • Depth Engine. The depth engine (DE) is a closed source binary shipped with the SDK installer. The DE binary needs to be copied to the host system and added to the path. NOTE: This step is not need for building, but is required to run the SDK and tests

breiting avatar Aug 20 '19 13:08 breiting

Finally, after some fiddling I am able to access the depth camera. However, the path is not straight forward, I had to install mono and nuget (in a virtual machine, not to pollute my machine). You have to get the latest beta of v1.2.0 which includes the libdepthengine.so.2 file. After having the package installed, I copied over the .so.2 file to my Arch machine and voila.

The distribution of the (closed source) Linux binary is not nice via Nuget.

This command downloads the latest Azure binaries via nuget under Ubuntu 18.04

nuget install Microsoft.Azure.Kinect.Sensor -Version 1.2.0-beta.1

breiting avatar Aug 20 '19 14:08 breiting

A couple notes:

We actually provide a udev rule in the git repo that is specific to Kinect: https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/develop/scripts/99-k4a.rules

Normally the depth engine is provided as part of the debian package, but the current develop branch references the 2.0 version which so far is only available in beta releases. I'll have a talk with the team to see what we can do to make depth engine binaries more available.

Thanks for setting up an AUR package, this is a great contribution.

xthexder avatar Aug 20 '19 20:08 xthexder

Great, thanks for the info. I've updated the AUR package to use the udev rules provided in the repository. The thing that confused me was all of the different USB Product IDs -- why do they change each time I remove and reinsert the device? It seems to cycle through 097a and 097e.

I've also followed @breiting's advice and used nuget to grab a beta release that included libdepthengine.so.2.0. I've included the binary in my AUR package and everything works great! I'm able to pan around in the 3D view mode and it looks fantastic.

ryanmjacobs avatar Aug 21 '19 15:08 ryanmjacobs

I have tried the following but no luck on my build process.

mkdir build && cd build && cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=nvcc -DCMAKE-CXX_COMPILER=g++ -debug-output ..

The output after ten mins is

Running with debug output on.

This seems wrong as I can't see any info and the process seems idle. Any idea for building on aarch64 (jetson tx1) ?

Figured the problem was with ninja. (sudo apt install ninja-build instead of ninja)

Gangareddy avatar Nov 07 '19 00:11 Gangareddy