Skip to contentSkip to conversation

abseil-cpp: Link with libatomic on riscv32

PATCH New Khem Raj 1 participant 2 messages Aug 21, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 abseil-cpp: Link with libatomic on riscv32

64-bit builtins for atomics are not provided by compiler

---
 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250512.1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250512.1.bb +3 -0
index 4afbba963a..d4e616a733 100644
@@ -21,6 +21,9 @@ EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON \
                  -DBUILD_TESTING=OFF    \
                  -DABSL_ENABLE_INSTALL=ON \
                 "
+#  riscv32-yoe-linux-ld.lld: error: undefined reference: __atomic_store_8
+#  >>> referenced by <recipe-sysroot>/usr/lib/libabsl_flags_internal.so.2505.0.0 (disallowed by --no-allow-shlib-undefined)
+LDFLAGS:append:riscv32 = " -latomic"
 
 SYSROOT_DIRS:append:class-nativesdk:mingw32 = " ${bindir}"
 
author
#1 lore raw

PATCH 2/2 re2: Link with libatomic on riscv32

64-bit builtins for atomics are not provided by compiler

---
 meta-oe/recipes-support/re2/re2_2024.03.01.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-support/re2/re2_2024.03.01.bb +3 -0
index 55a834fa42..5b7b241a25 100644
@@ -20,6 +20,9 @@ EXTRA_OECMAKE += " \
 	-DBUILD_SHARED_LIBS=ON \
 	${@bb.utils.contains('PTEST_ENABLED', '1', '-DRE2_BUILD_TESTING=ON', '-DRE2_BUILD_TESTING=OFF', d)} \
 "
+# | riscv32-yoe-linux-ld.lld: error: undefined reference: __atomic_load_8
+# | >>> referenced by libtesting.so (disallowed by --no-allow-shlib-undefined)
+LDFLAGS:append:riscv32 = " -latomic"
 
 do_install_ptest () {
     cp -r ${B}/*_test ${D}${PTEST_PATH}