My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
BuildUnix  
如何编译SunPinyin
Featured
Updated Sep 21, 2010 by mikeandm...@gmail.com

依赖组件

为了编译SunPinyin基本库你需要安装以下的工具

  • C++编译器 (sudo aptitude install build-essential)
  • sqlite3 (sudo apt-get install sqlite3 libsqlite3-dev)
  • SCons (sudo apt-get install scons)

如果你偏好ibus,可以安装ibus-wrapper,你需要

  • ibus > 1.2
  • gettext

如果你偏好最简单的xim,可以安装xim-wrapper,你需要

  • gtk > 2.10
  • x11的所有头文件

安装方法

SunPinyin 分为三部分。

  • 后端:就是 SunPinyin 输入法内核/引擎,它负责 SunPinyin 的算法和提供最基本的输入法功能,在 GNU/Linux 上它以动态链接库的形式存在。
  • 前端:就是输入法内核和输入法平台交互的界面 (wrapper),它把后端包装起来,让 ibus, xim, macos 等平台能使用 SunPinyin 输入法。它一般提供一些快捷键,用户界面,和配置的功能。
  • 语言模型:语言模型是一些数据文件,其中包含我们熟悉的词库等数据。语言模型会在编译时下载。

在 GNU/Linux 平台上,前端目前支持 ibus 和 xim。您需要安装SunPinyin输入法后端之后才能安装前端。

输入法引擎的安装方法

编译输入法引擎可以在代码根目录输入

scons

默认情况下的prefix是/usr/local。当然您也可以指定安装prefix。

scons --prefix=/usr

编译成功后可以使用

scons install

如果你之前指定过了prefix,那么这里install的时候一定要用相同的prefix,否则将使用默认prefix安装!

Note: 如果你有特殊的需求希望安装在特殊路径,可以使用--install-sandbox=<dir>选项。这不会改变prefix,只是换了一个拷贝目录而已,这个选项对打包很有用。

你可以使用pkg-config sunpinyin-2.0 --modversion来查看是否安装成功。

删除可以用:

scons -c install

ibus界面(ibus-sunpinyin)的安装方法

你需要先安装输入法引擎,确定你安装好输入法引擎后可以使用

cd wrapper/ibus
scons --prefix=/usr
sudo scons install

对于ibus,建议安装到/usr prefix,主要是因为怕ibus无法加载ibus-sunpinyin。

重启ibus来查看是否安装成功。

xim界面(xsunpinyin)的安装方法

你需要先安装输入法引擎,确定你安装好输入法引擎后可以使用

cd wrapper/xim
scons
sudo scons install

可以运行xsunpinyin来看看有没有输出错误。可以使用xsunpinyin -d 来以daemon模式启动,然而还是推荐你使用发行版的配置方法来自行配置xsunpinyin。对于debian/ubuntu在使用的imswitch,xsunpinyin已经提供了一个配置模版,在wrapper/xim/imswitch/xsunpinyin目录下,仅供参考。

Comment by supercyp...@gmail.com, Jun 8, 2010

scons脚本需要修改啊,能够一次性build corelib和wrappers是很必要的

Comment by loveneme...@gmail.com, Jun 10, 2010

Fedora 13 上在编译 ibus wrapper 的时候失败了,看提示:

ImportError?: No module named textfile:

File "/home/lvp/Build/sunpinyin/wrapper/ibus/SConstruct", line 2:
import SCons.Tool.textfile

然后用 rpm -ql scons 看了下,没有 textfile 这个模块……杯具……

Comment by loveneme...@gmail.com, Jun 10, 2010

倒是 bzr 里面有个叫 textfile.py 的模块……不知到是不是需要的,还没试,睡觉先……

Comment by project member find...@gmail.com, Jun 10, 2010

莫非Fedora 13上的scons版本太低?

Comment by loveneme...@gmail.com, Jun 11, 2010

Fedora 13 里的 scons 是 1.2.0 的,或许真的是版本太低了……

Comment by loveneme...@gmail.com, Jun 11, 2010

给 Fedora 提交了 scons 升级请求:

https://bugzilla.redhat.com/show_bug.cgi?id=603216

Comment by project member mikeandm...@gmail.com, Jun 22, 2010

@supercyper1: 很可惜,sunpinyin以后的wrapper会彻底和隔离开。

Comment by jhuangjiahua@gmail.com, Jul 27, 2010

@mikeandmore 貌似现在 wrapper/ibus 的 SCons 脚本安装后运行还会有些问题,在 ibus 栏也缺图标。

Comment by xia...@gmail.com, Aug 10, 2010

why not have build fedora13 rpm?or some guy provide more useful toturial on install step on fedora13

Comment by iWinux, Aug 18, 2010

gettext is required too.

Comment by iWinux, Aug 18, 2010

测试一下:这个拼音输入法很强大 <== 整句输入 ><

Comment by woner...@gmail.com, Aug 23, 2010

