fcitx and fcitx mozc

If there's software you need and you can't find, make a request for it.
Post Reply
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

fcitx and fcitx mozc

Post by tsuren »

fcitx (https://fcitx-im.org/wiki/Fcitx) is an alternative to ibus which is basically an IME for those who write things in Chinese, Japeanse or Korean (the CJK). ibus has been great for the past years, but unfortunately the latest stable version does not work well with mozc (the last stable working version was 1.4.2 on my box).

The older version of fcitx is available from slackbuild, but I could not manage to use the script to compile the latest version.

mozc (https://github.com/google/mozc) is the most advanced Japanese IME at the moment. It has dropped its support for ibus recently, and this may pose a big problem for Japanese Linux users in the future. Compiling this beast is also painful but I've managed to do that with the latest release (2.17.2111.102) for ibus (1.4.2). There are some dependencies which I had to get from git and svn (except for protobuf which we have already in our repository - just need to pass "use_libprotobuf=1" for GYP_DEFINES).

Now I've spent almost 2 days before giving up to compile fcitx support for mozc (fcitx-mozc). AUR has some very instructive PKGBUILD.

It would be grateful if anyone could compile the latest fcitx and fcitx-mozc (which is basically mozc + mozc supporting fcitx). I will work on my end as well, but I need also someone to help me out here... :)

Thanks!
'Tommorow is like today, just happens tomorrow.'
djemos
Salix Warrior
Posts: 1433
Joined: 29. Dec 2009, 13:45
Location: Greece

Re: fcitx and fcitx mozc

Post by djemos »

tsuren wrote: The older version of fcitx is available from slackbuild, but I could not manage to use the script to compile the latest version.)
Only fcitx up to 4.2.7 can be compiled (for KDE 4.10.5 or KDE 4.14.3 on slackware current) For newer versions (4.2.8 to 4.2.9) kcm-extra-modules package needed which is part of kde5.
fcitx 4.2.7 for slackware current. You may have to compiled for salix.
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

Re: fcitx and fcitx mozc

Post by tsuren »

Thanks Dimitris,

It's strange that somehow Arch guys can compile it and I have not seen qt5 listed as a dependency. I've tried to compile 4.2.9 with the SLKBUILD, it complained that 'presage' is missing. So I started to compile presage which basically gave an error during compile time.

Anyway, so what I did was to disable the presage.

Code: Select all

	cmake	-DCMAKE_C_FLAGS:STRING=${SLKCFLAGS} \
		-DCMAKE_CXX_FLAGS:STRING=${SLKCFLAGS} \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DLIB_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX} \
		-DENABLE_GTK2_IM_MODULE=On \
		-DENABLE_GTK3_IM_MODULE=On \
		-DENABLE_QT_IM_MODULE=On \
		-DENABLE_OPENCC=Off \
		-DENABLE_PRESAGE=Off\
        ..
Upon running slkbuild, it compained:

Code: Select all

[ 56%] Building C object src/lib/fcitx-gclient/test/CMakeFiles/testgclient.dir/testgclient.c.o
Linking C executable testgclient
/usr/lib/gcc/i486-slackware-linux/4.8.2/../../../../i486-slackware-linux/bin/ld: CMakeFiles/testgclient.dir/testgclient.c.o: undefined reference to symbol 'g_cancellable_cancel'
/usr/lib/gcc/i486-slackware-linux/4.8.2/../../../../i486-slackware-linux/bin/ld: note: 'g_cancellable_cancel' is defined in DSO /usr/lib/libgio-2.0.so.0 so try adding it to the linker command line
/usr/lib/libgio-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [src/lib/fcitx-gclient/test/testgclient] Error 1
make[1]: *** [src/lib/fcitx-gclient/test/CMakeFiles/testgclient.dir/all] Error 2
make: *** [all] Error 2
build() failed.
Beautiful...argh... I will see if fcitx-4.2.7 is sufficient for fcitx-mozc to compile.

BY the way, has everyone already moved to qt5?
'Tommorow is like today, just happens tomorrow.'
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

Re: fcitx and fcitx mozc

Post by tsuren »

OK, so with fcitx-4.2.7, I managed to compile fcitx-mozc without a problem. Here is the key part of SLKBUILD:

Code: Select all

       ...
       #download patches
	fcitx_patchver="2.17.2102.102.1"
	cd $startdir/src
	wget http://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-${fcitx_patchver}.patch
	wget http://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-icon.tar.gz
	tar xvfz fcitx-mozc-icon.tar.gz
	
 	cd $startdir/src/mozc-$pkgver/src
	# Apply fcitx patch
	#cd $startdir/src/mozc-$pkgver/src/unix/fcitx
	rm unix/fcitx -rf
	patch -Np2 -i "$startdir/src/fcitx-mozc-${fcitx_patchver}.patch"

	_jobs=`sed -n -e "s/.*--jobs=\([0-9]\+\).*/\1/p" -e "s/.*-j *\([0-9]\+\).*/\1/p" <<< "$MAKEFLAGS"`
	_jobs=${_jobs:-1}
	
	CFLAGS+=" -I/usr/lib/qt/include/QtGui -I/usr/lib/qt/include/QtCore"
	CXXFLAGS+=" -I/usr/lib/qt/include/QtGui -I/usr/lib/qt/include/QtCore"
	
	QTDIR="/usr/lib/qt" GYP_DEFINES="use_libprotobuf=1 \
									document_dir=/usr/share/doc/$pkgname" \
									python build_mozc.py gyp --target_platform=Linux
  	python build_mozc.py build -j $_jobs -c Release server/server.gyp:mozc_server gui/gui.gyp:mozc_tool unix/fcitx/fcitx.gyp:fcitx-mozc
        ...
fcitx and mozc are working fine at the moment for most applications, except for sakura. I have no idea why the IME is not activated there (ibus was working fine there).
'Tommorow is like today, just happens tomorrow.'
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

Re: fcitx and fcitx mozc

Post by tsuren »

fcitx and mozc are working fine at the moment for most applications, except for sakura. I have no idea why the IME is not activated there (ibus was working fine there).
To run sakura and perhaps some other applications, I just had to run:

Code: Select all

gtk-query-immodules-3.0 --update-cache
in a similar manner to:

Code: Select all

/usr/bin/gtk-query-immodules-2.0 --update-cache
for the gtk2 applications.
'Tommorow is like today, just happens tomorrow.'
Post Reply