Install Chinese Input Method on Ubuntu

Only english in this document because I can only input english now …

fcitx

Download fcitx-3.1.1.tar.bz2 from http://www.fcitx.org/.

tar xjf fcitx-3.1.1.tar.bz2 cd fcitx-3.1.1 ./configure

But I got error message below:

root@ubuntu:/home/fwolf/download/fcitx-3.1.1# ./configure checking for a BSD-compatible install… /usr/bin/install -c checking whether build environment is sane… yes checking for gawk… no checking for mawk… mawk checking whether make sets $(MAKE)… yes checking build system type… i686-pc-linux-gnulibc1 checking host system type… i686-pc-linux-gnulibc1 checking for gcc… gcc checking for C compiler default output file name… configure: error: C compiler cannot create executables See `config.log’ for more details.

The answer is here, and I need crt1.o, which is in libc6-dev

usr/lib/crt1.o libdevel/libc6-dev

ps: how to find where crtl.o is ?

Install libc6-dev using apt-get, and run ./configure successful, then make, but fail:

root@ubuntu:/home/fwolf/download/fcitx-3.1.1# make make all-recursive make[1]: Entering directory `/home/fwolf/download/fcitx-3.1.1′ Making all in doc make[2]: Entering directory `/home/fwolf/download/fcitx-3.1.1/doc’ make[2]: Nothing to be done for `all’. make[2]: Leaving directory `/home/fwolf/download/fcitx-3.1.1/doc’ Making all in tools make[2]: Entering directory `/home/fwolf/download/fcitx-3.1.1/tools’ gcc -g -O2 -INONE -Wall -o mb2txt mb2txt.o -LNONE -lX11 /usr/bin/ld: cannot find -lX11 collect2: ld returned 1 exit status make[2]: *** [mb2txt] Error 1 make[2]: Leaving directory `/home/fwolf/download/fcitx-3.1.1/tools’ make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/fwolf/download/fcitx-3.1.1′ make: *** [all] Error 2

Seems “cannot find -lX11”, so install libx11-dev, make again, error again :

… /home/fwolf/download/fcitx-3.1.1/tools/txt2mb.c:115: undefined reference to `rpl_malloc’ txt2mb.o:/home/fwolf/download/fcitx-3.1.1/tools/txt2mb.c:121: more undefined references to `rpl_malloc’ follow collect2: ld returned 1 exit status …

Comment “#define malloc rpl_malloc” in config.h, then make again, done. About this error, see also here and here.

Command “make install” successful executed, run command “make clean” to remove binaries and object file wile make, and “make distclean” to also remove file created by ./configure.

Then run this two command config fcitx to Xwindows:

sh -c ” echo ‘export XMODIFIERS=@im=fcitx ; export GTK_IM_MODULE=”fcitx” ; fcitx ‘ > /etc/X11/Xsession.d/95xinput ” chmod +755 /etc/X11/Xsession.d/95xinput

Rebooting……Ubuntu or Xwindows, when restarting, I found there is a ime bar, but dispear when Xwindows completely loaded, and ‘ctrl+space’ don’t functional, run fcitx under bash, found error:

fwolf@ubuntu:~/download/fcitx-3.1.1$ fcitx Error: Cannot Create Chinese Fonts: -*-*-medium-r-normal–14-*-*-*-*-*-*-*,-*-Courier-medium-r-normal–14-*-*-*-*-*-*-* Using Default … Error: Cannot Create Chinese Fonts! Error: Cannot Create Chinese Fonts: -*-*-medium-r-normal–16-*-*-*-*-*-*-*,-*-Courier-medium-r-normal–16-*-*-*-*-*-*-* Using Default … Error: Cannot Create Chinese Fonts! Start FCITX error. Another XIM daemon named fcitx is running?

It need chinese fonts, my ubuntu is a english version, seems i need add chinese font support. Command ‘apt-get install ttf-arphic-ukai ttf-arphic-uming’ on ubuntu.org.cn does’nt work, in my ubuntu, chinese font seems to be:

