Skip to contentSkip to conversation

package/icu: fix size requirements

PATCH Superseded Andreas Ziegler 1 participant 8 messages Mar 4 – Mar 10

lore
Share & tools
lore
#0 lore raw

cover package/icu: fix size requirements

TL;DR

Simply adding Unicode capability to a Buildroot project grows the root file system by a stunning 37.6 MiB (more than doubling the root fs size!).

The ICU source ships with a prebuilt data set, containing comprehensive resources for multiple languages, locales and features. This dataset can be tailored to include only those resources necessary on the target system.

Prior to ICU version 58, this was done using an online tool; this website is no longer available (https://unicode-org.atlassian.net/browse/ICU-12977)
(2018-06-28)

Data customization now is built into the code, needs additional sources (downloadable) and a configuration file (user supplied).

Applications in need of Unicode character representation usually link against i18n and uc libraries. These libraries depend on themselves and on the data library:

$ host/bin/aarch64-buildroot-linux-musl-readelf --dynamic \
	target/usr/lib/libicudata.so.78.2 | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
$ host/bin/aarch64-buildroot-linux-musl-readelf --dynamic \
	target/usr/lib/libicuuc.so.78.2 | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libicudata.so.78]
 0x0000000000000001 (NEEDED)             Shared library: [libatomic.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
$ host/bin/aarch64-buildroot-linux-musl-readelf --dynamic \
	target/usr/lib/libicui18n.so.78.2 | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.78]
 0x0000000000000001 (NEEDED)             Shared library: [libicudata.so.78]
 0x0000000000000001 (NEEDED)             Shared library: [libatomic.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]

The command line tools are necessary for building the data library, but not used on the target. The extra libraries are normally not needed on the target system.

After optimization, adding Unicode now grows the file system by 8.2 MiB. Not nice, but tolerable :-)

Andreas Ziegler (3):
DEVELOPERS: add Andreas Ziegler to icu package/icu: rebase patches and add upstream tag package/icu: Upgrade customizing for size

 Config.in.legacy                              | 16 ++++++
 DEVELOPERS                                    |  1 +
 ...0001-dont-build-static-dynamic-twice.patch | 14 +++--
 .../icu/0002-link-icudata-as-data-only.patch  | 27 +++++-----
 package/icu/Config.in                         | 47 +++++++++++++---
 package/icu/icu.mk                            | 54 +++++++++++++------
 6 files changed, 119 insertions(+), 40 deletions(-)
Signature · 5 lines
2.51.0
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/3 DEVELOPERS: add Andreas Ziegler to icu

---
 DEVELOPERS | 1 +
 1 file changed, 1 insertion(+)
DEVELOPERS +1 -0
index 9e983ae113..b6af461dc7 100644
@@ -198,6 +198,7 @@ F:	package/qt5/qt5opcua/
 F:	package/qt6/qt6opcua/
 
 N:	Andreas Ziegler <[email protected]>
+F:	package/icu/
 F:	package/mpd/
 
 N:	Andrey Smirnov <[email protected]>
Signature · 6 lines
2.51.0

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

PATCH 2/3 package/icu: rebase patches and add upstream tag

In reply to Andreas Ziegler

Details originally provided in 0002 are no longer accessible. Upstream tag was missing. For 0003 there exists a pending change.

Rebase 0001 and 0002, add upstream tag, add some background info to 0002.

---
 ...0001-dont-build-static-dynamic-twice.patch | 14 ++++++----
 .../icu/0002-link-icudata-as-data-only.patch  | 27 ++++++++++---------
 2 files changed, 23 insertions(+), 18 deletions(-)
package/icu/0001-dont-build-static-dynamic-twice.patch +9 -5
index ccbe534aa2..7776d57df4 100644
@@ -22,11 +22,15 @@ are running on the system at the same time).
 
 Signed-off-by: Thomas Petazzoni <[email protected]>
 
