ICU library libicudata is created with a wrong endianness if the host
and target have different endianness. (e.g. build ICU for qemuppc on
x86-64 host)
See upstream bug report: http://bugs.icu-project.org/trac/ticket/11758

The discussion in oe-core mailing list:
https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg65155.html

The root cause is the native pkgdata can not generate correct icu data
for different endianness. By default, this data is built into the shared
library libicudata that would cause it corrupt. But ICU also provides
additional options for loading the data. With option
--with-data-packaging=archive, ICU outputs a single icudt.dat file which
can be loaded by the library.
See document: http://userguide.icu-project.org/icudata

So for big endian system, we can use the separated data file which
re-generates by icupkg and set the correct ICU_DATA environment variable
to make sure the library can load the data without problems.

Signed-off-by: Yi Zhao <yi.z...@windriver.com>
---
 meta/recipes-support/icu/icu.inc | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta/recipes-support/icu/icu.inc b/meta/recipes-support/icu/icu.inc
index a1ef9ec..4f0aac1 100644
--- a/meta/recipes-support/icu/icu.inc
+++ b/meta/recipes-support/icu/icu.inc
@@ -26,6 +26,8 @@ EXTRA_OECONF = "--with-cross-build=${STAGING_ICU_DIR_NATIVE}"
 EXTRA_OECONF_class-native = ""
 EXTRA_OECONF_class-nativesdk = "--with-cross-build=${STAGING_ICU_DIR_NATIVE}"
 
+EXTRA_OECONF_append_class-target = "${@base_conditional('SITEINFO_ENDIANNESS', 
'be', ' --with-data-packaging=archive', '', d)}"
+TARGET_CXXFLAGS_append = "${@base_conditional('SITEINFO_ENDIANNESS', 'be', ' 
-DICU_DATA_DIR=\\""${datadir}/${BPN}/${PV}\\""', '', d)}"
 
 # strtod_l() is not supported by musl; also xlocale.h is missing
 # It is not possible to disable its use via configure switches or env vars
@@ -44,6 +46,15 @@ do_install_append_class-native() {
        cp -r ${B}/tools ${D}/${STAGING_ICU_DIR_NATIVE}
 }
 
+do_install_append_class-target() {
+    # The native pkgdata can not generate the correct data file.
+    # Use icupkg to re-generate it.
+    if [ "${SITEINFO_ENDIANNESS}" = "be" ] ; then
+        rm -f ${D}/${datadir}/${BPN}/${PV}/icudt59b.dat
+        icupkg -tb ${S}/data/in/icudt59l.dat 
${D}/${datadir}/${BPN}/${PV}/icudt59b.dat
+    fi
+}
+
 PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio"
 
 FILES_${PN}-dev += "${libdir}/${BPN}/"
-- 
2.7.4

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to