microsoft / Azure-Kinect-Sensor-SDK

A cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.
https://Azure.com/Kinect
MIT License
1.47k stars 613 forks source link

Support ubuntu 22.04 #1941

Open asukiaaa opened 11 months ago

asukiaaa commented 11 months ago

Fixes https://github.com/microsoft/Azure-Kinect-Sensor-SDK/issues/1790

Support building on ubuntu22.04

Description of the changes:

Before submitting a Pull Request:

I have a device so I cannot pass the multi devices test on the functional tests.

# clang -L function
The following tests FAILED:
        104 - executables_ft.green_screen_double_cam (Failed)
        134 - multidevice_ft.open_close_two (Failed)
        135 - multidevice_ft.stream_two_1_then_2 (Failed)
        136 - multidevice_ft.stream_two_2_then_1 (Failed)
        137 - multidevice_ft.ensure_color_camera_is_enabled (Failed)
        138 - multidevice_ft.start_parallel (Failed)
        139 - multidevice_ft.close_parallel (Failed)
        140 - multidevice_sync_ft.multi_sync_validation (Failed)
        141 - multidevice_sync_ft.multi_sync_no_color (Failed)

I cannot pass one of the performance tests. I doubt that process delay because of running on docker container.

# clang -L perf
The following tests FAILED:
        205 - 30FPS_TESTS/throughput_perf.testTest/testindex:(FPS_30_BGRA32_2160P_NFOV_UNBINNED)28 (Failed)

I tested changes on:

The commands I build and test.

PATH_OF_REPO=$(pwd) # execute in directory of repo
cd $PATH_OF_REPO/scripts/docker
# build a container
docker buildx build . -t ubuntu-for-k4a-build
# build source
docker run -v $PATH_OF_REPO:/app -it ubuntu-for-k4a-build /bin/bash -c "rm -rf build && mkdir -p build && cd build && cmake .. -GNinja && ninja"
# put libdepthengine on build directory
cd /tmp
wget https://packages.microsoft.com/ubuntu/18.04/prod/pool/main/libk/libk4a1.4/libk4a1.4_1.4.1_amd64.deb
ar vx libk4a1.4_1.4.1_amd64.deb
tar xvf data.tar.gz
sudo cp usr/lib/x86_64-linux-gnu/libk4a1.4/libdepthengine.so.2.0 $PATH_OF_REPO/build/bin
cd $PATH_OF_REPO/scripts/docker
# enable access for x window
xhost + local:
# run tests
docker run -v $PATH_OF_REPO:/app -it ubuntu-for-k4a-build /bin/bash -c "cd build && ctest -L unit"
docker run -v $PATH_OF_REPO:/app -v /dev:/dev --net host --privileged -it ubuntu-for-k4a-build /bin/bash -c "export DISPLAY=:0 && cd build && ctest -L function"
docker run -v $PATH_OF_REPO:/app -v /dev:/dev --net host --privileged -it ubuntu-for-k4a-build /bin/bash -c "export DISPLAY=:0 && cd build && ctest -L perf"

The libdepthengine require x window system so we need to connect window to docker engine. Referendes: https://github.com/microsoft/Azure-Kinect-Sensor-SDK/issues/810 https://scrapbox.io/opzriv/%E3%83%98%E3%83%83%E3%83%89%E3%83%AC%E3%82%B9%E3%81%A7Kinect%E3%81%AEDepth%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%B3%E3%82%92%E4%BD%BF%E3%81%86

asukiaaa commented 11 months ago

@microsoft-github-policy-service agree

pesekon2 commented 7 months ago

Hey @asukiaaa. I would like to use Azure with Ubuntu 22.04. Is this fix working? I have just tried pulling this PR instead of master in one of my docker images and it did not work, but maybe I just need to update more packages then. I can see failing tests, but that does not necessarily mean too much.

asukiaaa commented 7 months ago

I created deb file for ubuntu22.04 and upload to github. How about to try this? https://github.com/asukiaaa/Azure-Kinect-Sensor-SDK/releases/tag/2923-08-26-ubuntu-22-04

An article about the deb file in Japanese. https://asukiaaa.blogspot.com/2023/08/deb-file-of-azure-kinect-sdk-for-ubuntu-2204.html

pesekon2 commented 7 months ago

Great, thanks. The problem is probably in the other packages then. I'll try to solve and test it with the deb file too.