Skip to content

Disable embedded package data for Android #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

marcprux
Copy link

Embedded ICU data is problematic for Android apps:

  1. It is duplicated for each architecture (aarch64-linux-android/lib_FoundationICU.so 40M, arm-linux-androideabi/lib_FoundationICU.so 37M, x86_64-linux-android/lib_FoundationICU.so 39M)
  2. Native libraries on Android are stored uncompressed in the .apk

These problems result in extremely large Android apps when they depend on FoundationInternationalization. E.g., see https://github.com/skiptools/skipapp-hiya/releases/tag/0.1.0

As discussed at https://forums.swift.org/t/android-app-size-and-lib-foundationicu-so/78399, one possible solution would be to externalize the data and load the data from the file, which could then be shipped compressed as a single asset in the Android app. The app startup process would be responsible for extracting the data from the assets and writing it to a cached location, and then setting the ICU_DATA_DIR_PREFIX to the data's root folder.

This draft PR enables using an external data file on Android by default, and some testing against the macOS-provided /usr/share/icu/icudt74l.dat file shows that it works the same as if the data is embedded.

@parkera
Copy link
Contributor

parkera commented May 13, 2025

This is going to be a problem for getting consistent cross-platform results in the tests for Foundation. I'm not sure what the right answer is, yet.

@parkera
Copy link
Contributor

parkera commented May 13, 2025

Oh - perhaps I misunderstood where we ended up here. We would still ship the data from this project - but as a file loaded at runtime instead of using one provided by the system?

@finagolfin
Copy link
Member

We would still ship the data from this project - but as a file loaded at runtime instead of using one provided by the system?

Yep, that's the idea. 😺 He simply tested against the system macOS data because it was the easiest available.

@parkera
Copy link
Contributor

parkera commented May 13, 2025

Would it be possible to run some of the benchmarks from swift-foundation against this, to see if it makes a difference? We could do that on a non-Android platform as a proxy, if it's easier.

@marcprux
Copy link
Author

We would still ship the data from this project - but as a file loaded at runtime instead of using one provided by the system?

Yes, that is the idea. A icudt76l.dat file would be shipped in the apk's assets, and then at app initialization time, it would be either extracted to a temporary folder and referenced, or else we could load it directly from an asset file descriptor if it is stored uncompressed. That way we would just need to ship the data in a single file, rather than one for each supported architecture.

@marcprux
Copy link
Author

marcprux commented May 14, 2025

Would it be possible to run some of the benchmarks from swift-foundation against this, to see if it makes a difference?

I set up a comparison workflow for this at https://github.com/swift-everywhere/swift-foundation-icu-demo/actions. You can see a result run both with and without externalizing the ICU data file at: https://github.com/swift-everywhere/swift-foundation-icu-demo/actions/runs/15025509227/job/42225156287.

A summary of the mean times when running on macos 15 are as follows. External ICU data seems to average around 5% slower.

Benchmark Packaged ICU External ICU
nextThousandThursdaysInTheFourthWeekOfNovember 1156754090.667 1124947285.333
nextThousandThanksgivings 2705326080.000 2798649344.000
nextThousandThanksgivingsSequence 2713714688.000 2783969280.000
RecurrenceRuleThanksgivings 2217738240.000 2342518784.000
RecurrenceRuleThanksgivingMeals 1312991914.667 1406315178.667
RecurrenceRuleLaborDay 1698168832.000 1778384896.000
RecurrenceRuleBikeParties 1279437482.667 1333264384.000
RecurrenceRuleDailyWithTimes 1063867733.333 1105024341.333
CurrentDateComponentsFromThanksgivings 3218079744.000 3201302528.000
allocationsForFixedCalendars 11387535360.000 13056868352.000
allocationsForCurrentCalendar 13853786112.000 15405678592.000
allocationsForAutoupdatingCurrentCalendar 13971226624.000 14533263360.000
copyOnWritePerformance 253973845.333 277699863.273
copyOnWritePerformanceNoDiff 176326535.529 191021056.000
allocationsForFixedLocale 224423350.857 242649560.615
allocationsForCurrentLocale 193593344.000 208085538.133
allocationsForAutoupdatingCurrentLocale 203891234.133 217083318.857

@parkera
Copy link
Contributor

parkera commented May 14, 2025

Thanks for that data @marcprux. @iCharlesHu - any feedback here? I know you thought a lot about how best to package this data when we set up the project.

@parkera parkera requested review from iCharlesHu and itingliu May 14, 2025 17:13
@marcprux
Copy link
Author

