Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling the icu sqlite extension statically linked to icu

Tags:

sqlite

icu

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

This is what I've tried, maybe the mistake 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

  • Runs on Linux & Windows
  • Only one file that I have to distribute: libSqliteIcu.so.

Any idea what else I can try?

Documentation

  • Sqlite ICU extension's readme
  • ICU's readme
like image 939
Georg Schölly Avatar asked Nov 30 '09 09:11

Georg Schölly


1 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 

Notice the ordering of the library files, and the use of g++ to make sure the c++ runtime is referenced even though we're compiling a C file.

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

like image 56
Amnon Avatar answered Sep 30 '22 10:09

Amnon