构建适用于 iOS 的 ICU
Build ICU for iOS
我需要iPhone的ICU库。我试图从 souce 构建它,但是,我得到了这个错误:
clang++ ... /Users/petr/Development/icu-cross-compile-master/icu-60-2/source/tools/pkgdata/pkgdata.cpp
/Users/petr/Development/icu-cross-compile-master/icu-60-2/source/tools/pkgdata/pkgdata.cpp:544:18: error: call to unavailable function 'system': not available on iOS
int result = system(cmd);
^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk/usr/include/stdlib.h:195:6: note: candidate function has been explicitly made unavailable
int system(const char *) __DARWIN_ALIAS_C(system);
sh ${ICU_SOURCE}/configure --host=arm-apple-darwin --with-cross-build=${PREBUILD_DIR} ${PREFIX}
我的PREFIX
配置如下:
--enable-extras=yes
--enable-tools=yes
--enable-icuio=yes
--enable-strict=no
--enable-static
--enable-shared=no
--enable-tests=yes
--disable-renaming
--enable-samples=no
--enable-dyload=no
--with-data-packaging=static
还是有其他方法,如何生成libicudata.a
?类似的构建脚本适用于Android,Mac和Win。只有iPhone是问题。
问题是 iOS 11 已弃用system()
。
我认为快速修复您的方法是使用 Xcode 6,而不是 Xcode 9,因此您可以针对 iOS 7 进行编译作为目标,其中 system(( 未被弃用。
或者,如果你真的需要 iOS 完全兼容的解决方案,你需要重写 ICU 源代码以使用 posix 生成功能而不是 system((。查看此答案以获取更多详细信息:如何使用posix_spawn替换已弃用的"系统"以在Objective-C中启动opendiff?
在 iOS 上成功构建 ICU 作为库的另一种解决方案是不使用配置标志 --build-tools=no 的工具进行构建。以下是我用于为各种平台(包括 android 和 ICU(构建的完整配置标志集。
--enable-static=yes
--enable-shared=no
--enable-extras=no
--enable-strict=no
--enable-icuio=no
--enable-layout=no
--enable-layoutex=no
--enable-tests=no
--enable-samples=no
--enable-tools=no
--enable-dyload=no
--with-data-packaging=archive
我刚刚制作了一个makefile,它将下载ICU源代码并为Mac,Catalyst,iOS Simulator和iOS创建一个通用框架。然后,只需将其拖放到您的项目中即可。
https://github.com/dbquarrel/icu4c-xcframework
可能会帮助你(虽然晚了很多年(。
我的用途是在 sqlite for iOS 中启用 ICU 分词器。
相关文章:
- 使用ios:ate写入到流会覆盖现有文件
- 如何访问RTCVideoRenderer的帧?(ios)
- ios::fmtflags 在 C++ 中是如何工作的?setf() 是如何工作的?
- 我可以在 iOS 或 mac 应用程序中使用C++代码吗?
- "string.h"在构建适用于iOS的qt应用程序中找不到消息
- 如何在 Linux for Windows 上通过 MinGW 构建静态 ICU 的 Boost
- 为什么 C++ 11 在 ios 类中添加了运算符 bool
- 'string'文件在带有C++文件的iOS插件上找不到
- 文件模式标志"ios::app"是否用于删除文件(如果文件已存在)?
- 检测 ICU 库在 VS2017 中失败
- 如何调整ICU的UnicodeString::caseCompare(或获得相同的效果)
- 使用 C++ iOS::ate 获取错误的文件大小
- 使用 适用于 Android 和 iOS 的 tf-lite C++ API
- 如何正确设置 ios 标志以进行流操作?
- 在为 iOS 构建 aws-sdk-cpp 时,cmake 上的 CXX 编译器错误已损坏
- C++ std::locale( "en" ) 在 iOS 上引发异常
- 在瓦尔格林德的泄漏摘要中使用 std::ios::sync_with_stdio(fasle) 打印时获取"still reachable"
- 在iOS应用程序中创建数据库
- Qt & Firebase C++ SDK 在 iOS 上的链接问题
- 构建适用于 iOS 的 ICU