-Index: b/source/config/mh-linux
-===================================================================
---- a/source/config/mh-linux
-+++ b/source/config/mh-linux
-@@ -35,7 +35,7 @@
+[rebase for 78.2]
+
+Upstream: N/A [Buildroot specific] 
+
+Signed-off-by: Andreas Ziegler <[email protected]>
+---
+--- a/source/config/mh-linux.orig       2026-03-04 09:04:03.693446602 +0100
++++ b/source/config/mh-linux    2026-03-04 09:05:10.741886357 +0100
+@@ -37,7 +37,7 @@
  ## Shared object suffix
  SO = so
  ## Non-shared intermediate object suffix
package/icu/0002-link-icudata-as-data-only.patch +14 -13
index d970e8d30d..ebd000218c 100644
@@ -11,25 +11,26 @@ problem, and is the solution that is used by Debian, see
 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653457.
 
 Signed-off-by: Maxime Hadjinlian <[email protected]>
----
- source/config/mh-linux | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
 
-diff --git a/source/config/mh-linux b/source/config/mh-linux
-index 531a3b2..5a2a7c4 100644
---- a/source/config/mh-linux
-+++ b/source/config/mh-linux
-@@ -21,7 +21,9 @@ LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN
- LD_RPATH_PRE = -Wl,-rpath,
+[rebase for 78.2]
+
+Details + similar implementation:
+https://git.openembedded.org/openembedded-core-contrib/commit/meta/recipes-support/icu?id=644c307f63f0f0b7e97140850d3d1d2124b11b1b
+
+Upstream: N/A [Buildroot specific] 
 
+Signed-off-by: Andreas Ziegler <[email protected]>
+---
+--- a/source/config/mh-linux    2026-03-04 09:05:10.741886357 +0100
++++ b/source/config/mh-linux    2026-03-04 09:09:09.695303165 +0100
+@@ -23,7 +23,9 @@
+ LD_RPATH_PRE = -Wl,-rpath,
+ 
  ## These are the library specific LDFLAGS
 -LDFLAGSICUDT=-nodefaultlibs -nostdlib
 +#LDFLAGSICUDT=-nodefaultlibs -nostdlib
 +# Debian change: linking icudata as data only causes too many problems.
 +LDFLAGSICUDT=
-
+ 
  ## Compiler switch to embed a library name
  # The initial tab in the next line is to prevent icu-config from reading it.
---
-2.0.0.rc2
-
Signature · 5 lines
2.51.0
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH 3/3 package/icu: Upgrade customizing for size

In reply to Andreas Ziegler

Adding Unicode functionality to a project may double the size of the root file system. The method that Buildroot implements to mitigate the data library size went out of fashion with ICU version 58.

Rework package to upgrade data slicing and add more options to customize for size:

remove option to add custom data library
add option to supply custom JSON filter file
download data source archive if data build is requested add option to omit extra libraries from target build and installation disable target build of tools instead of removing post-installation

---
 Config.in.legacy      | 16 +++++++++++++
 package/icu/Config.in | 47 +++++++++++++++++++++++++++++++------
 package/icu/icu.mk    | 54 +++++++++++++++++++++++++++++++------------
 3 files changed, 95 insertions(+), 22 deletions(-)
Config.in.legacy +16 -0
index a2a7b06a6d..a6655a69fc 100644
@@ -144,6 +144,22 @@ endif
 
 ###############################################################################
 
+comment "Legacy options removed in 2026.03"
+
+config BR2_PACKAGE_ICU_CUSTOM_DATA_PATH
+	string "ICU custom data file generation has changed"
+	help
+	  The online tool for generating custom data files is no longer
+	  available.  The data file generation has been integrated into
+	  the ICU build.
+
+	  Reference:  https://unicode-org.atlassian.net/browse/ICU-12977
+
+config BR2_PACKAGE_ICU_CUSTOM_DATA_PATH_WRAP
+	bool
+	default y if BR2_PACKAGE_ICU_CUSTOM_DATA_PATH != ""
+	select BR2_LEGACY
+
 comment "Legacy options removed in 2026.02"
 
 config BR2_PACKAGE_QEMU_TARGET_CRIS
package/icu/Config.in +40 -7

55 lines not on this page · raw message

package/icu/icu.mk +39 -15

93 lines not on this page · raw message

Signature · 5 lines
2.51.0
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

