代码之家  ›  专栏  ›  技术社区  ›  Georg Schölly Crazy Developer

编译静态链接到icu的icu sqlite扩展

  •  6
  • Georg Schölly Crazy Developer  · 技术社区  · 15 年前

    我想编译 icu sqlite extension 静态链接到 icu .

    这就是我尝试过的,也许错误对你来说是显而易见的。

    > 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
    

    文件夹

    icu sqlite扩展

    Download icu.c from sqlite.org

    ICU 4.2.1

    Download ICU4C from icu-project.org

    • 在Linux&窗户
    • 我只需要分发一个文件: libSqliteIcu.so .

    文档

    2 回复  |  直到 15 年前
        1
  •  3
  •   Amnon    15 年前

    这个命令行在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 
    

    注意。 我使用了 icu-config --prefix=../icu/source --ldflags

        2
  •  1
  •   Benoit    15 年前

    我遇到了和你一样的问题。您可以编辑icu\include\utf8.h并替换以下行

              #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];
    

    具有

                  const uint8_t countTrailBytes[256];
    

    这应该能奏效。