开发者

Compiling the icu sqlite extension statically linked to icu

开发者 https://www.devze.com 2022-12-13 00:30 出处:网络
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.

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


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.


I ran into the same problem as you. You can edit icu\include\utf8.h and replace 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];

with

              const uint8_t countTrailBytes[256];

This should do the trick.

0

精彩评论

暂无评论...
验证码 换一张
取 消