external/uuid/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h>

Background
Hardware: jetson orin
Compilation environment: bazel
Content: Prepare to add hardware encoding and decoding related functions to the Apollo code.

Error reported during compilation

external/uuid/xf86drm.h:40:10: fatal error: drm.h: No such file or directory 40 | #include <drm.h>

Cause Analysis

This error message means that the compiler cannot find the drm.h file when compiling the external/uuid/xf86drm.h file. This is usually because the compilation environment is not configured correctly or the necessary dependencies are missing.

You can first check if there is drm.h in the environment and search globally

sudo find -name "drm.h"
./usr/src/linux-headers-5.10.104-tegra-ubuntu20.04_aarch64/kernel-5.10/include/uapi/drm/drm.h
./usr/src/linux-headers-5.10.104-tegra-ubuntu20.04_aarch64/kernel-5.10/include/config/drm.h
./usr/include/libdrm/drm.h
./usr/include/drm/drm.h

If not,
in Linux, the DRM library is usually provided by the kernel, so you need to install the corresponding kernel header file before compiling the DRM library-related code. Linux kernel header files can be installed with the following command:

sudo apt-get install linux-headers-$(uname -r)

If you have installed the kernel header files but still cannot find the drm.h file, it may be because the path where the drm.h file is located has not been added to the compiler search path. You can try adding the following options to the compile command:

-I/path/to/drm/include
where "/path/to/drm/include" is the path where the drm.h file is located.

Solution

Add the header file include path to the BUILD file

copts = [

"-I/usr/include/libdrm"

],

If the problem still cannot be solved, you can try to reinstall the DRM library or upgrade the kernel version.

Guess you like

Origin blog.csdn.net/mao_hui_fei/article/details/131068344