Skip to contentSkip to conversation

cutelyst: link with libatomic when needed

PATCH Superseded Fabrice Fontaine 3 participants 6 messages Aug 27, 2018 – Aug 28, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cutelyst: link with libatomic when needed

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

sparc-buildroot-linux-uclibc/sysroot/lib/libatomic.so.1: error adding symbols: DSO missing from command line

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

Fixes:
- http://autobuild.buildroot.net/results/9e307ab9c7067b26d7b33a572204394808e25772

---
 package/cutelyst/cutelyst.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/cutelyst/cutelyst.mk +4 -0
index e8695a7b3a..1f1a5249be 100644
@@ -16,6 +16,10 @@ CUTELYST_CONF_OPTS += \
 	-DPLUGIN_CSRFPROTECTION=ON \
 	-DPLUGIN_VIEW_GRANTLEE=OFF
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
+endif
+
 ifeq ($(BR2_PACKAGE_LIBPWQUALITY),y)
 CUTELYST_CONF_OPTS += -DPLUGIN_VALIDATOR_PWQUALITY=ON
 CUTELYST_DEPENDENCIES += libpwquality
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 cutelyst: link with libatomic when needed

Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

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

sparc-buildroot-linux-uclibc/sysroot/lib/libatomic.so.1: error adding symbols: DSO missing from command line

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

Fixes:
- http://autobuild.buildroot.net/results/9e307ab9c7067b26d7b33a572204394808e25772

---
 package/cutelyst/cutelyst.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/cutelyst/cutelyst.mk +0 -0
index e8695a7b3a..1f1a5249be 100644

package/cutelyst/cutelyst.mk CUTELYST_CONF_OPTS += \ · line 20

Quoted 5 lines
package/cutelyst/cutelyst.mk +2 -0
@@ -16,6 +16,10 @@ CUTELYST_CONF_OPTS += \
 	-DPLUGIN_CSRFPROTECTION=ON \
 	-DPLUGIN_VIEW_GRANTLEE=OFF
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic

I know we are doing this elsewhere as well, but doesn't this override TARGET_LDFLAGS then?

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 cutelyst: link with libatomic when needed

Dear Peter,

Le mar. 28 ao?t 2018 ? 00:00, Peter Korsgaard <[email protected]> a ?crit :

Quoted 29 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

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

sparc-buildroot-linux-uclibc/sysroot/lib/libatomic.so.1: error adding

symbols: DSO missing from command line

Quoted 4 lines

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

Fixes:
-

http://autobuild.buildroot.net/results/9e307ab9c7067b26d7b33a572204394808e25772

package/cutelyst/

Quoted 6 lines
---
 package/cutelyst/cutelyst.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/cutelyst/ renamed from package/cutelyst/cutelyst.mk +0 -0

cutelyst.mk

Quoted 6 lines

index e8695a7b3a..1f1a5249be 100644

package/cutelyst/cutelyst.mk +0 -0
@@ -16,6 +16,10 @@ CUTELYST_CONF_OPTS += \
     -DPLUGIN_CSRFPROTECTION=ON \
     -DPLUGIN_VIEW_GRANTLEE=OFF
Quoted 6 lines

package/cutelyst/cutelyst.mk CUTELYST_CONF_OPTS += \ · line 20

Quoted 2 lines
package/cutelyst/cutelyst.mk +2 -0
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+CUTELYST_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic

I know we are doing this elsewhere as well, but doesn't this override TARGET_LDFLAGS then?

Indeed, we're already doing this for gnuradio but you're right, I will update my patch to use CMAKE_CXX_FLAGS.

Quoted 4 lines

--
Bye, Peter Korsgaard

Best Regards,

Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180828/1d9ec552/attachment.html>

#3 lore raw

PATCH 1/1 cutelyst: link with libatomic when needed

In reply to Fabrice Fontaine

Hello,

Quoted 4 lines · Fabrice Fontaine

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

Quoted 8 lines

sparc-buildroot-linux-uclibc/sysroot/lib/libatomic.so.1: error adding symbols: DSO missing from command line

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

Fixes:
- http://autobuild.buildroot.net/results/9e307ab9c7067b26d7b33a572204394808e25772

If this package unconditionally needs atomic intrinsics, then it also needs to depends on BR2_TOOLCHAIN_HAS_ATOMIC. Indeed, libatomic is not available in gcc < 4.8.

Best regards,

Thomas

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

PATCH 1/1 cutelyst: link with libatomic when needed

Dear Thomas,

Le mar. 28 ao?t 2018 ? 11:59, Thomas Petazzoni <[email protected]> a ?crit :

Quoted 14 lines

Hello,

Quoted 5 lines · Fabrice Fontaine

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

sparc-buildroot-linux-uclibc/sysroot/lib/libatomic.so.1: error adding

symbols: DSO missing from command line

Quoted 5 lines

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

Fixes:
-

Quoted 8 lines

http://autobuild.buildroot.net/results/9e307ab9c7067b26d7b33a572204394808e25772

Quoted 2 lines

If this package unconditionally needs atomic intrinsics, then it also needs to depends on BR2_TOOLCHAIN_HAS_ATOMIC. Indeed, libatomic is not available in gcc < 4.8.

cutelyst does not directly depends on atomic, this dependency is linked to Qt 5.8.
Here is an extrat of qt5base.mk:
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC)$(BR2_PACKAGE_QT5_VERSION_LATEST),yy) # Qt 5.8 needs atomics, which on various architectures are in -latomic define QT5BASE_CONFIGURE_ARCH_CONFIG

        printf 'LIBS += -latomic\n' >$(QT5BASE_ARCH_CONFIG_FILE)

endef

So what should we do?
Should we add a dependency to BR2_TOOLCHAIN_HAS_ATOMIC if BR2_PACKAGE_QT5_VERSION_LATEST in qt5/Config.in?

Quoted 9 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Best Regards,

Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180828/67037aa0/attachment.html>

#5 lore raw

PATCH 1/1 cutelyst: link with libatomic when needed

Hello,

Quoted 2 lines · Fabrice Fontaine

cutelyst does not directly depends on atomic, this dependency is linked to Qt 5.8.

Argh. Ideally, cutelyst should pick this up from Qt's pkg-config file or something like that. But I guess "ideal" and "build system" are not always aligned :-)

Quoted 10 lines

Here is an extrat of qt5base.mk:
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC)$(BR2_PACKAGE_QT5_VERSION_LATEST),yy) # Qt 5.8 needs atomics, which on various architectures are in -latomic define QT5BASE_CONFIGURE_ARCH_CONFIG

        printf 'LIBS += -latomic\n' >$(QT5BASE_ARCH_CONFIG_FILE)

endef

So what should we do?
Should we add a dependency to BR2_TOOLCHAIN_HAS_ATOMIC if BR2_PACKAGE_QT5_VERSION_LATEST in qt5/Config.in?

It depends whether Qt needs atomic intrinsics unconditionally or not. If it does need atomic intrinsics unconditionally, then yes, it needs a BR2_TOOLCHAIN_HAS_ATOMIC dependency.

We should perhaps have an older toolchain that doesn't provide atomic intrinsics to be able to verify this.

*But*, BR2_PACKAGE_QT5_VERSION_LATEST already depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8, so anyway libatomic will always be available, which makes the entire discussion moot.

Except for cutelyst built against Qt5.6, which doesn't need libatomic. So perhaps the link of cutelyst on libatomic should be conditional on the version of Qt5 ?

Best regards,

Thomas

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