v2 cover package/icu: fix size requirements

In reply to Andreas Ziegler

[ Changes v1 -> v2: rebased (Config.in.legacy changed) ]

TL;DR

Simply adding Unicode capability to a Buildroot project grows the root file system by a stunning 37.6 MiB (more than doubling the root fs size!).

The ICU source ships with a prebuilt data set, containing comprehensive resources for multiple languages, locales and features. This dataset can be tailored to include only those resources necessary on the target system.

Prior to ICU version 58, this was done using an online tool; this website is no longer available (https://unicode-org.atlassian.net/browse/ICU-12977)
(2018-06-28)

Data customization now is built into the code, needs additional sources (downloadable) and a configuration file (user supplied).

Applications in need of Unicode character representation usually link against i18n and uc libraries. These libraries depend on themselves and on the data library:

$ host/bin/aarch64-buildroot-linux-musl-readelf --dynamic \
	target/usr/lib/libicudata.so.78.2 | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
$ host/bin/aarch64-buildroot-linux-musl-readelf --dynamic \
	target/usr/lib/libicuuc.so.78.2 | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libicudata.so.78]
 0x0000000000000001 (NEEDED)             Shared library: [libatomic.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
$ host/bin/aarch64-buildroot-linux-musl-readelf --dynamic \
	target/usr/lib/libicui18n.so.78.2 | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.78]
 0x0000000000000001 (NEEDED)             Shared library: [libicudata.so.78]
 0x0000000000000001 (NEEDED)             Shared library: [libatomic.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]

The command line tools are necessary for building the data library, but not used on the target. The extra libraries are normally not needed on the target system.

After optimization, adding Unicode now grows the file system by 8.2 MiB. Not nice, but tolerable :-)

Andreas Ziegler (3):
DEVELOPERS: add Andreas Ziegler for icu package/icu: rebase patches and add upstream tags package/icu: Fix /enhance customizing for size

 Config.in.legacy                              | 14 +++++
 DEVELOPERS                                    |  1 +
 ...0001-dont-build-static-dynamic-twice.patch | 14 +++--
 .../icu/0002-link-icudata-as-data-only.patch  | 27 +++++-----
 package/icu/Config.in                         | 47 +++++++++++++---
 package/icu/icu.mk                            | 54 +++++++++++++------
 6 files changed, 117 insertions(+), 40 deletions(-)
Signature · 6 lines
2.53.0

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

PATCH v2 1/3 DEVELOPERS: add Andreas Ziegler for icu

In reply to Andreas Ziegler
---
 DEVELOPERS | 1 +
 1 file changed, 1 insertion(+)
DEVELOPERS +1 -0
index 106510ea84..c6e653dbff 100644
@@ -198,6 +198,7 @@ F:	package/qt5/qt5opcua/
 F:	package/qt6/qt6opcua/
 
 N:	Andreas Ziegler <[email protected]>
+F:	package/icu/
 F:	package/mpd/
 
 N:	Andrey Smirnov <[email protected]>
Signature · 6 lines
2.53.0

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

PATCH v2 2/3 package/icu: rebase patches and add upstream tags

In reply to Andreas Ziegler

Details originally provided in 0002 are no longer accessible. Upstream tag was missing. For 0003 there exists a pending change.

Rebase 0001 and 0002, add upstream tags, add some background info to 0002.

---
 ...0001-dont-build-static-dynamic-twice.patch | 14 ++++++----
 .../icu/0002-link-icudata-as-data-only.patch  | 27 ++++++++++---------
 2 files changed, 23 insertions(+), 18 deletions(-)
package/icu/0001-dont-build-static-dynamic-twice.patch +9 -5
index ccbe534aa2..f808583df2 100644
@@ -22,11 +22,15 @@ are running on the system at the same time).
 
 Signed-off-by: Thomas Petazzoni <[email protected]>
 