i ttf-arphic-gbsn00lp – “AR PL SungtiL GB” Chinese TrueType font i ttf-arphic-gkai00mp – “AR PL KaitiM GB” Chinese TrueType font b

so: ‘apt-get install ttf-arphic-gbsn00lp ttf-arphic-gkai00mp’ (aptitude search ttf is a good command), but they are all newest version already, so I have to run ‘apt-get install language-pack-gnome-zh language-pack-gnome-zh-base language-pack-zh language-pack-zh-base language-support-zh’ to install whole zh language pack.

After long time download and waiting, language-pack is installed.

Selecting previously deselected package language-support-zh. Unpacking language-support-zh (from …/language-support-zh_20051010_all.deb) … Setting up mozilla-firefox-locale-zh-tw (1.0.4lang20050515-1ubuntu3) … Updating mozilla-firefox chrome registry…done. Setting up openoffice.org2-l10n-zh-cn (1.9.129-0.1ubuntu3) … Setting up openoffice.org2-l10n-zh-tw (1.9.129-0.1ubuntu3) … Setting up openoffice.org2-help-zh-cn (1.9.129-0.1ubuntu5) … Setting up openoffice.org2-help-zh-tw (1.9.129-0.1ubuntu5) … Setting up mozilla-firefox-locale-zh-cn (1.0.4lang20050515-1ubuntu3) … Updating mozilla-firefox chrome registry…done. Setting up language-support-zh (20051010) … Setting up language-pack-zh (20060126) … Setting up language-pack-zh-base (20051011) … Generating locales… zh_CN.UTF-8… done zh_HK.UTF-8… done zh_TW.UTF-8… done Generation complete. Setting up language-pack-gnome-zh (20060126) … Setting up language-pack-gnome-zh-base (20051011) …

But still not working, hmm… search using Google… and find this, so add below:

# enable chinese input method export LC_ALL=zh_CN.UTF-8 export LANG==zh_CN.UTF-8 export XMODIFIERS=@im=fcitx

in .bashrc, so locale changed tu zh_CN.UTF-8, but still “Error: Cannot Create Chinese Fonts!”, so problem is on my chinese font or setting.

fwolf@ubuntu:~$ xlsfonts | grep zh_CN fwolf@ubuntu:~$

I have not install chinese font yet ? I followed this document and run ” sudo gedit /etc/environment”, change it’s content to:

LANGUAGE=”en_US:en” LC_CTYPE=zh_CN.UTF-8 LANG=en_US.UTF-8 GST_ID3_TAG_ENCODING=GBK

(Because I’m english interface)

Restart Xwindows again, My fcitx input bar appeared!!! But can input chinese “invisiblely” , like this picture:

My fcitx input bar appeared!!! But can input chinese 'invisiblely'

It still cannot find chinese font file…so find my chinese font file:

fwolf@ubuntu:~$ xlsfonts | grep gb … -default-song-medium-r-normal–0-0-72-72-m-0-gb2312.1980-0 …

Then edit ~/.fcitx/config(use gedit), if this file cannot display chinese currectly, set ENV to zh_CN.UTF-8 using command “export LANG=zh_CN.UTF-8”, change “显示字体(中)=*” at line 2 to “显示字体(中)=song”, not work. here said fcitx need gbk font, but system have only gb2312 font, need and how do I install gbk font ?

终于搞定了,就是字体设置的问题,但不是需要安装什么字体,而是需要执行”dpkg-reconfigure locales”,然后把zh_CN.GB2312也选择上就可以了,所以说fcitx需要的不是什么gbk字体,而是gb2312字体,网上有些说的和我遇到的实际情况不一样。

估计修改”~/.fcitx/config”文件中的zh_CN.GB2312,改成gbk、utf8什么的应该也可以,但我在前面设置没有成功。

装个中文输入法几乎用去两天时间,翻阅网站无数,太累了,scim的安装和中文美化就在下一篇再写吧。

One thought on “Install Chinese Input Method on Ubuntu”

Leave a Reply

Your email address will not be published. Required fields are marked *