[RFC,v1] libv4l: fix qv4l2 libatomic related compile failure

Message ID 20180203232127.22765-1-ps.report@gmx.net
State New
Headers show
Series
  • [RFC,v1] libv4l: fix qv4l2 libatomic related compile failure
Related show

Commit Message

Peter Seiderer Feb. 3, 2018, 11:21 p.m.
Fixes [1]:

  sparc-buildroot-linux-uclibc/bin/ld: qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'

[1] http://autobuild.buildroot.net/results/baa2595e1acdf4e795fbb940ca57fd136c827da3

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Patch fixes the qv4l2 linking problem for sparc, but adds a libatomic
dependency to all v4l libraries. Any better suggestions to add
libatomic linking only to utils/qv4l2?
---
 .../0003-configure.ac-check-for-libatomic.patch    | 30 ++++++++++++++++++++++
 package/libv4l/libv4l.mk                           |  5 ++++
 2 files changed, 35 insertions(+)
 create mode 100644 package/libv4l/0003-configure.ac-check-for-libatomic.patch

Comments

Thomas Petazzoni Feb. 4, 2018, 10:43 p.m. | #1
Hello,

On Sun,  4 Feb 2018 00:21:27 +0100, Peter Seiderer wrote:
> Fixes [1]:
> 
>   sparc-buildroot-linux-uclibc/bin/ld: qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'
> 
> [1] http://autobuild.buildroot.net/results/baa2595e1acdf4e795fbb940ca57fd136c827da3

Did you analyze what part of the code is using atomic intrinsics? I
don't see any use of atomic instrisics in qv4l2 itself (but perhaps I
missed them), so they must be somewhere else.

Thomas
Peter Seiderer Feb. 6, 2018, 9:02 p.m. | #2
Hello Thomas,

On Sun, 4 Feb 2018 23:43:01 +0100, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:

> Hello,
> 
> On Sun,  4 Feb 2018 00:21:27 +0100, Peter Seiderer wrote:
> > Fixes [1]:
> > 
> >   sparc-buildroot-linux-uclibc/bin/ld: qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'
> > 
> > [1] http://autobuild.buildroot.net/results/baa2595e1acdf4e795fbb940ca57fd136c827da3  
> 
> Did you analyze what part of the code is using atomic intrinsics? I
> don't see any use of atomic instrisics in qv4l2 itself (but perhaps I
> missed them), so they must be somewhere else.

The atomic usage comes from the Qt5 libraries (libQt5Core.so,
libQt5Gui.so and libQt5Widgets.so)...

Regards,
Peter

> 
> Thomas
Thomas Petazzoni Feb. 12, 2018, 8:19 p.m. | #3
Hello,

On Tue, 6 Feb 2018 22:02:59 +0100, Peter Seiderer wrote:

> > 
> > On Sun,  4 Feb 2018 00:21:27 +0100, Peter Seiderer wrote:  
> > > Fixes [1]:
> > > 
> > >   sparc-buildroot-linux-uclibc/bin/ld: qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'
> > > 
> > > [1] http://autobuild.buildroot.net/results/baa2595e1acdf4e795fbb940ca57fd136c827da3    
> > 
> > Did you analyze what part of the code is using atomic intrinsics? I
> > don't see any use of atomic instrisics in qv4l2 itself (but perhaps I
> > missed them), so they must be somewhere else.  
> 
> The atomic usage comes from the Qt5 libraries (libQt5Core.so,
> libQt5Gui.so and libQt5Widgets.so)...

Isn't Qt installing some .pc files ? Are they being used by libv4l ? If
so, are these .pc files referencing libatomic ?

Thomas

Patch

diff --git a/package/libv4l/0003-configure.ac-check-for-libatomic.patch b/package/libv4l/0003-configure.ac-check-for-libatomic.patch
new file mode 100644
index 0000000000..78aaada653
--- /dev/null
+++ b/package/libv4l/0003-configure.ac-check-for-libatomic.patch
@@ -0,0 +1,30 @@ 
+From 87978992fbcba13550e900fbe9abb2a60be98bf4 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Sun, 4 Feb 2018 00:08:45 +0100
+Subject: [PATCH] configure.ac: check for libatomic
+
+Fixes:
+
+  .../sparc-buildroot-linux-uclibc/bin/ld: qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index dc1e9cbf..65a3caaa 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -279,6 +279,8 @@ AS_IF([test x$enable_shared != xno],
+ 		   [have_pthread=no])],
+ 	[have_pthread=no])
+ 
++AC_SEARCH_LIBS([__atomic_load_4], [atomic])
++
+ # The dlopen() function is in the C library for *BSD and in
+ # libdl on GLIBC-based systems
+ 
+-- 
+2.16.1
+
diff --git a/package/libv4l/libv4l.mk b/package/libv4l/libv4l.mk
index 11061306c7..bc9b5c9abd 100644
--- a/package/libv4l/libv4l.mk
+++ b/package/libv4l/libv4l.mk
@@ -11,6 +11,11 @@  LIBV4L_INSTALL_STAGING = YES
 LIBV4L_DEPENDENCIES = host-pkgconf
 LIBV4L_CONF_OPTS = --disable-doxygen-doc
 
+# patch 0003-configure.ac-check-for-libatomic.patch touches configure.ac
+LIBV4L_AUTORECONF = YES
+# host-gettext needed for autoreconf to work
+LIBV4L_DEPENDENCIES += host-gettext
+
 # fix uclibc-ng configure/compile
 LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'