How to use mesa-gl recipe in yocto build inside docker sdk

Please provide the following info (tick the boxes after creating this topic):
Software Version
DRIVE OS 6.0.8.1
DRIVE OS 6.0.6
DRIVE OS 6.0.5
DRIVE OS 6.0.4 (rev. 1)
DRIVE OS 6.0.4 SDK
other

Target Operating System
Linux
QNX
other

Hardware Platform
DRIVE AGX Orin Developer Kit (940-63710-0010-300)
DRIVE AGX Orin Developer Kit (940-63710-0010-200)
DRIVE AGX Orin Developer Kit (940-63710-0010-100)
DRIVE AGX Orin Developer Kit (940-63710-0010-D00)
DRIVE AGX Orin Developer Kit (940-63710-0010-C00)
DRIVE AGX Orin Developer Kit (not sure its number)
other

SDK Manager Version
1.9.3.10904
other

Host Machine Version
native Ubuntu Linux 20.04 Host installed with SDK Manager
native Ubuntu Linux 20.04 Host installed with DRIVE OS Docker Containers
native Ubuntu Linux 18.04 Host installed with DRIVE OS Docker Containers
other

I’m trying to cross compile inside docker image an application using yocto and mesa-gl is set as preferred_provider. But I have an error:
ERROR: Task (/drive/drive-linux_src/yocto/oss/dunfell/poky/meta/recipes-graphics/mesa/mesa-gl_20.0.2.bb:do_compile) failed with exit code ‘1’.

I wanted to know how to use the mesa-gl recipe in my yocto build.

Have you followed DRIVE OS Linux Yocto Components? Could you provide detailed steps on how you encountered this issue?

Hi,
Yes, I followed the developer guide provided. Especially this step : To build NVIDIA Yocto Project-based components | NVIDIA Docs
After that I copied my application recipe into the path configurated in the bblayer file.

These are the error I encountered when bitbaking the application:
My application uses libgl to build so I added a preferred provider inside the meta-drive6 conf file these 2 lines:
PREFERRED_PROVIDER_virtual/libgl = “mesa-gl”
PREFERRED_PROVIDER_virtual/mesa = “mesa-gl”

But I encountered this error when building:
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:32:10: fatal error: nouveau_drm.h: No such file or directory
| 32 | include <nouveau_drm.h>
| | ^~~~~~~~~~~~~~~
| compilation terminated.

After changing the path of the header to include <drm/nouveau_drm.h>, I get this error:
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c: In function ‘nouveau_chipset’:
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:11: error: variable ‘gp’ has initializer but incomplete type
| 37 | struct drm_nouveau_getparam gp = { NOUVEAU_GETPARAM_CHIPSET_ID, 0 };
| | ^~~~~~~~~~~~~~~~~~~~
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:39: error: ‘NOUVEAU_GETPARAM_CHIPSET_ID’ undeclared (first use in this function)
| 37 | struct drm_nouveau_getparam gp = { NOUVEAU_GETPARAM_CHIPSET_ID, 0 };
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:39: note: each undeclared identifier is reported only once for each function it appears in
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:39: warning: excess elements in struct initializer
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:39: note: (near initialization for ‘gp’)
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:68: warning: excess elements in struct initializer
| 37 | struct drm_nouveau_getparam gp = { NOUVEAU_GETPARAM_CHIPSET_ID, 0 };
| | ^
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:68: note: (near initialization for ‘gp’)
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:37:32: error: storage size of ‘gp’ isn’t known
| 37 | struct drm_nouveau_getparam gp = { NOUVEAU_GETPARAM_CHIPSET_ID, 0 };
| | ^~
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:45:1: error: control reaches end of non-void function [-Werror=return-type]
| 45 | }
| | ^
| cc1: some warnings being treated as errors

Is “NOUVEAU_GETPARAM_CHIPSET_ID” not defined in nouveau_drm.h? I’m not sure why the issue is occurring. Have you encountered any problems when building other recipes after modifying the meta-drive6 conf file?

