Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate or find C headers for ICU core on OSX

Unfortunately apple has not included header files for libicucore on OSX. Is there any way I can nevertheless use this library? I only need some simple functionality and ICU is too big to bundle with my app. It looks like ICU version 53.1.0 which is fairly recent:

jeroen$ otool -L /usr/lib/libicucore.dylib
libicucore.dylib:
    /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 53.1.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

What complicates things is that I have a hard time finding out what is included with the core target of ICU. I can use nm to manually check if a particular symbol is present in the library:

jeroen$ nm /usr/lib/libicucore.dylib | grep ToUpper
00000000000b74c9 T _u_strToUpper
000000000006ff70 T _ucasemap_utf8ToUpper

Now I can manually grab the headers for u_strToUpper from the 53.1.0 release of ICU, but that is a lot of work. Is there a better way to find or generate the headers for ICU core 53.1.0 on OSX?

like image 390
Jeroen Ooms Avatar asked Jun 06 '15 17:06

Jeroen Ooms


2 Answers

You can download header files from Apple's or ICU's official websites and link against the system's libicucore library. But you can't upload a product to App Store or Mac App Store. It will be immediately rejected as one that uses private API. iTunes Connect has an automatic script that detects such references after you upload a new binary.

like image 161
Andriy Avatar answered Sep 24 '22 16:09

Andriy


It looks like my best bet is grabbing the headers from the apple website. This repository also includes the makefile for libicucore.dylib which uses --with-data-packaging=archive to put the ICU data tables in a standalone file /usr/share/icu/icudt51l.dat.

like image 43
Jeroen Ooms Avatar answered Sep 24 '22 16:09

Jeroen Ooms