[Buildroot] [PATCH] package/libcamera-apps: enable LIBAV only if libdrm is present

Yann E. MORIN yann.morin.1998 at free.fr
Tue Feb 7 15:22:46 UTC 2023


Marcus, All,

On 2023-02-07 09:54 +0100, Marcus Folkesson spake thusly:
> Since commit 35266e84043f880d7591e52b71a8c5b8d0e4717d, libcamera-apps
> does enable LIBAV by default which depends on libdrm.
> 
> Fixes:
> - http://autobuild.buildroot.net/results/548f2a3b353ce4693fb60d7fb1e06e02af22991c/
> 
> /home/buildroot/autobuild/run/instance-1/output-1/build/libcamera-apps-1.1.1/encoder/libav_encoder.cpp:13:10: fatal error: libdrm/drm_fourcc.h: No such file or directory
>    13 | #include <libdrm/drm_fourcc.h>
>       |          ^~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Marcus Folkesson <marcus.folkesson at gmail.com>
> ---
>  package/libcamera-apps/libcamera-apps.mk | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/libcamera-apps/libcamera-apps.mk b/package/libcamera-apps/libcamera-apps.mk
> index 290ee9a026..385c65136e 100644
> --- a/package/libcamera-apps/libcamera-apps.mk
> +++ b/package/libcamera-apps/libcamera-apps.mk
> @@ -25,8 +25,10 @@ LIBCAMERA_APPS_CONF_OPTS = \
>  ifeq ($(BR2_PACKAGE_LIBDRM),y)
>  LIBCAMERA_APPS_DEPENDENCIES += libdrm
>  LIBCAMERA_APPS_CONF_OPTS += -DENABLE_DRM=1
> +LIBCAMERA_APPS_CONF_OPTS += -DENABLE_LIBAV=1

But doesn't ENABLE_LIBAV also need a few libraries? From libcamera-apps'
encoder/CMakeLists.txt:

   13 if (ENABLE_LIBAV)
   14     message(STATUS "Checking for libavcodec")
   15     pkg_check_modules(LIBAV QUIET IMPORTED_TARGET
   16         libavcodec
   17         libavdevice
   18         libavformat
   19         libswresample
   20     )

libavcodec, libavdevice, libavformat, and libswresample come with
ffmpeg, so this should be added to dependencies too.

Note: in fact, if the libs are not found, the feature will be silently
disabled:

   21     if (LIBAV_FOUND)
   22         include_directories(${LIBAV_INCLUDE_DIRS})
   23         set(SRC ${SRC} libav_encoder.cpp)
   24         set(TARGET_LIBS ${TARGET_LIBS} ${LIBAV_LIBRARIES})
   25         set(LIBAV_PRESENT 1)
   26         message(STATUS "libavcodec found:")
   27         message(STATUS "    libraries: ${LIBAV_LIBRARIES}")
   28     endif()
   29 else()
   30     message(STATUS "Omitting libavcodec")
   31 endif()

However, this is not clean, because we explicitly asked for a feature
(enable libav suport) but it gets disabled because of missing
dependencies.

So, either we explicitly and unconditionally disable it, or we add the
necessary dependencies.

Regards,
Yann E. MORIN.

>  else
>  LIBCAMERA_APPS_CONF_OPTS += -DENABLE_DRM=0
> +LIBCAMERA_APPS_CONF_OPTS += -DENABLE_LIBAV=0
>  endif
>  
>  ifeq ($(BR2_PACKAGE_XORG7),y)
> -- 
> 2.38.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list