marcprux commented May 21, 2025

@iCharlesHu I'm also wondering where we can get the icudtNl.dat for inclusion. I've been thus-far just testing with the /usr/share/icu/icudt76l.dat file from my machine. I didn't see where the process for creating the icu_packaged_data.h from the data source is happening, but it would be nice if it could be included with this module and then bundled with the Android SDK so that tooling will be able to package it into the .apk and make it available at runtime.

@finagolfin
Copy link
Member

@iCharlesHu, now that 6.1.1 is about to be released, I'm thinking about switching my Android SDK bundle over to using this more conventional dat file loading instead. Marc tells me the header from this repo is generated from an Apple-modified ICU data file though: is there a public copy of that original dat file you used that I can download and ship with Android Foundation instead?

It would be good if this pull checked that original ICU dat file back into this repo, for those of us who need to save space and would rather use this pull over the current shared library approach, which repeats the icudata build for every shipped architecture and takes up a lot more space on constrained mobile app deployments.

@parkera
Copy link
Contributor

parkera commented May 22, 2025

It is derived from https://github.com/apple-oss-distributions/ICU.

@parkera
Copy link
Contributor

parkera commented May 22, 2025

I would like to keep all of our platforms as consistent as possible. The more android (or any platform) specific behaviors we have, the more likely we are to introduce regressions that we don't detect before we ship.

@finagolfin
Copy link
Member

So the idea behind this pull is to use exactly the same icudata as in the header files that this repo currently builds into a shared library for each platform architecture, but simply ship the icudata as a single text file that is loaded at runtime instead.

Are you worried that the icudata will differ or that something will go wrong in that different initialization process? I plan to get this repo set up in an Android CI that regularly runs all the Foundation tests in an Android emulator by this fall. I currently run the Foundation tests natively on my Android phone once a month, only 5-6 tests failing lately, last checked with the Apr. 12 trunk source snapshot. Obviously, the Foundation tests don't check all this ICU data, but it's an indicator.

@parkera
Copy link
Contributor

parkera commented May 22, 2025

Are you worried that the icudata will differ or that something will go wrong in that different initialization process?

Yes, or something else we can't predict now. I'd just like to give @iCharlesHu a chance to chime in here and then we can make a decision about the best way to do this.

@marcprux
Copy link
Author

It is derived from https://github.com/apple-oss-distributions/ICU.

I had seen that repo, but it doesn't contain the icudt76l.dat file itself. Presumably it can be derived from the sources, but I couldn't find instructions anywhere and none of the makefiles worked out of the box, with errors like:

