Skip to contentSkip to conversation

package/sysrepo: link with libatomic when needed

PATCH New Fabrice Fontaine 3 participants 5 messages Oct 31, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 package/sysrepo: 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:

/home/buildroot/autobuild/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/7.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: libsysrepo.so.0.7.8: undefined reference to `__atomic_fetch_add_4'

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

Fixes:
- http://autobuild.buildroot.org/results/d807f3dc922a61e099a66de3bc340c018a86e150

---
 package/sysrepo/sysrepo.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/sysrepo/sysrepo.mk +4 -0
index 31317d6236..72c380768d 100644
@@ -29,6 +29,10 @@ SYSREPO_CONF_OPTS = \
 # build .. https://github.com/sysrepo/sysrepo/issues/947
 SYSREPO_CONF_OPTS += -DUSE_SR_MEM_MGMT=OFF
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
+endif
+
 define SYSREPO_INSTALL_INIT_SYSV
 	$(INSTALL) -m 755 -D package/sysrepo/S50sysrepod \
 		$(TARGET_DIR)/etc/init.d/S50sysrepod
Signature · 1 line
2.23.0
#1 lore raw

PATCH v3 2/3 package/sysrepo: needs NPTL

sysrepo needs pthread_rwlock_timedrdlock

Fixes:
- http://autobuild.buildroot.org/results/f0e4368977f257d76aedff335af3068deafaf28f

---
Changes v1 -> v2 (after review of Baruch Siach):
- Update package dependency and not only the comment

 package/sysrepo/Config.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/sysrepo/Config.in +3 -3
index 3ad6040858..64050adfda 100644
@@ -3,7 +3,7 @@ config BR2_PACKAGE_SYSREPO
 	depends on BR2_USE_MMU # libnetconf2
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HAS_NPTL
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" # host-protobuf
 	select BR2_PACKAGE_LIBAVL
@@ -28,8 +28,8 @@ config BR2_PACKAGE_SYSREPO_EXAMPLES
 
 endif
 
-comment "sysrepo needs a toolchain w/ C++, threads, dynamic library, gcc >= 4.8"
+comment "sysrepo needs a toolchain w/ C++, NPTL, dynamic library, gcc >= 4.8"
 	depends on BR2_USE_MMU
 	depends on BR2_STATIC_LIBS || !BR2_INSTALL_LIBSTDCPP \
-		|| !BR2_TOOLCHAIN_HAS_THREADS
+		|| !BR2_TOOLCHAIN_HAS_NPTL
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
Signature · 1 line
2.23.0
#2 lore raw

PATCH v3 3/3 package/sysrepo: fix debug build

In reply to Fabrice Fontaine

Set IS_DEVELOPER_CONFIGURATION to OFF to avoid a build failure due to files being installed in wrong directory

Fixes:
- http://autobuild.buildroot.org/results/bcd9bdd3bc83c1f2ab0b24348d51de27d88649b4

---
Changes v2 -> v3:
- fix typo in package's name

 package/sysrepo/sysrepo.mk | 1 +
 1 file changed, 1 insertion(+)
package/sysrepo/sysrepo.mk +1 -0
index 72c380768d..8676158a19 100644
@@ -13,6 +13,7 @@ SYSREPO_DEPENDENCIES = libev libnetconf2 libavl libyang pcre protobuf-c host-sys
 HOST_SYSREPO_DEPENDENCIES = host-libev host-libnetconf2 host-libavl host-libyang host-pcre host-protobuf-c
 
 SYSREPO_CONF_OPTS = \
+	-DIS_DEVELOPER_CONFIGURATION=OFF \
 	-DGEN_PYTHON2_TESTS=OFF \
 	-DENABLE_TESTS=OFF \
 	-DGEN_CPP_BINDINGS=OFF \
Signature · 1 line
2.23.0
#3 lore raw

PATCH v3 3/3 package/sysrepo: fix debug build

Am Do., 31. Okt. 2019 um 14:14 Uhr schrieb Fabrice Fontaine <[email protected]>:

Quoted 8 lines

Set IS_DEVELOPER_CONFIGURATION to OFF to avoid a build failure due to files being installed in wrong directory

Fixes:
- http://autobuild.buildroot.org/results/bcd9bdd3bc83c1f2ab0b24348d51de27d88649b4

I was struggling with that issue since some hours ;-) thanks for that patch

Quoted 22 lines

---
Changes v2 -> v3:
- fix typo in package's name

 package/sysrepo/sysrepo.mk | 1 +
 1 file changed, 1 insertion(+)
package/sysrepo/sysrepo.mk +1 -1
index 72c380768d..8676158a19 100644
@@ -13,6 +13,7 @@ SYSREPO_DEPENDENCIES = libev libnetconf2 libavl libyang pcre protobuf-c host-sys
 HOST_SYSREPO_DEPENDENCIES = host-libev host-libnetconf2 host-libavl host-libyang host-pcre host-protobuf-c
 
 SYSREPO_CONF_OPTS = \
+       -DIS_DEVELOPER_CONFIGURATION=OFF \
        -DGEN_PYTHON2_TESTS=OFF \
        -DENABLE_TESTS=OFF \
        -DGEN_CPP_BINDINGS=OFF \
--

2.23.0

#4 lore raw

PATCH v3 1/3 package/sysrepo: link with libatomic when needed

In reply to Fabrice Fontaine
Quoted 8 lines · On Thu, 31 Oct 2019 14:15:05 +0100 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:

/home/buildroot/autobuild/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/7.4.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: libsysrepo.so.0.7.8: undefined reference to `__atomic_fetch_add_4'

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

Quoted 7 lines

Fixes:
- http://autobuild.buildroot.org/results/d807f3dc922a61e099a66de3bc340c018a86e150

---
 package/sysrepo/sysrepo.mk | 4 ++++
 1 file changed, 4 insertions(+)

Series applied, thanks!

Thomas

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