Skip to contentSkip to conversation

package/cpp-httplib: link with libatomic if needed

PATCH Applied Bernd Kuhls 2 participants 3 messages Sep 20 – Oct 16

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/cpp-httplib: link with libatomic if needed

Buildroot commit 8dad17ea06260ef0bd23eebc47c95a8510310bf5 bumped the package from 0.27.0 to 0.37.2. This bump includes upstream commit
https://github.com/yhirose/cpp-httplib/commit/464867a9cedef2b6185e25e3e912d3f796fe58fd
which added WebSocket support to version 0.33.0 and causes a build error detected by the Gitlab pipelines for bootlin-sparc-uclibc:

/builds/bkuhls/buildroot/br-test-pkg/bootlin-sparc-uclibc/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/14.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld:
/tmp/cciyXsAR.ltrans6.ltrans.o: in function
`httplib::ws::WebSocket::close(httplib::ws::CloseStatus,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
<artificial>:(.text+0x6408): undefined reference to `__atomic_exchange_1'

To fix the problem we add -latomic to LDFLAGS when needed.

---
v2: Added -latomic to LDFLAGS (Thomas)

Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/2364b86e92f24042ca7f9494b427321527b26adb

 package/cpp-httplib/Config.in      | 2 ++
 package/cpp-httplib/cpp-httplib.mk | 6 ++++++
 2 files changed, 8 insertions(+)
package/cpp-httplib/Config.in +2 -0
index 9bd93ee0af..83251e8eeb 100644
@@ -1,9 +1,11 @@
 comment "cpp-httplib needs a toolchain w/ C++, wchar, threads"
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
 
 config BR2_PACKAGE_CPP_HTTPLIB
 	bool "cpp-httplib"
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_WCHAR
 	help
package/cpp-httplib/cpp-httplib.mk +6 -0
index 94f270df94..c9649936e4 100644
@@ -13,6 +13,12 @@ CPP_HTTPLIB_INSTALL_STAGING = YES
 CPP_HTTPLIB_CONF_OPTS = \
 	-Dtest=false
 
+CPP_HTTPLIB_LDFLAGS = $(TARGET_LDFLAGS)
+
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+CPP_HTTPLIB_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_CPP_HTTPLIB_COMPILE),y)
 CPP_HTTPLIB_CONF_OPTS += -Dcompile=true
 CPP_HTTPLIB_DEPENDENCIES += host-python3
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 13 lines · Bernd Kuhls

Buildroot commit 8dad17ea06260ef0bd23eebc47c95a8510310bf5 bumped the package from 0.27.0 to 0.37.2. This bump includes upstream commit
https://github.com/yhirose/cpp-httplib/commit/464867a9cedef2b6185e25e3e912d3f796fe58fd
which added WebSocket support to version 0.33.0 and causes a build error detected by the Gitlab pipelines for bootlin-sparc-uclibc:

/builds/bkuhls/buildroot/br-test-pkg/bootlin-sparc-uclibc/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/14.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld:
/tmp/cciyXsAR.ltrans6.ltrans.o: in function
`httplib::ws::WebSocket::close(httplib::ws::CloseStatus,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
<artificial>:(.text+0x6408): undefined reference to `__atomic_exchange_1'

Quoted 3 lines

To fix the problem we add -latomic to LDFLAGS when needed.

Applied to master, thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Bernd Kuhls

In reply of:

Quoted 13 lines

Buildroot commit 8dad17ea06260ef0bd23eebc47c95a8510310bf5 bumped the package from 0.27.0 to 0.37.2. This bump includes upstream commit
https://github.com/yhirose/cpp-httplib/commit/464867a9cedef2b6185e25e3e912d3f796fe58fd
which added WebSocket support to version 0.33.0 and causes a build error detected by the Gitlab pipelines for bootlin-sparc-uclibc:

/builds/bkuhls/buildroot/br-test-pkg/bootlin-sparc-uclibc/host/opt/ext-toolchain/bin/../lib/gcc/sparc-buildroot-linux-uclibc/14.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld:
/tmp/cciyXsAR.ltrans6.ltrans.o: in function
`httplib::ws::WebSocket::close(httplib::ws::CloseStatus,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
<artificial>:(.text+0x6408): undefined reference to `__atomic_exchange_1'

Quoted 3 lines

To fix the problem we add -latomic to LDFLAGS when needed.

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 33 lines

---
v2: Added -latomic to LDFLAGS (Thomas)

Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/2364b86e92f24042ca7f9494b427321527b26adb

 package/cpp-httplib/Config.in      | 2 ++
 package/cpp-httplib/cpp-httplib.mk | 6 ++++++
 2 files changed, 8 insertions(+)
package/cpp-httplib/Config.in +2 -0
index 9bd93ee0af..83251e8eeb 100644
@@ -1,9 +1,11 @@
 comment "cpp-httplib needs a toolchain w/ C++, wchar, threads"
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
 
 config BR2_PACKAGE_CPP_HTTPLIB
 	bool "cpp-httplib"
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_WCHAR
 	help
package/cpp-httplib/cpp-httplib.mk +0 -0
index 94f270df94..c9649936e4 100644
@@ -13,6 +13,12 @@ CPP_HTTPLIB_INSTALL_STAGING = YES
 CPP_HTTPLIB_CONF_OPTS = \
 	-Dtest=false

package/cpp-httplib/cpp-httplib.mk CPP_HTTPLIB_INSTALL_STAGING = YES · line 24

Quoted 10 lines
package/cpp-httplib/cpp-httplib.mk +6 -0
 
+CPP_HTTPLIB_LDFLAGS = $(TARGET_LDFLAGS)
+
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+CPP_HTTPLIB_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_CPP_HTTPLIB_COMPILE),y)
 CPP_HTTPLIB_CONF_OPTS += -Dcompile=true
 CPP_HTTPLIB_DEPENDENCIES += host-python3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot