Skip to contentSkip to conversation

package/libv4l: fix musl build

PATCH New Bernd Kuhls 5 participants 10 messages Oct 30, 2019 – Dec 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/libv4l: fix musl build

Fixes:
http://autobuild.buildroot.net/results/bf8/bf88f89bdb966ef54938e4274114d4afe5668b1f/

---
 ...d-missing-includes-to-fix-musl-build.patch | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 package/libv4l/0001-keymap.h-add-missing-includes-to-fix-musl-build.patch
package/libv4l/0001-keymap.h-add-missing-includes-to-fix-musl-build.patch new file +68 -0
new file mode 100644
index 0000000000..238f8fc377
@@ -0,0 +1,68 @@
+From baba68cdcb44fc11d0ba8ce2c13eb5b06bbd9b33 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <[email protected]>
+Date: Wed, 30 Oct 2019 07:15:23 +0100
+Subject: [PATCH] keymap.h: add missing includes to fix musl build
+
+Needed to fix these build errors:
+
+In file included from keymap.c:13:0:
+keymap.h:23:2: error: unknown type name 'u_int32_t'
+  u_int32_t scancode;
+
+keymap.h:36:1: error: unknown type name 'error_t'
+ error_t parse_keymap(char *fname, struct keymap **keymap, bool verbose);
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+Patch was not sent upstream due to broken mailing list setup:
+
+<[email protected]>: host vger.kernel.org[209.132.180.67] said: 553
+    5.7.1 Hello [xx.xx.xx.xx], for your MAIL FROM address
+    <[email protected]> policy analysis reported: Your address is not
+    liked source for email (in reply to MAIL FROM command)
+
+Hello [xx.xx.xx.xx], for your MAIL FROM address <[email protected]>
+ policy analysis reported: Your address is not liked source for email 
+
+ utils/common/keymap.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/utils/common/keymap.h b/utils/common/keymap.h
+index f2b29632..bb1edce9 100644
+--- a/utils/common/keymap.h
++++ b/utils/common/keymap.h
+@@ -1,4 +1,8 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
++
++#include <argp.h>
++#include <sys/types.h>
++
+ #ifndef __KEYMAP_H
+ #define __KEYMAP_H
+ 
+diff -uNr v4l-utils-1.18.0.orig/utils/ir-ctl/keymap.h v4l-utils-1.18.0/utils/ir-ctl/keymap.h
+--- v4l-utils-1.18.0.orig/utils/ir-ctl/keymap.h	2019-09-22 11:22:54.000000000 +0200
++++ v4l-utils-1.18.0/utils/ir-ctl/keymap.h	2019-10-30 07:06:18.250548011 +0100
+@@ -1,4 +1,8 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
++
++#include <argp.h>
++#include <sys/types.h>
++
+ #ifndef __KEYMAP_H
+ #define __KEYMAP_H
+ 
+diff -uNr v4l-utils-1.18.0.orig/utils/keytable/keymap.h v4l-utils-1.18.0/utils/keytable/keymap.h
+--- v4l-utils-1.18.0.orig/utils/keytable/keymap.h	2019-09-22 11:22:54.000000000 +0200
++++ v4l-utils-1.18.0/utils/keytable/keymap.h	2019-10-30 07:06:56.218816126 +0100
+@@ -1,4 +1,8 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
++
++#include <argp.h>
++#include <sys/types.h>
++
+ #ifndef __KEYMAP_H
+ #define __KEYMAP_H
+ 
+-- 
+2.20.1
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 package/libv4l: link with libatomic when needed

On some architectures, atomic operations are provided by the libatomic library from gcc. Linking with libatomic is therefore necessary, otherwise the build fails with:

/home/buildroot/autobuild/run/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/7.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld:
qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'

This is often for example the case on sparcv8 32 bit.

Fixes:
http://autobuild.buildroot.net/results/089/08952dbf89bf3c49da7697943441cee411940420/

---
 package/libv4l/libv4l.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/libv4l/libv4l.mk +5 -0
