gpt4 book ai didi

c++ - 构建库时未定义对 `utf8_nextCharSafeBody_48' icu4c 的引用

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:27:09 25 4
gpt4 key购买 nike

我尝试在使用 ICU 库的 Ubuntu 12.04.2 amd64 上构建 stmd 库 ( http://getassoc.cs.nii.ac.jp/package/stmd-1.1.5.tar.gz )。我已经从 Ubuntu 存储库安装了 libicu-dev(版本:48)并使用以下配置。

./configure --with-icu-config=/usr/bin/icu-config --with-defaultstemmer=SNOWBALL --enable-snowball=yes --enable-kill3number=yes

然后,

make

我收到以下错误..

/bin/bash ./libtool --mode=link g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after-   statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 '-DDEFAULT_STEMMER=SNOWBALL' '-DSTMD_MYSTEMMER_DIR="/usr/local/bin"' -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long    -D_REENTRANT  -I/usr/include  '-DUSE_SNOWBALL=1' -I/usr/local/include -DKILL3NUMBER=1  -L/usr/lib   -ldl -lm   -L/usr/lib -licui18n -licuuc -licudata  -ldl -lm    -L/usr/local/lib -o stmd stmd.o stmc.o sigflg.o nio.o -L.  -L/usr/lib   -ldl -lm   -L/usr/lib -licui18n -licuuc -licudata  -ldl -lm    -L/usr/local/lib -lystem -lstemmer -lexpat -ldl 
libtool: link: g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after-statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -DDEFAULT_STEMMER=SNOWBALL -DSTMD_MYSTEMMER_DIR=\"/usr/local/bin\" -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_REENTRANT -I/usr/include -DUSE_SNOWBALL=1 -I/usr/local/include -DKILL3NUMBER=1 -o stmd stmd.o stmc.o sigflg.o nio.o -L/usr/lib -L/usr/local/lib -L/home/kobkrit/stmd-1.1.5 -licui18n -licuuc -licudata -lm -lystem -lstemmer /usr/lib/x86_64-linux-gnu/libexpat.so -ldl
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf8toutf16':
/home/kobkrit/stmd-1.1.5/normalizer.c:177: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:191: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf16toutf8':
/home/kobkrit/stmd-1.1.5/normalizer.c:227: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:219: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:223: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `normalizer_sparse_tostr':
/home/kobkrit/stmd-1.1.5/normalizer.c:125: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:138: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:140: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `nextchar':
/home/kobkrit/stmd-1.1.5/ngram.c:158: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/ngram.c:150: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `ng_output':
/home/kobkrit/stmd-1.1.5/ngram.c:182: undefined reference to `utf8_appendCharSafeBody_48'
collect2: ld returned 1 exit status
make: *** [stmd] Error 1

似乎是链接器到 ICU 库的问题,所以我查看了 Makefile,我找到了

...
CFLAGS+=$(shell /usr/bin/icu-config --cflags)
CFLAGS+=$(shell /usr/bin/icu-config --cppflags)

LDFLAGS+=$(shell /usr/bin/icu-config --ldflags-searchpath)
LDFLAGS+=$(shell /usr/bin/icu-config --ldflags)
...
(I don't quite sure, does it relate to the problem or not?)

我尝试在 Ubuntu 10.04.4 LTS amd64 上构建 stmd 库,它运行良好并且运行良好。但遗憾的是我的服务器硬件与旧的 Ubuntu 不兼容。请帮忙。

最佳答案

您的命令行:

g++ ... -licui18n -licuuc -licudata  -ldl -lm ... -o stmd stmd.o stmc.o ...

不正确:目标文件和库在命令行上的顺序 matters .

关于c++ - 构建库时未定义对 `utf8_nextCharSafeBody_48' icu4c 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17502187/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com