ICU makefiles errors
zap /tmp/ICU % make
# Start of makefile
# SRCROOT=/tmp/ICU
# OBJROOT=/tmp/ICU/build
# DSTROOT=/tmp/ICU/build
2025-05-22 14:52:27.898 xcodebuild[78845:21429681] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0027.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:28.353 xcodebuild[78846:21429722] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0028.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
xcrun: error: Failed to open property list '/private/tmp/ICU/macosx.internal/SDKSettings.plist'
2025-05-22 14:52:28.785 xcodebuild[78847:21429733] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0028.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx.internal'
2025-05-22 14:52:29.213 xcodebuild[78848:21429746] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0029.xcresult
xcodebuild: error: SDK "Path" cannot be located.
# SDKROOT=
# SDKPATH=/
# HOSTSDKPATH=
# RC_ARCHS=arm64
# CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
# CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
2025-05-22 14:52:30.806 xcodebuild[78862:21429823] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0030.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
# OSX_BLDHOST_VERSION_MIN_STRING=.0
2025-05-22 14:52:31.235 xcodebuild[78863:21429837] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0031.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:31.665 xcodebuild[78867:21429870] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0031.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
# BLDHOST_VERSION_MIN_REQUIRED=000
# RC_PLATFORM_NAME=MacOSX
# SDKVERSION=15.4
# IOS_SDK_VERSION=18.4
# RC_EMBEDDEDPROJECT_DIR=
# TZDATA=
# TZAUXFILESDIR=
# TZDATA_SDKPATH=
# SUPPORTS_TEXT_BASED_API=YES
# BUILD_MACHINE_ARCH=arm64
# RC_ARCHS_FIRST=arm64
2025-05-22 14:52:33.663 xcodebuild[78891:21430001] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0033.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:34.099 xcodebuild[78892:21430015] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0034.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx.internal'
# HOSTCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
# HOSTCXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
2025-05-22 14:52:34.536 xcodebuild[78893:21430136] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0034.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:34.982 xcodebuild[78897:21430163] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0034.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:35.428 xcodebuild[78901:21430187] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0035.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:35.860 xcodebuild[78902:21430210] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0035.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:36.304 xcodebuild[78909:21430234] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0036.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
2025-05-22 14:52:36.739 xcodebuild[78914:21430264] Writing error result bundle to /var/folders/zl/wkdjv4s1271fbm6w0plzknkh0000gn/T/ResultBundle_2025-22-05_14-52-0036.xcresult
xcodebuild: error: SDK "macosx.internal" cannot be located.
mkdir -p /tmp/ICU/build/icuhost;
cd /tmp/ICU/build/icuhost; CPPFLAGS=" -DSTD_INSPIRED -isysroot " CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++" CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"/usr/share/icu\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR=\"\\\"/var/db/timezone/icutz\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"icutz44l\\\"\" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden" CXXFLAGS="--std=c++17 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"/usr/share/icu\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR=\"\\\"/var/db/timezone/icutz\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"icutz44l\\\"\" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" TOOLSEXTRAFLAGS="" TZDATA="" DYLD_LIBRARY_PATH="/tmp/ICU/build/usr/local/lib" /tmp/ICU/icu/icu4c/source/runConfigureICU MacOSX --srcdir=/tmp/ICU/icu/icu4c/source --disable-renaming --disable-extras --disable-layout --disable-samples --with-data-packaging=archive --prefix=/usr/local   || ( echo "Error in runConfigureICU.  Contents of config.log:"; cat config.log; exit 1);
export CPP= CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ CPPFLAGS= -DSTD_INSPIRED -isysroot  CFLAGS=-O2 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR="\"/usr/share/icu\"" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR="\"/var/db/timezone/icutz\"" -DU_TIMEZONE_PACKAGE="\"icutz44l\"" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden CXXFLAGS=-O2 --std=c++17 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR="\"/usr/share/icu\"" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR="\"/var/db/timezone/icutz\"" -DU_TIMEZONE_PACKAGE="\"icutz44l\"" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden LDFLAGS= MAKE=
Running ./configure  --srcdir=/tmp/ICU/icu/icu4c/source --disable-renaming --disable-extras --disable-layout --disable-samples --with-data-packaging=archive --prefix=/usr/local for MacOS X (Darwin) using the default compiler

checking for ICU version numbers... release 76.1, library 76.1, unicode version 16.0
checking build system type... aarch64-apple-darwin24.5.0
checking host system type... aarch64-apple-darwin24.5.0
checking whether to build debug libraries... no
checking whether to build release libraries... yes
checking whether the C compiler works... no
configure: error: in '/tmp/ICU/build/icuhost':
configure: error: C compiler cannot create executables
See 'config.log' for more details
/tmp/ICU/icu/icu4c/source/runConfigureICU: ./configure failed
Error in runConfigureICU.  Contents of config.log:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by ICU configure 76.1, which was
generated by GNU Autoconf 2.72.  Invocation command line was

  $ /tmp/ICU/icu/icu4c/source//configure --srcdir=/tmp/ICU/icu/icu4c/source --disable-renaming --disable-extras --disable-layout --disable-samples --with-data-packaging=archive --prefix=/usr/local

## --------- ##
## Platform. ##
## --------- ##

hostname = zap.local
uname -m = arm64
uname -r = 24.5.0
uname -s = Darwin
uname -v = Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000

/usr/bin/uname -p = arm
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
	 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000
Kernel configured for up to 10 processors.
10 processors are physically available.
10 processors are logically available.
Processor type: arm64e (ARM64E)
Processors active: 0 1 2 3 4 5 6 7 8 9
Primary memory available: 64.00 gigabytes
Default processor set: 957 tasks, 4930 threads, 10 processors
Load average: 5.78, Mach factor: 4.50
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt/homebrew/opt/libpq/bin/
PATH: /Users/marc/.swiftly/bin/
PATH: /opt/homebrew/bin/
PATH: /opt/homebrew/sbin/
PATH: /usr/local/bin/
PATH: /System/Cryptexes/App/usr/bin/
PATH: /usr/bin/
PATH: /bin/
PATH: /usr/sbin/
PATH: /sbin/
PATH: /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin/
PATH: /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin/
PATH: /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin/
PATH: /Library/Apple/usr/bin/
PATH: /Users/marc/.cargo/bin/
PATH: /Users/marc/Library/Application Support/JetBrains/Toolbox/scripts/
PATH: /Users/marc/bin/
PATH: /Users/marc/.swiftly/bin/


