IntelRealSense / meta-intel-realsense

Yocto layer for realsense-sdk and librealsense
https://realsense.intel.com/
Other
34 stars 26 forks source link

Get around the librealsense2 dependency on mesa/gtk+3 #27

Closed HndsmJohn closed 4 years ago

HndsmJohn commented 4 years ago

Hello,

I am currently trying to run the Realsense T265 and D435 cameras on an Intrinsyc OpenQ 845-µSOM Development Kit. The board is shipped with a linux/yocto kernel base and the possibilty to customize the OS image and I am currently trying to install the realsense layer into this build. I am building Yocto on branch rocko (2.4) and I am encountering several issues regarding the graphical dependencies of the meta-intel-realsense layer. I saw during the building process that the Realsense layer is dependent on gtk+3 which is also dependent on libgl. Since the 845-µSOM includes an Adreno graphical processor, many BSP layers shipped by Intrinsyc require the Qualcomm-specific layer adreno. This is conflicting with the Relasense dependencies.

Trying to work around this issue, I gathered information about mesa, gtk+3 and their dependecies. From what I understood, those libraries are mainly used to create graphical interfaces. Some of them (like atk) seem to be broken and I cannot manage to build them. Since I don't need those for my build (no graphical interface), I thought the best solution for me would be to build the layer without any component that require these dependencies. I tried tweaking the different parameters providing the library libgl (like PREFERRED_PROVIDER_virtual/libgl = "mesa"/"mesa-gl" with no success. Here is part of my local.conf file that I am trying to modify to build the realsense layer :

DISTRO_FEATURES_append = " x11 opengl" # Required to build gtk+3
PREFERRED_PROVIDER_virtual/libgl = "mesa-gl"
PREFERRED_PROVIDER_virtual/mesa = "mesa-gl"

I also tried to disable the graphical examples but I am still a beginner with Yocto and I am afraid to break the layer. Would you have any recommendation to work around these dependencies ?

srware commented 4 years ago

Hi @HndsmJohn,

The librealsense recipe looks for x11 and opengl in DISTRO_FEATURES and uses this to determine whether to build graphical examples or not. If DISTRO_FEATURES does not include x11 or opengl then these should not be built and gtk+3 shouldn't be pulled in as a dependency in this case.

If the default distro config for your board is pulling in x11 and opengl maybe try the following in your local.conf:

DISTRO_FEATURES_remove = " x11 opengl"

HndsmJohn commented 4 years ago

Hi @srware I tried running the build both with the line you suggested and without, to see if one of the other layers is pulling in x11 and opengl. Both time the same error showed up so I can deduce that none of the other layers are dependent on those two packages. The error shows up downstream, during the "do_configure" task of the Realsense layer and it is a cmake error :

| DEBUG: Executing shell function do_configure
| -- The C compiler identification is GNU 6.4.0
| -- The CXX compiler identification is GNU 6.4.0
| -- Check for working C compiler: /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc
| -- Check for working C compiler: /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc -- works
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Check for working CXX compiler: /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-g++
| -- Check for working CXX compiler: /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-g++ -- works
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- Info: REALSENSE_VERSION_STRING=2.10.4
| -- Performing Test COMPILER_SUPPORTS_CXX11
| -- Performing Test COMPILER_SUPPORTS_CXX11 - Success
| -- Performing Test COMPILER_SUPPORTS_CXX0X
| -- Performing Test COMPILER_SUPPORTS_CXX0X - Success
| -- Found PkgConfig: /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/recipe-sysroot-native/usr/bin/pkg-config (found version "0.29.2")
| -- Checking for one of the modules 'libusb-1.0'
| -- Checking for module 'gtk+-3.0'
| --   No package 'gtk+-3.0' found
| CMake Error at /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/recipe-sysroot-native/usr/share/cmake-3.8/Modules/FindPkgConfig.cmake:416 (message):
|   A required package was not found
| Call Stack (most recent call first):
|   /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/recipe-sysroot-native/usr/share/cmake-3.8/Modules/FindPkgConfig.cmake:589 (_pkg_check_modules_internal)
|   tools/depth-quality/CMakeLists.txt:23 (pkg_check_modules)
| 
| 
| -- Configuring incomplete, errors occurred!

I saw this the first time I tried to build my image, so this is why I thought I had to install the gtk+3 package. And looking at the cmake call, I can see that the graphical examples are deactivated (refactored for better readability):

cmake $oecmake_sitefile /home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/git 
-DCMAKE_INSTALL_PREFIX:PATH=/usr 
-DCMAKE_INSTALL_BINDIR:PATH=bin 
-DCMAKE_INSTALL_SBINDIR:PATH=sbin 
-DCMAKE_INSTALL_LIBEXECDIR:PATH=libexec 
-DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc 
-DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=../com 
-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=/var 
-DCMAKE_INSTALL_LIBDIR:PATH=lib64 
-DCMAKE_INSTALL_INCLUDEDIR:PATH=include 
-DCMAKE_INSTALL_DATAROOTDIR:PATH=share 
-DCMAKE_INSTALL_SO_NO_EXE=0 
-DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/OpenQ-845_Linux-v1.1/Source_Package/SDA845_OpenQ-845_Linux_v1.1/poky/build/tmp-glibc/work/aarch64-oe-linux/librealsense2/2.10.4-r0/toolchain.cmake 
-DCMAKE_VERBOSE_MAKEFILE=1 
-DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 
-DBUILD_SHARED_LIBS:BOOL=ON 
-DBUILD_UNIT_TESTS:BOOL=OFF 
-DBUILD_EXAMPLES:BOOL=ON 
-DUSE_SYSTEM_LIBUSB:BOOL=ON 
-DBUILD_GRAPHICAL_EXAMPLES:BOOL=OFF 
-DBUILD_PYTHON_BINDINGS:BOOL=OFF -Wno-dev'

Are there any other examples/executables/libs that are dependent on gtk+3 ?

srware commented 4 years ago

@HndsmJohn, there appear to be some "tools" which are graphical and do not adhere to the graphical flag in older librealsense versions. I will push a patch to the 'rocko' branch to fix it.

Thanks.

HndsmJohn commented 4 years ago

Hi, I did manage to compile the layer successfully, though I still had to do the modifications in the CMakeLists.txt file to fix the exact same issue addressed in this issue.

Thank you for the patch.