Compiling icu sqlite extension statically linked to icu

I want to compile the icu sqlite extension statically linked to icu .

This is what I tried, maybe the error is obvious to you.

  > cd icu / source
 > ./runConfigureIcu Linux --enable-static --with-packaging-format = archive
 ...
 > make

 > cd ../../icu-sqlite
 > gcc -o libSqliteIcu.so -shared icu.c -I ../ icu / source / common
       -I ../ icu / source / i18n -L ../icu/source/lib -lsicuuc -lsicui18n -lsicudata
 ...
 > sqlite3
 > .load "libSqliteIcu.so"
 Undefined symbol utf8_countTrailBytes

Files

icu sqlite extension

Download icu.c from sqlite.org

ICU 4.2.1

Download ICU4C from icu-project.org

My requirements

  • Works on Linux and Windows
  • Only one file I should distribute: libSqliteIcu.so .

Any idea what else I can try?

Documentation

+6
sqlite icu
source share
2 answers

This command line worked for me on Linux:

 g++ -shared --language c -o libSqliteIcu.so icu.c -I../icu/source/common -I../icu/source/i18n -lpthread -lm -L../icu/source/lib -lsicui18n -lsicuuc -lsicudata -lpthread -lm 

Pay attention to the ordering of library files and the use of g ++ to make sure that the C ++ runtime is specified even if we compile the C file.

NB. I used the output icu-config --prefix=../icu/source --ldflags .

+2
source share

I faced the same problem as you. You can edit icu \ include \ utf8.h and replace the following lines

  #ifdef U_UTF8_IMPL
           U_EXPORT const uint8_t 
           #elif defined (U_STATIC_IMPLEMENTATION) ||  defined (U_COMMON_IMPLEMENTATION)
           U_CFUNC const uint8_t
           #else
           U_CFUNC U_IMPORT const uint8_t / * U_IMPORT2?  * / / * U_IMPORT * / 
           #endif
           utf8_countTrailBytes [256];

from

  const uint8_t countTrailBytes [256];

That should do the trick.

+1
source share

All Articles