index a3bf099221..3c58f98391 100644
@@ -84,6 +84,11 @@ ifeq ($(BR2_PACKAGE_SDL2_IMAGE),y)
 LIBV4L_DEPENDENCIES += sdl2_image
 endif
 
+# Uses __atomic_fetch_add_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+LIBV4L_LIBS += -latomic
+endif
+
 LIBV4L_CONF_ENV += LIBS="$(LIBV4L_LIBS)"
 
 $(eval $(autotools-package))
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 package/libv4l: link with libatomic when needed

Quoted 11 lines · On Wed, 30 Oct 2019 07:53:03 +0100 Bernd Kuhls <[email protected]> wrote:

On some architectures, atomic operations are provided by the libatomic library from gcc. Linking with libatomic is therefore necessary, otherwise the build fails with:

/home/buildroot/autobuild/run/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/7.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld:
qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'

This is often for example the case on sparcv8 32 bit.

Fixes:
http://autobuild.buildroot.net/results/089/08952dbf89bf3c49da7697943441cee411940420/

The LIBV4L_AUTORECONF = YES that was kept in d0f3c9de49bfe3f8ac6e75a706540eefcc1afc07 was intended to fix this libatomic linking issue, so I'm a bit confused.

Could you discuss this with Peter Seiderer (in Cc) ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 2/2 package/libv4l: link with libatomic when needed

Hello *,

Quoted 10 lines · Thomas Petazzoni
Quoted 7 lines · On Wed, 30 Oct 2019 07:53:03 +0100 Bernd Kuhls <[email protected]> wrote:

On some architectures, atomic operations are provided by the libatomic library from gcc. Linking with libatomic is therefore necessary, otherwise the build fails with:

/home/buildroot/autobuild/run/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/7.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld:
qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'

Quoted 8 lines
Quoted 4 lines

This is often for example the case on sparcv8 32 bit.

Fixes:
http://autobuild.buildroot.net/results/089/08952dbf89bf3c49da7697943441cee411940420/

The LIBV4L_AUTORECONF = YES that was kept in d0f3c9de49bfe3f8ac6e75a706540eefcc1afc07 was intended to fix this libatomic linking issue, so I'm a bit confused.

Strange, this worked (when tested 3./4. October)..., now with buildroot master I can reproduce the libatomic link failure even with the 'LIBV4L_AUTORECONF = YES'...

The working version link command (and output) was (and clearly using the *.la files):

/bin/sh ../../libtool --tag=CXX --mode=link /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/sparc-linux-g++ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -std=c++11 -L/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -lQt5Widgets -lQt5Gui -lQt5Core -L/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -lasound -pthread -o qv4l2 qv4l2-qv4l2.o qv4l2-general-tab.o qv4l2-ctrl-tab.o qv4l2-vbi-tab.o qv4l2-capture-win.o qv4l2-tpg-tab.o qv4l2-capture-win-qt.o qv4l2-capture-win-gl.o qv4l2-alsa_stream.o qv4l2-raw2sliced.o qv4l2-v4l2-tpg-core.o qv4l2-v4l2-tpg-colors.o qv4l2-moc_qv4l2.o qv4l2-moc_general-tab.o qv4l2-moc_capture-win.o qv4l2-moc_vbi-tab.o qv4l2-qrc_qv4l2.o ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la ../libv4l2util/libv4l2util.la ../libmedia_dev/libmedia_dev.la -largp
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Widgets.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Gui.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Gui.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Core.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Core.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Widgets.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Gui.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Gui.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Core.la' was moved.
libtool: warning: library '/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Core.la' was moved.
libtool: link: /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/sparc-linux-g++ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -std=c++11 -pthread -o qv4l2 qv4l2-qv4l2.o qv4l2-general-tab.o qv4l2-ctrl-tab.o qv4l2-vbi-tab.o qv4l2-capture-win.o qv4l2-tpg-tab.o qv4l2-capture-win-qt.o qv4l2-capture-win-gl.o qv4l2-alsa_stream.o qv4l2-raw2sliced.o qv4l2-v4l2-tpg-core.o qv4l2-v4l2-tpg-colors.o qv4l2-moc_qv4l2.o qv4l2-moc_general-tab.o qv4l2-moc_capture-win.o qv4l2-moc_vbi-tab.o qv4l2-qrc_qv4l2.o -L/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Widgets.so /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Gui.so /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Core.so -latomic /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/sparc-buildroot-linux-uclibc/sysroot/usr/lib/libasound.so -ldl ../../lib/libv4l2/.libs/libv4l2.so -lpthread /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/build/libv4l-1.18.0/lib/libv4lconvert/.libs/libv4lconvert.so ../../lib/libv4lconvert/.libs/libv4lconvert.so -lrt -lm /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/sparc-buildroot-linux-uclibc/sysroot/usr/lib/libjpeg.so ../libv4l2util/.libs/libv4l2util.a ../libmedia_dev/.libs/libmedia_dev.a -largp -pthread -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/sparc-buildroot-linux-uclibc/sysroot/usr/lib -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/build/libv4l-1.18.0/lib/libv4l2/.libs -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/build/libv4l-1.18.0/lib/libv4lconvert/.libs -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/sparc-buildroot-linux-uclibc/sysroot/usr/lib