## ----------- ##
## Core tests. ##
## ----------- ##

configure:3022: looking for aux files: install-sh config.guess config.sub
configure:3035:  trying /tmp/ICU/icu/icu4c/source/
configure:3046:   /tmp/ICU/icu/icu4c/source/install-sh found
configure:3064:   /tmp/ICU/icu/icu4c/source/config.guess found
configure:3064:   /tmp/ICU/icu/icu4c/source/config.sub found
configure:3187: checking for ICU version numbers
configure:3220: result: release 76.1, library 76.1, unicode version 16.0
configure:3233: checking build system type
configure:3249: result: aarch64-apple-darwin24.5.0
configure:3269: checking host system type
configure:3284: result: aarch64-apple-darwin24.5.0
configure:3344: checking whether to build debug libraries
configure:3357: result: no
configure:3362: checking whether to build release libraries
configure:3375: result: yes
configure:3517: checking for C compiler version
configure:3526: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc --version >&5
Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3537: $? = 0
configure:3526: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -v >&5
Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3537: $? = 0
configure:3526: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -V >&5
cc: error: argument to '-V' is missing (expected 1 value)
cc: error: no input files
configure:3537: $? = 1
configure:3526: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -qversion >&5
cc: error: unknown argument '-qversion'; did you mean '--version'?
cc: error: no input files
configure:3537: $? = 1
configure:3526: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -version >&5
cc: error: unknown argument '-version'; did you mean '--version'?
cc: error: no input files
configure:3537: $? = 1
configure:3557: checking whether the C compiler works
configure:3579: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -O2 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR="\"/usr/share/icu\"" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR="\"/var/db/timezone/icutz\"" -DU_TIMEZONE_PACKAGE="\"icutz44l\"" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden  -DSTD_INSPIRED -isysroot   conftest.c  >&5
cc: error: no input files
configure:3583: $? = 1
configure:3624: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "ICU"
| #define PACKAGE_TARNAME "icu4c"
| #define PACKAGE_VERSION "76.1"
| #define PACKAGE_STRING "ICU 76.1"
| #define PACKAGE_BUGREPORT "https://icu.unicode.org/bugs"
| #define PACKAGE_URL "https://icu.unicode.org/"
| /* end confdefs.h.  */
| 
| int
| main (void)
| {
| 
|   ;
|   return 0;
| }
configure:3629: error: in '/tmp/ICU/build/icuhost':
configure:3631: error: C compiler cannot create executables
See 'config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=aarch64-apple-darwin24.5.0
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-O2 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR="\"/usr/share/icu\"" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR="\"/var/db/timezone/icutz\"" -DU_TIMEZONE_PACKAGE="\"icutz44l\"" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=' -DSTD_INSPIRED -isysroot '
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-O2 --std=c++17 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR="\"/usr/share/icu\"" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR="\"/var/db/timezone/icutz\"" -DU_TIMEZONE_PACKAGE="\"icutz44l\"" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden'
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
ac_cv_env_ICULEHB_CFLAGS_set=
ac_cv_env_ICULEHB_CFLAGS_value=
ac_cv_env_ICULEHB_LIBS_set=
ac_cv_env_ICULEHB_LIBS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=
ac_cv_env_PKG_CONFIG_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=aarch64-apple-darwin24.5.0

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR=''
ARFLAGS=''
CC='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc'
CFLAGS='-O2 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR="\"/usr/share/icu\"" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR="\"/var/db/timezone/icutz\"" -DU_TIMEZONE_PACKAGE="\"icutz44l\"" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden'
COMPILE_LINK_ENVVAR=''
CPP=''
CPPFLAGS=' -DSTD_INSPIRED -isysroot '
CXX='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++'
CXXFLAGS='-O2 --std=c++17 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR="\"/usr/share/icu\"" -DMAC_OS_X_VERSION_MIN_REQUIRED=000 -mmacosx-version-min=.0 -DU_TIMEZONE_FILES_DIR="\"/var/db/timezone/icutz\"" -DU_TIMEZONE_PACKAGE="\"icutz44l\"" -DUCONFIG_NO_MF2=1 -isysroot  -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden'
DATA_PACKAGING_MODE=''
DATA_TRUE=''
DEFS=''
DOXYGEN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
ENABLE_DEBUG='0'
ENABLE_RELEASE='1'
ENABLE_RPATH=''
ENABLE_SHARED=''
ENABLE_STATIC=''
EXEEXT=''
EXTRAS_TRUE=''
FUZZER_TRUE=''
GENCCODE_ASSEMBLY=''
HAVE_MMAP=''
ICUDATA_CHAR=''
ICUIO_TRUE=''
ICULEHB_CFLAGS=''
ICULEHB_LIBS=''
ICULIBSUFFIX=''
ICULIBSUFFIXCNAME=''
INSTALL_DATA=''
INSTALL_ICU_CONFIG='true'
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LAYOUTEX_TRUE=''
LDFLAGS=''
LIBCFLAGS=''
LIBCXXFLAGS=''
LIBOBJS=''
LIBS=''
LIB_M=''
LIB_THREAD=''
LIB_VERSION='76.1'
LIB_VERSION_MAJOR='76'
LTLIBOBJS=''
OBJEXT=''
PACKAGE='icu'
PACKAGE_BUGREPORT='https://icu.unicode.org/bugs'
PACKAGE_NAME='ICU'
PACKAGE_STRING='ICU 76.1'
PACKAGE_TARNAME='icu4c'
PACKAGE_URL='https://icu.unicode.org/'
PACKAGE_VERSION='76.1'
PATH_SEPARATOR=':'
PKG_CONFIG=''
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
PLUGINS_TRUE=''
PYTHON=''
RANLIB=''
SAMPLES_TRUE=''
SED=''
SHELL='/bin/sh'
TESTS_TRUE=''
TOOLS_TRUE=''
UCLN_NO_AUTO_CLEANUP=''
UCONFIG_CFLAGS=''
UCONFIG_CPPFLAGS=''
UCONFIG_CXXFLAGS=''
UNICODE_VERSION='16.0'
U_DEFAULT_SHOW_DRAFT=''
U_DISABLE_RENAMING=''
U_ENABLE_DYLOAD=''
U_ENABLE_TRACING=''
U_HAVE_DATA=''
U_HAVE_DIRENT_H=''
U_HAVE_EXTRAS=''
U_HAVE_FUZZER=''
U_HAVE_ICUIO=''
U_HAVE_LAYOUTEX=''
U_HAVE_LIB_SUFFIX=''
U_HAVE_NL_LANGINFO_CODESET=''
U_HAVE_PLACEMENT_NEW=''
U_HAVE_PLUGINS=''
U_HAVE_POPEN=''
U_HAVE_SAMPLES=''
U_HAVE_STRTOD_L=''
U_HAVE_TESTS=''
U_HAVE_TIMEZONE=''
U_HAVE_TOOLS=''
U_HAVE_TZNAME=''
U_HAVE_TZSET=''
U_HAVE_WCHAR_H=''
U_HAVE_WCSCPY=''
U_IS_BIG_ENDIAN=''
U_MAKE=''
U_NL_LANGINFO_CODESET=''
U_OVERRIDE_CXX_ALLOCATION=''
U_TIMEZONE=''
U_TZNAME=''
U_TZSET=''
VERSION='76.1'
ac_ct_CC=''
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build='aarch64-apple-darwin24.5.0'
build_alias=''
build_cpu='aarch64'
build_os='darwin24.5.0'
build_vendor='apple'
cross_buildroot=''
cross_compiling='no'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='aarch64-apple-darwin24.5.0'
host_alias=''
host_cpu='aarch64'
host_os='darwin24.5.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
pkgicudatadir=''
platform=''
platform_make_fragment=''
platform_make_fragment_name=''
prefix='/usr/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
thepkgicudatadir=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "ICU"
#define PACKAGE_TARNAME "icu4c"
#define PACKAGE_VERSION "76.1"
#define PACKAGE_STRING "ICU 76.1"
#define PACKAGE_BUGREPORT "https://icu.unicode.org/bugs"
#define PACKAGE_URL "https://icu.unicode.org/"

configure: exit 77
make: *** [/tmp/ICU/build/icuhost/makefile] Error 1

The other option could be to craft a simple CLI that includes icu_packaged_data.cpp and just exports the raw U_ICUDATA_ENTRY_POINT bytes. It would be run at some point during the Android SDK build process to generate the data file. That way we'd be guaranteed to be using the exact same bytes that would otherwise be included in the shared object file.

This could also be interesting because we could generate both a fat lib_FoundationICU.so that includes the data as well as a thin lib_FoundationICU.so with a icudt76l.dat in a separate directory, and it would be up to the packaging utility to choose which one to use when assembling the apk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants