Adding option to build ICU Data without assembly at configure
Description
Activity
Also, since you're interested in ICU on WebAssembly, you should take a look at ICU4X. We're still in alpha phase, but we are working on implementing a core subset of ICU functionality in Rust to target environments such as WebAssembly. I'm one of the project leads, and we are always looking for more feedback from users (and PRs if you're interested in helping us implement some features!)
Okay. Once you have a .dat file, you can load it byte-for-byte into a static C function so that you don't need to perform I/O at runtime. The ICU tool "genccode" helps you do this. Once you have your C function, you can use an API in udata.h to load it, such as udata_setCommonData.
The "pkgdata" tool is sort-of an all-in-one tool that just wraps over the lower-level tools like "genccode" and "icupkg". I usually prefer to use the lower-level tools.
@Shane Carr Pardon me for the delay in responding back to you. It seems that I skipped seeing your comment. I am aware regarding loading ICU Data in .dat files format. However, since, we are building ICU for WASM, so, we are preferring building ICU Data in the format of static library itself and when we do so, then, we are getting the error as mentioned in the description because the ICU Data is by default built with assembly for library format.
That’s why in order to pass option -w to pkgdata as suggested in the link http://userguide.icu-project.org/icudata for building ICU Data binary without assembly, we have tried to work on a convenient workaround that involves having an option like --enable-data-without-assembly while calling configure itself that will further involve selectively passing option -w to pkgdata in the corresponding makefile.
CC: @Markus Scherer
If you have an ICU .dat file, you can load that file manually using functions in udata.h, rather than converting it into a .so file with pkgdata. The .dat file is available in the ICU binary distribution and can be built manually using the ICU Data Build Tool.
https://unicode-org.github.io/icu/userguide/icu_data/buildtool.html
Currently, there's no option to pass to configure to build ICU Data without assembly. As mentioned in http://userguide.icu-project.org/icudata, some platform-specific issues may arise with building data with assembly. I have observed that ICU cross-builds fails for WASM on mac because of "Error creating with assembly code". Accordingly, in order to have the option of passing -w to pkgdata as suggested in the above link, it would become much more convenient if there's an option to build ICU data by passing an option like --enable-data-without-assembly while calling configure itself.
I have tried working on adding such kind of option at my end and have checked that it works and by using this option, the cross-build for WASM on Mac is also successful.