[libcamera-devel] [PATCH] src/libcamera/base/meson.build: add libatomic dependency

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Sep 15 04:35:42 CEST 2021


Hi Fabrice,

Thank you for the patch.

On Sun, Sep 12, 2021 at 03:02:51PM +0200, Fabrice Fontaine wrote:
> Add libatomic dependency which is needed since the addition of the base
> support library with
> https://git.linuxtv.org/libcamera.git/commit/?id=27aff949fbc1b9aabfc594bbfd6f94be55a086ec
> to avoid the following build failure:
> 
> /tmp/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/9.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: src/libcamera/base/libcamera-base.so.p/message.cpp.o: in function `libcamera::Message::registerMessageType()':
> message.cpp:(.text+0x290): undefined reference to `__atomic_fetch_add_4'
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/6e3471df8e9312a1789ca05ae70cc2283bfeec23
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>

I'm still unsure what the rules regarding libatomic are, when it's
needed, on what platforms, but given that we link libcamera.so to it
unconditionally, it makes sense for the base library too.

> ---
>  src/libcamera/base/meson.build | 1 +
>  src/libcamera/meson.build      | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
> index d799c66d..8e125744 100644
> --- a/src/libcamera/base/meson.build
> +++ b/src/libcamera/base/meson.build
> @@ -20,6 +20,7 @@ libcamera_base_sources = files([
>  
>  libcamera_base_deps = [
>      dependency('threads'),
> +    libatomic,
>  ]
>  
>  # Internal components must use the libcamera_base_private dependency to enable
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index e9230b98..bf82d38b 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -54,12 +54,13 @@ includes = [
>      libcamera_includes,
>  ]
>  
> +libatomic = cc.find_library('atomic', required : false)
> +
>  subdir('base')
>  subdir('ipa')
>  subdir('pipeline')
>  subdir('proxy')
>  
> -libatomic = cc.find_library('atomic', required : false)
>  libdl = cc.find_library('dl')
>  libgnutls = cc.find_library('gnutls', required : true)
>  libudev = dependency('libudev', required : false)

I'd be tempted to move the other libraries before the subdir()s, but
that's not required.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list