我想编译静态链接到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
Download icu.c from sqlite.org
Download ICU4C from icu-project.org
libSqliteIcu.so
。知道我还能尝试什么吗?
答案 0 :(得分:2)
这个命令行在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
注意库文件的顺序,以及使用g ++来确保即使我们正在编译C文件也引用了c ++运行库。
NB。
我使用了icu-config --prefix=../icu/source --ldflags
的输出。
答案 1 :(得分:1)
我遇到了和你一样的问题。您可以编辑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];
这应该可以解决问题。