No. The “NOUVEAU_GETPARAM_CHIPSET_ID” is not defined in nouveau_drm.h.
Here is the part of the log where the error occur:
Log.txt (5.1 KB)

The other recipes failed to build also after modifying the meta-drive6 conf file

To better assist you, could you please provide detailed steps and the necessary files needed to reproduce the issue?

The issues produced when I set preferred provider inside the meta-drive6 conf file:
PREFERRED_PROVIDER_virtual/libgl = “mesa-gl”
PREFERRED_PROVIDER_virtual/mesa = “mesa-gl”

When I tried to bitbake my recipe, I encountered the error:
| …/mesa-20.0.2/src/loader/pci_id_driver_map.c:32:10: fatal error: nouveau_drm.h: No such file or directory
| 32 | include <nouveau_drm.h>
| | ^~~~~~~~~~~~~~~
| compilation terminated.

Could you please provide detailed steps and the required files for me to reproduce the issue on my end? Specifically, I would like to know what is needed to build your recipe and any modifications you made based on the instructions provided in the link. Additionally, please provide the complete command executed.

The recipe we use need libglu to build and the libglu need the libgl to build itself. If you simply add 2 lines mentioned before in meta-drive6 conf and try to build libglu with bitbake libglu,

This is the procedure I used:
sudo locale-gen en_US en_US.UTF-8
sudo su nvidia
cd /drive-linux_src/yocto
export TEMPLATECONF=$PWD/layers/meta-drive6/conf
source oss/dunfell/poky/oe-init-build-env
export BB_NO_NETWORK=‘0’

Next, I added the preferred _provider insed meta-drive.conf

bitbake libglu

Where did you add the variables? /drive/drive-linux_src/yocto/layers/meta-drive6/conf/distro/drive-os-av.conf?

Here is the output on my side: What’s missing?

