一、下载scim-pinyin-0.5.91和scim-1.4.9源码,并放在同一路径下,方便设置路径环境变量。
二、进入scim-pinyin-0.5.91源码,执行./configure,然后make,会出现如下错误:
Q1问题1:scim.pc找不到
checking for scim >= 1.2.0... Package scim was not found in the pkg-config search path. Perhaps you should add the directory containing `scim.pc' to the PKG_CONFIG_PATH environment variable No package 'scim' found
configure: error: Library requirements (scim >= 1.2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.
A1解决方案:
将scim-1.4.9源码下的scim.pc拷贝至pinyin源码目录下,并设置环境变量export PKG_CONFIG_PATH=./
修改scim.pc文件:
1 prefix=/usr
2 exec_prefix=${prefix}
3 libdir=${exec_prefix}/lib
4 includedir=${prefix}/include
5 localedir=${prefix}/share/locale
6 datadir=${prefix}/share
7 sysconfdir=${prefix}/etc
8
9 scimdatadir=${prefix}/share/scim
10 icondir=${prefix}/share/scim/icons
11 moduledir=${exec_prefix}/lib/scim-1.0/1.4.0
12
13 scim_binary_version=1.4.0
14
15 Name: SCIM
16 Description: Smart Common Input Method platform
17 Version: 1.4.9
18 Requires:
19 Libs: -L${libdir} -lscim-1.0
20 Cflags: -I/home/san/Desktop/samba/inputmethod/scim/scim-1.4.9/src
Q2问题2: scim.h头文件找不到
scim_pinyin_imengine.cpp:36:18: error: scim.h: No such file or directory
A2解决方案:
20 Cflags: -I/home/san/Desktop/samba/inputmethod/scim/scim-1.4.9/src
Q3问题3:标准库找不到
scim_pinyin.cpp: In member function 'void PinyinValidator::initialize(const PinyinTable*)':
scim_pinyin.cpp:687: error: 'memset' was not declared in this scope
scim_pinyin.cpp: In member function 'virtual int PinyinDefaultParser::parse_one_key(const PinyinValidator&, PinyinKey&, const char*, int) const':
scim_pinyin.cpp:829: error: 'strlen' was not declared in this scope
scim_pinyin.cpp: In member function 'virtual int PinyinDefaultParser::parse(const PinyinValidator&, PinyinParsedKeyVector&, const char*, int) const':
scim_pinyin.cpp:882: error: 'strlen' was not declared in this scope
scim_pinyin.cpp: In member function 'int PinyinDefaultParser::parse_initial(PinyinInitial&, const char*, int) const':
scim_pinyin.cpp:1027: error: 'strlen' was not declared in this scope
scim_pinyin.cpp: In member function 'int PinyinDefaultParser::parse_final(PinyinFinal&, const char*, int) const':
scim_pinyin.cpp:1060: error: 'strlen' was not declared in this scope
scim_pinyin.cpp: In member function 'virtual int PinyinShuangPinParser::parse_one_key(const PinyinValidator&, PinyinKey&, const char*, int) const':
scim_pinyin.cpp:1113: error: 'strlen' was not declared in this scope
scim_pinyin.cpp: In member function 'virtual int PinyinShuangPinParser::parse(const PinyinValidator&, PinyinParsedKeyVector&, const char*, int) const':
scim_pinyin.cpp:1206: error: 'strlen' was not declared in this scope
scim_pinyin.cpp: In member function 'bool PinyinTable::input(std::istream&)':
scim_pinyin.cpp:1569: error: 'strlen' was not declared in this scope
scim_pinyin.cpp:1569: error: 'strncmp' was not declared in this scope
scim_pinyin.cpp:1580: error: 'strlen' was not declared in this scope
scim_pinyin.cpp:1580: error: 'strncmp' was not declared in this scope
A3解决方案:
在scim_pinyin.cpp中包含cstring头文件
30 #define Uses_C_STRING
31
32 #include <scim.h>
33 #include "scim_pinyin.h"
类似的还有scim_phrase.cpp、scim_pinyin_phrase.cpp和scim_special_table.cpp。
Q4问题4:找不到动态连接库libscim-1.0.so
g++ -shared -nostdlib /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.3.3/crtbeginS.o .libs/pinyin_la-scim_pinyin_imengine.o -Wl,--whole-archive ./.libs/libpinyin.a -Wl,--no-whole-archive -lscim-1.0 -L/usr/lib/gcc/i486-linux-gnu/4.3.3 -L/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.3.3/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i486-linux-gnu/4.3.3/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crtn.o -Wl,-soname -Wl,pinyin.so -Wl,-retain-symbols-file -Wl,.libs/pinyin.exp -o .libs/pinyin.so
/usr/bin/ld: cannot find -lscim-1.0
解决方案:
export LD_LIBRARY_PATH=/home/san/Desktop/samba/inputmethod/scim/scim-1.4.9/src/.libs/
注意:只能用绝对路径!