icu: fix static linking by adding -lstdc++ to pkg-config

The ICU library requires C++ standard library when linking statically.
Without this, applications using pkg-config --libs --static icu-uc
(e.g. xmlcatalog in libxml2) will fail to link with undefined reference
errors to C++ symbols.

Extend the existing fix for static linking to also add -lstdc++ to the
Libs field, not only Libs.private, when building in static-only mode
(ENABLE_SHARED is not set).

Fixes: https://autobuild.buildroot.org/results/80c/80ce2a1b8ec356dc13e3c51474fe4cac9cbe3cd6
Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
Acked-by: Andreas Ziegler <br025@umbiko.net>
[Arnout:
 - Remove checkpackageignore entry.
 - Improve patch comment.]
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
(cherry picked from commit 66754d7f50)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Shubham Chakraborty
2026-03-28 13:17:07 +05:30
committed by Thomas Perale
parent 934d1d7259
commit d6061d653d
2 changed files with 12 additions and 6 deletions

View File

@@ -405,7 +405,6 @@ package/i7z/0001-fix-build-with-gcc-10.patch lib_patch.Upstream
package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch lib_patch.Upstream
package/icu/0001-dont-build-static-dynamic-twice.patch lib_patch.Upstream
package/icu/0002-link-icudata-as-data-only.patch lib_patch.Upstream
package/icu/0003-fix-static-linking-with-icu-uc.patch lib_patch.Upstream
package/ifmetric/0001-Fix-issue-NETLINK-Packet-too-small-or-truncated-92-1.patch lib_patch.Upstream
package/ifplugd/0001-cross.patch lib_patch.Sob lib_patch.Upstream
package/ifplugd/0002-fix-headers.patch lib_patch.Sob lib_patch.Upstream

View File

@@ -6,21 +6,28 @@ Subject: [PATCH] fix static linking with icu-uc
During static linking with a C application and libicuuc.a,
-lstdc++ is required.
Add -lstdc++ in Libs.private of icu-uc.pc.
Add -lstdc++ in icu-uc.pc. When building a static library only (ENABLE_SHARED is
false) add it to Libs, else add it to Libs.private.
Fixes:
http://autobuild.buildroot.net/results/210/2107f9dfb39eeb6559fb4271c7af8b39aef521ca/
Upstream: Not submitted (old patch)
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
---
source/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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}' >> $@