nvidia@3cbf072-lcedt:/drive/drive-linux_src/yocto/build$ bitbake libglu
WARNING: Duplicate inclusion for /drive/drive-linux_src/yocto/oss/dunfell/poky/meta/conf/distro/include/security_flags.inc in /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive6/conf/distro/drive-os-av.conf
WARNING: Duplicate inclusion for /drive/drive-linux_src/yocto/oss/dunfell/poky/meta/conf/distro/include/security_flags.inc in /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive6/conf/distro/drive-os-av.conf
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/nvsf/nvsf_1.0.bb: Unable to get checksum for nvsf SRC_URI entry nvsf: file could not be found                                                                                         | ETA:  --:--:--
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/graphics-samples/vulkan-sc-samples_1.0.bb: Unable to get checksum for vulkan-sc-samples SRC_URI entry vulkan-sc-samples: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/graphics-samples/vulkan-sc-samples_1.0.bb: Unable to get checksum for vulkan-sc-samples SRC_URI entry nvidia_icd_vksc.json: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/graphics-samples/vulkan-sc-samples_1.0.bb: Unable to get checksum for vulkan-sc-samples SRC_URI entry VkLayer_json_gen.json: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/graphics-samples/vulkan-sc-samples_1.0.bb: Unable to get checksum for vulkan-sc-samples SRC_URI entry VkSCLayer_khronos_validation.json: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/graphics-samples/vulkan-sc-samples_1.0.bb: Unable to get checksum for vulkan-sc-samples SRC_URI entry libvulkansc.so.1.0.11: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/graphics-samples/vulkan-sc-samples_1.0.bb: Unable to get checksum for vulkan-sc-samples SRC_URI entry libVkLayer_json_gen.so: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive6/recipes-support/freeimage/freeimage_3.11.0.bb: Getting checksum for freeimage SRC_URI entry FreeImage3110.zip: file not found except in DL_DIR
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-debug/recipes-oss-debug-utils/sshpass/sshpass_1.05.bb: Getting checksum for sshpass SRC_URI entry sshpass-1.05.tar.gz: file not found except in DL_DIR
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-debug/recipes-oss-debug-utils/lcm/lcm_1.3.1.bb: Getting checksum for lcm SRC_URI entry lcm-1.3.1.tar.gz: file not found except in DL_DIR
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/driveworks/driveworks-samples.bb: Unable to get checksum for driveworks-samples SRC_URI entry cmake: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/driveworks/driveworks-samples.bb: Unable to get checksum for driveworks-samples SRC_URI entry include: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/driveworks/driveworks-samples.bb: Unable to get checksum for driveworks-samples SRC_URI entry lib: file could not be found
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-drive-samples/recipes-nv-samples/driveworks/driveworks-samples.bb: Getting checksum for driveworks-samples SRC_URI entry samples: file not found except in DL_DIR
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-tegra/recipes-support/misc/nv-misc_1.0.bb: Getting checksum for nv-misc SRC_URI entry pmount: file not found except in DL_DIR
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../../../layers/meta-tegra/recipes-dw/driveworks/driveworks.bb: Unable to get checksum for driveworks SRC_URI entry lib: file could not be found                                                                                             | ETA:  0:00:27
NOTE: /drive/drive-linux_src/yocto/oss/dunfell/poky/../meta-openembedded/meta-oe/recipes-extended/rsyslog/rsyslog_8.2002.0.bb: Including rsyslog as buildable despite it having an incompatible license because it has been whitelisted                                                             | ETA:  0:00:07
WARNING: /drive/drive-linux_src/yocto/oss/dunfell/poky/../meta-selinux/recipes-security/audit/audit_2.8.5.bb: Getting checksum for audit SRC_URI entry ipx.h: file not found except in DL_DIR                                                                                                       | ETA:  0:00:05
NOTE: /drive/drive-linux_src/yocto/oss/dunfell/poky/meta/recipes-core/coreutils/coreutils_8.31.bb: Including coreutils as buildable despite it having an incompatible license because it has been whitelisted#####################################################                                  | ETA:  0:00:01
NOTE: /drive/drive-linux_src/yocto/oss/dunfell/poky/../meta-gplv2/recipes-core/coreutils/coreutils_6.9.bb: Including coreutils as buildable despite it having an incompatible license because it has been whitelisted
Parsing recipes: 100% |#############################################################################################################################################################################################################################################################################| Time: 0:00:10
Parsing of 2288 .bb files complete (0 cached, 2288 parsed). 3432 targets, 435 skipped, 11 masked, 0 errors.
ERROR: Nothing PROVIDES 'libglu'
libglu was skipped: missing required distro feature 'x11' (not in DISTRO_FEATURES)

Summary: There were 19 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

The preferred_provider was added inside /drive-linux_src/yocto/layers/meta-drive6/conf/distro/drive-os-av.conf
The x11 distro feature was disabled by default. You need to enable x11 by deleting it from the DISTRO_FEATURE_remove list in the same conf file.

I can reproduce the issue as follows. I’ll discuss it with our team.

nvidia@3cbf072-lcedt:/drive/drive-linux_src/yocto/build$ bitbake libglu
...
FAILED: src/loader/c9e3f98@@loader@sta/pci_id_driver_map.c.o                                                                                                                                                                                                                                                                                                                      
aarch64-gnu-linux-gcc -march=armv8-a+crc-fno-omit-frame-pointer -march=armv8-a+crypto -mtune=cortex-a57 -funwind-tables -fstack-protector-all -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/drive/drive-linux_s
rc/yocto/build/tmp/work/aarch64-gnu-linux/mesa-gl/2_20.0.2-r0/recipe-sysroot -Isrc/loader/c9e3f98@@loader@sta -Isrc/loader -I../mesa-20.0.2/src/loader -Iinclude -I../mesa-20.0.2/include -Isrc -I../mesa-20.0.2/src -Isrc/util -I../mesa-20.0.2/src/util -Isrc/util/xmlpool -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 -std=c99 -D__STDC_CONSTANT_MACROS -D
__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="20.0.2"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/issues"' -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_SURFACELESS_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN
_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -D
HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_UINT128 -D_GNU_SOURCE -DUSE_GCC_ATOMIC_BUILTINS -DMAJOR_IN_SYSMACROS -DHAVE_SYS_SYSCTL_H -DHAVE_LINUX_FUTEX_H
 -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_EXECINFO_H -DHAVE_SYS_SHM_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_
LIBDRM -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=empty-body -Werror=incompatible-pointer-types -Werror=int-conversion -Wno-missing-field-initializers -Wno-format-truncation -fno-math-errno -fno-trapping-math -Werror=format -Wformat-security -O2 -g -feliminate-unused-debug-types -fmacro-prefix-map=/drive/drive-linux_sr
c/yocto/build/tmp/work/aarch64-gnu-linux/mesa-gl/2_20.0.2-r0=/usr/src/debug/mesa-gl/2_20.0.2-r0 -fdebug-prefix-map=/drive/drive-linux_src/yocto/build/tmp/work/aarch64-gnu-linux/mesa-gl/2_20.0.2-r0=/usr/src/debug/mesa-gl/2_20.0.2-r0 -fdebug-prefix-map=/drive/drive-linux_src/yocto/build/tmp/work/aarch64-gnu-linux/mesa-gl/2_20.0.2-r0/recipe-sysroot= -fdebug-prefix-map=/d
rive/drive-linux_src/yocto/build/tmp/work/aarch64-gnu-linux/mesa-gl/2_20.0.2-r0/recipe-sysroot-native= -fno-omit-frame-pointer -fPIC -pthread -fvisibility=hidden -DUSE_DRICONF '-DDEFAULT_DRIVER_DIR="/usr/lib/dri"' -MD -MQ 'src/loader/c9e3f98@@loader@sta/pci_id_driver_map.c.o' -MF 'src/loader/c9e3f98@@loader@sta/pci_id_driver_map.c.o.d' -o 'src/loader/c9e3f98@@loader@s
ta/pci_id_driver_map.c.o' -c ../mesa-20.0.2/src/loader/pci_id_driver_map.c                                                                                                                                                                                                                                                                                                        
../mesa-20.0.2/src/loader/pci_id_driver_map.c:32:10: fatal error: nouveau_drm.h: No such file or directory                                                                                                                                                                                                                                                                        
   32 | #include <nouveau_drm.h>                                                                                                                                                                                                                                                                                                                                                  
      |          ^~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                                  
compilation terminated.                                                       
...

Can you please help us understand what is the use case for using mesa?
In Yocto rootfs, there is no use of mesa as NVIDIA drivers are fully supporting GL & GLES.

We have an existing application that uses glut library. We saw that the glut recipe exists in the drive os yocto which needs mesa-gl to build.

Our application also uses opencv and when we bitbake opencv, nothing provides libgl mention in this error:
ERROR: Nothing RPROVIDES ‘libgl’ (but /drive/drive-linux_src/yocto/oss/dunfell/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.14.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target ‘libgl’ is unbuildable, removing…
Missing or unbuildable dependency chain was: [‘libgl’]
ERROR: Required build target ‘opencv’ has no buildable providers.
Missing or unbuildable dependency chain was: [‘opencv’, ‘gtk+3’, ‘libgl’]

We checked that we built the nv-graphics-drivers recipe and it doesn’t provide libgl, only libgles.

We also see that a qt layer is provided. We tried adding the layer into the bblayer.conf but isn’t compatible with the drive os yocto version:
ERROR: Unable to start bitbake server (None)
ERROR: Server log for this session (/drive/drive-linux_src/yocto/build/bitbake-cookerdaemon.log):
— Starting bitbake server pid 4137955 at 2024-04-08 15:49:06.466325 —
ERROR: Layer qt5-layer is not compatible with the core layer which only supports these series: dunfell (layer is compatible with warrior sumo thud)

Have you consulted Graphics Programming for guidance on modifying your application?

Also, libglut has a dependency on X, so including it in the filesystem will not work in Yocto, Since X is not supported on Yocto.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.