输入pkg-config sunpinyin-2.0 --modversion后显示 “Package sunpinyin-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `sunpinyin-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'sunpinyin-2.0' found” 是什么原因?

Comment by project member mikeandm...@gmail.com, Aug 26, 2010

@woner363 说明没有安装成功。

Comment by duwl...@gmail.com, Aug 27, 2010

出现“ImportError??: No module named textfile:

File "/home/lvp/Build/sunpinyin/wrapper/ibus/SConstruct", line 2: import SCons.Tool.textfile”问题的话是因为 SCons版本太低, 到http://www.scons.org/下载最新版源代, 输入python setup.py install进行安装

Comment by user...@gmail.com, Sep 1, 2010

为什 么 新版本 没有 ./configure 文见 啊

Comment by project member find...@gmail.com, Sep 1, 2010

@user188, 已经改用scons了 :)

Comment by zlfziegf...@gmail.com, Sep 8, 2010

话说wrapper里面有scim文件夹,但是,应该怎么安装到scim呢?

Comment by freeboy....@gmail.com, Sep 14, 2010

在ubuntu10.04下执行 scons --prefix=/usr 出现如下信息,为什么?我看ibus版本是1.3.7的 scons: Reading SConscript files ... Checking for pkg-config... yes Checking for ibus-1.0... no

Comment by mystery...@gmail.com, Sep 17, 2010

@freeboy.jian, 需要安装libibus-dev

Comment by zhchT...@gmail.com, Sep 24, 2010

这里说 xsunpinyin 需要 gtk > 2.10 即可,可是我编译 xsunpinyin-0.0.5-rc1 提示

error: ‘GtkBuilder?’ undeclared
我查了一下 GtkBuilder?是2.12才有的,因此RHEL5系列上的gtk 2.10是没法使用的…… 而且在下载区里面只有最新版本的,请问是否有办法找一个旧版本的不用GtkBuilder?的?或者有什么其他解决方法?谢谢!

Comment by sayno...@gmail.com, Sep 28, 2010

运行xsunpinyin来看看有没有输出错误的时候显示: Startup xim server failed. Your locale is ca,cs,en,es,et,eu,fr,zh,zu,zh_CN.utf8, please file a bug. (xsunpinyin:6335): Gtk-CRITICAL : gtk_widget_set_colormap: assertion `!gtk_widget_get_realized (widget)' failed

什么意思

Comment by zhazhenz...@gmail.com, Dec 11, 2010

Please help, xsunpinyin give me the following error after lanch:

"warning using codeset GB2312 may cause xsunpinyin unable to trigger. "

I have already set LANG and LC_ALL to zh_CN.UTF-8. I dont know what is the "codeset" refering to. And you are right! Indeed, ^SPACE it is not triggering the im :( Where am I doing wrong?

Comment by fan4...@gmail.com, Dec 21, 2010

/usr/local/include/ibus-1.0/ibusconfig.h:111: error: too many arguments to function ‘GVariant ibus_config_get_value(IBusConfig, const gchar, const gchar)’

src/sunpinyin_config.cpp:: error: at this point in file 的编号有:90 107 118 135 146 163 174

这个真不知道怎么解决了

Comment by iTYCHI...@gmail.com, Jan 9, 2011

快崩溃了, 安装ibus-devel,提示: libibus.so.1 is needed by ibus-devel-1.2.0.20091204-2.el6.i686

按照提示,安装缺失的libibus.so.1,提示已经安装: ibus-libs-1.3.4-3.el6.i686 is already installed

为什么已经libibus.so.1已经安装,还说缺少呢?

Comment by huacn...@gmail.com, Jan 17, 2011

我按照步骤都安装成功,并重启ibus了,但是 iBus 的添加列表里面没有看到 sunpinyin 的项呢?

Comment by yrp1...@gmail.com, Jan 22, 2011

在我安装ibus界面(ibus-sunpinyin)时输入scons --prefix=/usr后出现src/sunpinyin_engine.h:41: fatal error: ime-core/imi_option_event.h: 没有那个文件或目录 请问这是怎么回事儿

Comment by yrp1...@gmail.com, Jan 22, 2011

我安装好了sunpinyin ,在ibus里也能调用sunpinyin, 但是却不能使用,调用是总是先卡一下,不出现选词框,然后就是输入的拼音到打字框里。这是怎么回事

Comment by OS.Deb...@gmail.com, Feb 13, 2011

ubuntu10.10下编译安装失败

Checking for C header file locale.h... yes Checking for C function log2()... no //这里是运行install时候的情况 Checking for C header file memory.h... yes Ubuntu10.10下运行 cons --prefix=/usr 出现如下信息,为什么? scons: Reading SConscript files ... Checking for pkg-config... yes Checking for ibus-1.0... no

Comment by OS.Deb...@gmail.com, Feb 13, 2011

我切换到root下安装成功 但ibus下没有选项

Comment by gibeon...@gmail.com, Feb 21, 2011

unbuntu 10.10 缺省安装是没有C++编译器的,因此要装一下。 C++编译器 (sudo aptitude install build-essential)

Comment by gy911...@gmail.com, Jun 16, 2011

接触linux没多久…………………… 刚刚尝试编译 ibus-sunpinyin-2.0.3 但是用 pkg-config sunpinyin-2.0 --modversion 看了一下…… # pkg-config sunpinyin-2.0 --modversion 2.0.1 这个……到底算成功还是失败?我编译的是2.0.3……显示的是2.0.1 ………… 但是图标似乎又是源码包里的那些 - -|所以我就有点搞不太懂了……我是新手……………… 环境嘛…… Ubuntu 10.04 LTS ……

Comment by zzfu...@gmail.com, Jul 8, 2011

按照流程,安装成功里,ibus 列表里也有里,就是切换不了。把 sunpinyin 设置成默认到输入法之后,会很卡,而且打不出来字。

Comment by chunyu...@gmail.com, Sep 22, 2011

安装成功,为什么ibus的列表中没有阿

Comment by zhazhenz...@gmail.com, Oct 17, 2011

还有一个编译条件:硬盘空间要>400M. :-) 我说怎么总是出错。

Comment by Ricky.zh...@gmail.com, Feb 1, 2012

在用scons --prefix=/usr 时会报错,用的是ubuntu的系统, 报错为:Checking for Python library...no 解决方法:安装 python-dev : sudo apt-get install python-dev 就OK了!


Sign in to add a comment
Powered by Google Project Hosting