From: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
To: buildroot@buildroot.org
Cc: thomas.petazzoni@bootlin.com, romain.naour@gmail.com,
br025@umbiko.net,
Shubham Chakraborty <chakrabortyshubham66@gmail.com>
Subject: [Buildroot] [PATCH v5] icu: fix static linking by adding -lstdc++ to pkg-config
Date: Sat, 28 Mar 2026 13:17:07 +0530 [thread overview]
Message-ID: <20260328074708.98982-1-chakrabortyshubham66@gmail.com> (raw)
In-Reply-To: <20260327094348.193822-1-chakrabortyshubham66@gmail.com>
The ICU library requires C++ standard library when linking statically.
Without this, applications using pkg-config --libs --static icu-uc
will fail to link with undefined reference errors to C++ symbols.
This patch extends the existing fix for static linking to also add
-lstdc++ to the Libs field in the pkg-config file when building
in static-only mode (ENABLE_SHARED is not set).
Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
---
.../0003-fix-static-linking-with-icu-uc.patch | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/package/icu/0003-fix-static-linking-with-icu-uc.patch b/package/icu/0003-fix-static-linking-with-icu-uc.patch
index 36a3d1f696..d74aca8088 100644
--- a/package/icu/0003-fix-static-linking-with-icu-uc.patch
+++ b/package/icu/0003-fix-static-linking-with-icu-uc.patch
@@ -13,14 +13,26 @@ http://autobuild.buildroot.net/results/210/2107f9dfb39eeb6559fb4271c7af8b39aef52
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
- source/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+This patch currently addresses linking against stdc++ for shared-library
+builds. Add -lstdc++ to the static build flags also, to fix 'undefined
+reference' errors when linking programs like xmlcatalog (libxml2)
+with musl static toolchains.
+
+Upstream: Inactive-Upstream [Buildroot specific]
+Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
+---
+ source/Makefile.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
diff -git icu.orig/source/Makefile.in icu/source/Makefile.in
--- icu.orig/source/Makefile.in 2025-03-13 19:31:23.000000000 +0100
+++ icu/source/Makefile.in 2025-09-22 08:56:36.791792784 +0200
-@@ -279,7 +279,7 @@
- @echo "Libs:" '-L$${libdir}' "${ICULIBS_UC}" "${ICULIBS_DT}" '$${baselibs}' >> $@
+@@ -276,10 +276,10 @@
+ @echo "Description: $(PACKAGE_ICU_DESCRIPTION): Common and Data libraries" >> $@
+ @echo "Name: $(PACKAGE)-uc" >> $@
+ ifeq ($(ENABLE_SHARED),)
+- @echo "Libs:" '-L$${libdir}' "${ICULIBS_UC}" "${ICULIBS_DT}" '$${baselibs}' >> $@
++ @echo "Libs:" '-L$${libdir}' "${ICULIBS_UC}" "${ICULIBS_DT}" '$${baselibs}' -lstdc++ >> $@
else
@echo "Libs:" '-L$${libdir}' "${ICULIBS_UC}" >> $@
- @echo "Libs.private:" "${ICULIBS_DT}" '$${baselibs}' >> $@
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2026-03-28 7:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 16:28 [Buildroot] [PATCH] package/icu: fix static linking with icu-uc for musl static toolchains Shubham Chakraborty
2026-03-03 18:21 ` [Buildroot] [PATCH v2] " Shubham Chakraborty
2026-03-26 11:36 ` [Buildroot] [PATCH v3] package/icu: fix static linking with icu-uc Shubham Chakraborty
2026-03-27 4:27 ` Andreas Ziegler
2026-03-27 9:50 ` Shubham Chakraborty
2026-03-27 9:43 ` [Buildroot] [PATCH v4] Extend the existing patch to also add -lstdc++ to the Libs field, fixing static linking issues with libicuuc.a Shubham Chakraborty
2026-03-28 5:30 ` Andreas Ziegler
2026-03-28 8:16 ` Shubham Chakraborty
2026-03-28 7:47 ` Shubham Chakraborty [this message]
2026-03-29 6:33 ` [Buildroot] [PATCH v5] icu: fix static linking by adding -lstdc++ to pkg-config Andreas Ziegler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260328074708.98982-1-chakrabortyshubham66@gmail.com \
--to=chakrabortyshubham66@gmail.com \
--cc=br025@umbiko.net \
--cc=buildroot@buildroot.org \
--cc=romain.naour@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox