cmacososx-mavericksicu

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?


Solution

  • 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.