The actual/failing link command looks like the following:

/bin/sh ../../libtool --tag=CXX --mode=link /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/sparc-linux-g++ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -std=c++11 -lQt5Widgets -lQt5Gui -lQt5Core -lasound -pthread -o qv4l2 qv4l2-qv4l2.o qv4l2-general-tab.o qv4l2-ctrl-tab.o qv4l2-vbi-tab.o qv4l2-capture-win.o qv4l2-tpg-tab.o qv4l2-capture-win-qt.o qv4l2-capture-win-gl.o qv4l2-alsa_stream.o qv4l2-raw2sliced.o qv4l2-v4l2-tpg-core.o qv4l2-v4l2-tpg-colors.o qv4l2-moc_qv4l2.o qv4l2-moc_general-tab.o qv4l2-moc_capture-win.o qv4l2-moc_vbi-tab.o qv4l2-qrc_qv4l2.o ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la ../libv4l2util/libv4l2util.la ../libmedia_dev/libmedia_dev.la -largp
libtool: link: /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/sparc-linux-g++ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -std=c++11 -pthread -o qv4l2 qv4l2-qv4l2.o qv4l2-general-tab.o qv4l2-ctrl-tab.o qv4l2-vbi-tab.o qv4l2-capture-win.o qv4l2-tpg-tab.o qv4l2-capture-win-qt.o qv4l2-capture-win-gl.o qv4l2-alsa_stream.o qv4l2-raw2sliced.o qv4l2-v4l2-tpg-core.o qv4l2-v4l2-tpg-colors.o qv4l2-moc_qv4l2.o qv4l2-moc_general-tab.o qv4l2-moc_capture-win.o qv4l2-moc_vbi-tab.o qv4l2-qrc_qv4l2.o -lQt5Widgets -lQt5Gui -lQt5Core -lasound ../../lib/libv4l2/.libs/libv4l2.so -lpthread /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/build/libv4l-1.18.0/lib/libv4lconvert/.libs/libv4lconvert.so ../../lib/libv4lconvert/.libs/libv4lconvert.so -lrt -lm -ljpeg ../libv4l2util/.libs/libv4l2util.a ../libmedia_dev/.libs/libmedia_dev.a -largp -pthread -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/build/libv4l-1.18.0/lib/libv4l2/.libs -Wl,-rpath -Wl,/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/build/libv4l-1.18.0/lib/libv4lconvert/.libs /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/7.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: qv4l2-qv4l2.o: undefined reference to symbol '__atomic_fetch_add_4@@LIBATOMIC_1.0'
/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/7.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/sparc-buildroot-linux-uclibc/sysroot/lib/libatomic.so.1: error adding symbols: DSO missing from command line

And is not using the Qt5 *.la files (checked using strace)...

Adding the (missing?) '-L/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib' libtool command line parameter fixes the linking for the actual build...

Any hint which (buildroot?) change triggered the remove of the link/library path removal?

Regards,
Peter