-Index: b/source/config/mh-linux
-===================================================================
---- a/source/config/mh-linux
-+++ b/source/config/mh-linux
-@@ -35,7 +35,7 @@
+[rebase for 78.2]
+
+Upstream: N/A [Buildroot specific]
+
+Signed-off-by: Andreas Ziegler <[email protected]>
+---
+--- a/source/config/mh-linux.orig       2026-03-04 09:04:03.693446602 +0100
++++ b/source/config/mh-linux    2026-03-04 09:05:10.741886357 +0100
+@@ -37,7 +37,7 @@
  ## Shared object suffix
  SO = so
  ## Non-shared intermediate object suffix
package/icu/0002-link-icudata-as-data-only.patch +14 -13
index d970e8d30d..44781a76e9 100644
@@ -11,25 +11,26 @@ problem, and is the solution that is used by Debian, see
 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653457.
 
 Signed-off-by: Maxime Hadjinlian <[email protected]>
----
- source/config/mh-linux | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
 
-diff --git a/source/config/mh-linux b/source/config/mh-linux
-index 531a3b2..5a2a7c4 100644
---- a/source/config/mh-linux
-+++ b/source/config/mh-linux
-@@ -21,7 +21,9 @@ LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN
- LD_RPATH_PRE = -Wl,-rpath,
+[rebase for 78.2]
+
+Details + similar implementation:
+https://git.openembedded.org/openembedded-core-contrib/commit/meta/recipes-support/icu?id=644c307f63f0f0b7e97140850d3d1d2124b11b1b
+
+Upstream: N/A [Buildroot specific]
 
+Signed-off-by: Andreas Ziegler <[email protected]>
+---
+--- a/source/config/mh-linux    2026-03-04 09:05:10.741886357 +0100
++++ b/source/config/mh-linux    2026-03-04 09:09:09.695303165 +0100
+@@ -23,7 +23,9 @@
+ LD_RPATH_PRE = -Wl,-rpath,
+ 
  ## These are the library specific LDFLAGS
 -LDFLAGSICUDT=-nodefaultlibs -nostdlib
 +#LDFLAGSICUDT=-nodefaultlibs -nostdlib
 +# Debian change: linking icudata as data only causes too many problems.
 +LDFLAGSICUDT=
-
+ 
  ## Compiler switch to embed a library name
  # The initial tab in the next line is to prevent icu-config from reading it.
---
-2.0.0.rc2
-
Signature · 6 lines
2.53.0

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

PATCH v2 3/3 package/icu: Fix /enhance customizing for size

In reply to Andreas Ziegler

Adding Unicode functionality to a project may double the size of the root file system. The method that Buildroot implements to mitigate the data library size went out of fashion with ICU version 58.

Rework package to upgrade data slicing and add more options to customize for size:

remove option to add custom data library
add option to supply custom JSON filter file
download data source archive if data build is requested add option to omit extra libraries from target build and installation disable target build of tools instead of removing post-installation

---
v1 -> v2: rebased (Config.in.legacy changed)

 Config.in.legacy      | 14 +++++++++++
 package/icu/Config.in | 47 +++++++++++++++++++++++++++++++------
 package/icu/icu.mk    | 54 +++++++++++++++++++++++++++++++------------
 3 files changed, 93 insertions(+), 22 deletions(-)
Config.in.legacy +14 -0
index b85a147032..72dcf393f5 100644
@@ -146,6 +146,20 @@ endif
 
 comment "Legacy options removed in 2026.05"
 
+config BR2_PACKAGE_ICU_CUSTOM_DATA_PATH
+	string "ICU custom data file generation has changed"
+	help
+	  The online tool for generating custom data files is no longer
+	  available.  The data file generation has been integrated into
+	  the ICU build.
+
+	  Reference:  https://unicode-org.atlassian.net/browse/ICU-12977
+
+config BR2_PACKAGE_ICU_CUSTOM_DATA_PATH_WRAP
+	bool
+	default y if BR2_PACKAGE_ICU_CUSTOM_DATA_PATH != ""
+	select BR2_LEGACY
+
 config BR2_PACKAGE_PYTHON3_OSSAUDIODEV
 	bool "python3 ossaudiodev module removed"
 	select BR2_LEGACY
package/icu/Config.in +40 -7

55 lines not on this page · raw message

package/icu/icu.mk +39 -15

93 lines not on this page · raw message

Signature · 6 lines
2.53.0

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