olbat / icu.cr

A Cystal binding & wrapper to the ICU library
https://olbat.github.io/icu.cr/
GNU General Public License v3.0
11 stars 2 forks source link

The Crystal lib can only be linked to a specific version of ICU #1

Closed olbat closed 7 years ago

olbat commented 7 years ago

For some reasons 1,2,3, most distributions of ICU are compiled using the symbol renaming feature (a suffix containing the ICU version number is added to every symbols in shared objects).

It makes the task of creating a generic Crystal binding more difficult since ABIs of different versions of ICU are 100% incompatible.

For the moment the lib_icu binding has been generated against the version 52 of ICU making it incompatible with any other version of the library.

olbat commented 7 years ago

Here are some ideas to solve the issue:

  1. Use a linker script to rename symbols at linking time
  2. Generate1,2 the binding at install time (via postinstall script in the shard ?)
  3. Generate bindings for the N last versions of ICU (+ a binding without suffixes ) and choose which one to load at compile time
  4. Distribute a version of ICU sources with the library + compile it before the Crystal library
  5. Wait for some "on-the-fly code generation" feature to be integrated in Crystal core
olbat commented 7 years ago

This topic is also discussed on Crystal's google group.

update: see https://gist.github.com/olbat/4a5d6d474efd54e14fbac317b3ae8819

kostya commented 7 years ago

there is also different so names for osx and linux, i write little binding here: https://github.com/kostya/icu/blob/master/src/icu/lib.cr, but it not solve suffixes