Quoted 6 lines

Could you discuss this with Peter Seiderer (in Cc) ?

Thanks,

Thomas

#4 lore raw

PATCH 2/2 package/libv4l: link with libatomic when needed

Hey,

Quoted 5 lines · Peter Seiderer

Adding the (missing?) '-L/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib' libtool command line parameter fixes the linking for the actual build...

Any hint which (buildroot?) change triggered the remove of the link/library path removal?

As previously discussed [0], the missing -L.. is because pkgconf no longer returns "system" include or library directories with -I and -L (see [1]). These are already in the compiler's default search path and were causing include-order related bugs when using -isystem.

However, it looks like that change has caused a problem here, where the output from pkgconf is being passed to libtool to point it at the "system" library directory in the sysroot.

I don't know enough about libtool yet, but I think there are a few ways around this:
1. Tell libtool where the sysroot is by some other mechanism
2. Tell pkgconf that we want to keep the system lib directories, when it is used to create arguments to libtool. The following argument will always return -L, as expected above:

        pkg-config --keep-system-libs

I'm looking into this, but someone with a more intimate knowledge of libtool + pkg-autotools.mk, might be able to help here.

Thanks,
Thomas Preston

[0] http://lists.busybox.net/pipermail/buildroot/2019-November/266369.html
[1] http://lists.busybox.net/pipermail/buildroot/2019-October/263178.html

#5 lore raw

PATCH 2/2 package/libv4l: link with libatomic when needed

Hello *,

Quoted 18 lines · Thomas Preston

Hey,

Quoted 5 lines · Peter Seiderer

Adding the (missing?) '-L/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib' libtool command line parameter fixes the linking for the actual build...

Any hint which (buildroot?) change triggered the remove of the link/library path removal?

As previously discussed [0], the missing -L.. is because pkgconf no longer returns "system" include or library directories with -I and -L (see [1]). These are already in the compiler's default search path and were causing include-order related bugs when using -isystem.

However, it looks like that change has caused a problem here, where the output from pkgconf is being passed to libtool to point it at the "system" library directory in the sysroot.

Quoted 8 lines

I don't know enough about libtool yet, but I think there are a few ways around this:
1. Tell libtool where the sysroot is by some other mechanism
2. Tell pkgconf that we want to keep the system lib directories, when it is used to create arguments to libtool. The following argument will always return -L, as expected above:

        pkg-config --keep-system-libs

The libv4l/libatomic case can be fixed by the following (hack):

package/libv4l/libv4l.mk +1 -1
index a3bf099221..46c1ab9a48 100644
@@ -16,7 +16,7 @@ LIBV4L_AUTORECONF = YES
 LIBV4L_DEPENDENCIES += host-gettext
 
 # fix uclibc-ng configure/compile
-LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
+LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' PKG_CONFIG_SYSROOT_DIR=$(STAGING_DIR)
 
 # v4l-utils components have different licences, see v4l-utils.spec for details
 LIBV4L_LICENSE = GPL-2.0+ (utilities), LGPL-2.1+ (libraries)

Regards,
Peter

Quoted 10 lines

I'm looking into this, but someone with a more intimate knowledge of libtool + pkg-autotools.mk, might be able to help here.

Thanks,
Thomas Preston

[0] http://lists.busybox.net/pipermail/buildroot/2019-November/266369.html
[1] http://lists.busybox.net/pipermail/buildroot/2019-October/263178.html

#6 lore raw

PATCH 2/2 package/libv4l: link with libatomic when needed

Quoted 8 lines · Peter Seiderer

The libv4l/libatomic case can be fixed by the following (hack):

package/libv4l/libv4l.mk +0 -0
index a3bf099221..46c1ab9a48 100644

package/libv4l/libv4l.mk LIBV4L_AUTORECONF = YES · line 22

Quoted 8 lines
package/libv4l/libv4l.mk +1 -1
@@ -16,7 +16,7 @@ LIBV4L_AUTORECONF = YES
 LIBV4L_DEPENDENCIES += host-gettext
 
 # fix uclibc-ng configure/compile
-LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
+LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' PKG_CONFIG_SYSROOT_DIR=$(STAGING_DIR)
 
 # v4l-utils components have different licences, see v4l-utils.spec for details
 LIBV4L_LICENSE = GPL-2.0+ (utilities), LGPL-2.1+ (libraries)

PKG_CONFIG_SYSROOT_DIR=$(STAGING_DIR) should already be set when we use the PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)". Which is set in TARGET_CONFIGURE_ENV.

Presumably setting PKG_CONFIG_SYSROOT_DIR here causes the system-libs -L flag to return, but I'm not sure why.

I'm building with the failing defconfig [0] to try and reproduce and investigate this.

Thanks

[0] http://autobuild.buildroot.net/results/089/08952dbf89bf3c49da7697943441cee411940420/defconfig

#7 lore raw

PATCH 2/2 package/libv4l: link with libatomic when needed

In reply to Peter Seiderer
Quoted 34 lines · Peter Seiderer
Quoted 16 lines · Thomas Preston
Quoted 5 lines · Peter Seiderer

Adding the (missing?) '-L/home/seiderer/Work/Buildroot/build_sparc_qt5multimedia_001/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib' libtool command line parameter fixes the linking for the actual build...

Any hint which (buildroot?) change triggered the remove of the link/library path removal?

As previously discussed [0], the missing -L.. is because pkgconf no longer returns "system" include or library directories with -I and -L (see [1]). These are already in the compiler's default search path and were causing include-order related bugs when using -isystem.

However, it looks like that change has caused a problem here, where the output from pkgconf is being passed to libtool to point it at the "system" library directory in the sysroot.

Quoted 8 lines

I don't know enough about libtool yet, but I think there are a few ways around this:
1. Tell libtool where the sysroot is by some other mechanism
2. Tell pkgconf that we want to keep the system lib directories, when it is used to create arguments to libtool. The following argument will always return -L, as expected above:

        pkg-config --keep-system-libs

The libv4l/libatomic case can be fixed by the following (hack):

package/libv4l/libv4l.mk +0 -0
index a3bf099221..46c1ab9a48 100644

package/libv4l/libv4l.mk LIBV4L_AUTORECONF = YES · line 22

Quoted 8 lines
package/libv4l/libv4l.mk +1 -1
@@ -16,7 +16,7 @@ LIBV4L_AUTORECONF = YES
 LIBV4L_DEPENDENCIES += host-gettext
 
 # fix uclibc-ng configure/compile
-LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
+LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' PKG_CONFIG_SYSROOT_DIR=$(STAGING_DIR)
 
 # v4l-utils components have different licences, see v4l-utils.spec for details
 LIBV4L_LICENSE = GPL-2.0+ (utilities), LGPL-2.1+ (libraries)

This change works because the Buildroot's pkg-config wrapper script [0] configures the following variables as relative to $(HOST_DIR)/bin:

PKG_CONFIG_SYSROOT_DIR
PKG_CONFIG_SYSTEM_INCLUDE_PATH
PKG_CONFIG_SYSTEM_LIBRARY_PATH

So when you set PKG_CONFIG_SYSROOT_DIR=$(STAGING_DIR) (an absolute path), pkgconf detects the difference and prints the sysroot system lib dirs. These -L flags end up in the QT5_LIBS variable via autoconf.

	--- output/build/libv4l-1.18.0-broken/Makefile  2019-11-21 14:04:00.373262772 +0000
	+++ output/build/libv4l-1.18.0/Makefile 2019-11-21 15:53:40.388627694 +0000
	[snip]
	@@ -385,15 +385,15 @@
	[snip]
	-QT5_LIBS = -lQt5Widgets -lQt5Gui -lQt5Core
	+QT5_LIBS = -L/home/br-user/output/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib -lQt5Widgets -lQt5Gui -lQt5Core
	[snip]

Which in turn, tell libtool to search .../sysroot/usr/lib for the .la files, which contain the appropriate -latomic flag:

	$ grep latomic output/host/sparc-buildroot-linux-uclibc/sysroot/usr/lib/libQt5Widgets.la
	dependency_libs='-latomic  -lQt5Gui -lQt5Core -lpthread -lrt -lpthread -ldl'

