Skip to contentSkip to conversation

protobuf: Add -latomic to CXXFLAGS

PATCH New Khem Raj 1 participant 1 message Mar 24, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 protobuf: Add -latomic to CXXFLAGS

Adding to LDFLAGS works with LLD linker but not with BFD ld since it gets added before the abseil-cpp libraries on linker cmdline which does not link it and still finds the atomic function like `__atomic_store_8' as missing

Use mipsarcho32 for override which covers both mips and mipsel

Thanks for suggestions - RAED [1]

[1] https://github.com/openembedded/meta-openembedded/pull/952

---
 meta-oe/recipes-devtools/protobuf/protobuf_5.29.4.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta-oe/recipes-devtools/protobuf/protobuf_5.29.4.bb +3 -3
index 9d49e0d3e4..30b805e6b1 100644
@@ -22,8 +22,7 @@ SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=29.x;protocol=ht
            file://0001-fix-protobuf-native-build-failure-with-gcc-10.patch \
            file://0001-utf8_range-add-version-marker-to-library-19009.patch \
            "
-SRC_URI:append:mips:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch "
-SRC_URI:append:mipsel:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch "
+SRC_URI:append:mipsarcho32:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch "
 
 UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.(25\.(\d+)))"
 
@@ -51,7 +50,8 @@ EXTRA_OECMAKE += "\
 TEST_SRC_DIR = "examples"
 LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
 
-LDFLAGS:append:riscv32 = " -latomic"
+CXXFLAGS:append:mipsarcho32 = " -latomic"
+CXXFLAGS:append:riscv32 = " -latomic"
 
 do_compile_ptest() {
 	mkdir -p "${B}/${TEST_SRC_DIR}"