The same effect can be achieved by telling pkgconf to keep the system libs:

	diff --git a/package/libv4l/libv4l.mk b/package/libv4l/libv4l.mk
	index a3bf099221..93edbfedd5 100644
	--- a/package/libv4l/libv4l.mk
	+++ b/package/libv4l/libv4l.mk
	@@ -16,7 +16,9 @@ LIBV4L_AUTORECONF = YES
	 LIBV4L_DEPENDENCIES += host-gettext

	 # fix uclibc-ng configure/compile
	-LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
	+LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' PKG_CONFIG_ALLOW_SYSTEM_LIBS=1

	 # v4l-utils components have different licences, see v4l-utils.spec for details
	 LIBV4L_LICENSE = GPL-2.0+ (utilities), LGPL-2.1+ (libraries)

Which I think is the right solution when we use pkgconf to generate flags for libtool.

Thoughts?
Thomas Preston

[0] https://git.buildroot.net/buildroot/tree/package/pkgconf/pkg-config.in

#8 lore raw

PATCH 1/2 package/libv4l: fix musl build

In reply to Bernd Kuhls
Quoted 8 lines · On Wed, 30 Oct 2019 07:53:02 +0100 Bernd Kuhls <[email protected]> wrote:

Fixes:
http://autobuild.buildroot.net/results/bf8/bf88f89bdb966ef54938e4274114d4afe5668b1f/

---
 ...d-missing-includes-to-fix-musl-build.patch | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 package/libv4l/0001-keymap.h-add-missing-includes-to-fix-musl-build.patch

Thanks, applied. However, I have one comment, see below.

Quoted 21 lines
package/libv4l/0001-keymap.h-add-missing-includes-to-fix-musl-build.patch new file +15 -0
new file mode 100644
index 0000000000..238f8fc377
@@ -0,0 +1,68 @@
+From baba68cdcb44fc11d0ba8ce2c13eb5b06bbd9b33 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <[email protected]>
+Date: Wed, 30 Oct 2019 07:15:23 +0100
+Subject: [PATCH] keymap.h: add missing includes to fix musl build
+
+Needed to fix these build errors:
+
+In file included from keymap.c:13:0:
+keymap.h:23:2: error: unknown type name 'u_int32_t'
+  u_int32_t scancode;
+
+keymap.h:36:1: error: unknown type name 'error_t'
+ error_t parse_keymap(char *fname, struct keymap **keymap, bool verbose);
+
+Signed-off-by: Bernd Kuhls <[email protected]>

package/libv4l/0001-keymap.h-add-missing-includes-to-fix-musl-build.patch line 25

Quoted 10 lines
package/libv4l/0001-keymap.h-add-missing-includes-to-fix-musl-build.patch new file +10 -0
+---
+Patch was not sent upstream due to broken mailing list setup:
+
+<[email protected]>: host vger.kernel.org[209.132.180.67] said: 553
+    5.7.1 Hello [xx.xx.xx.xx], for your MAIL FROM address
+    <[email protected]> policy analysis reported: Your address is not
+    liked source for email (in reply to MAIL FROM command)
+
+Hello [xx.xx.xx.xx], for your MAIL FROM address <[email protected]>
+ policy analysis reported: Your address is not liked source for email 

We really want to upstream these patches. vger.kernel.org is a very widely used mailing list service, as it's used for virtually all kernel mailing lists.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

PATCH 1/2 package/libv4l: fix musl build

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

On Wed, 30 Oct 2019 07:53:02 +0100
Bernd Kuhls <[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines

Fixes:
http://autobuild.buildroot.net/results/bf8/bf88f89bdb966ef54938e4274114d4afe5668b1f/

---
...d-missing-includes-to-fix-musl-build.patch | 68 +++++++++++++++++++

1 file changed, 68 insertions(+)

create mode 100644 package/libv4l/0001-keymap.h-add-missing-includes-to-fix-musl-build.patch

Committed to 2019.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard