If you want to use the SCIM Input Method Editor on Debian (Etch) together with the official Firefox, you will ineviably be presented with:

/opt/firefox/run-mozilla.sh: line 131:  7083 Segmentation fault      "$prog" ${1+"$@"}
zsh: exit 139   /opt/firefox/firefox

Apparently the problem is caused by firefox being linked against libstdc++.so.5 while scim is linked against libstdc++.so.6. So what happens is that when Firefox tries to load the scim GTK_IM_MODULE, the libstdc++.so.6 is loaded into Firefox, and this won’t work because the ABI changed between version 5 and 6 of libstdc++.

This leaves us with three possible solutions:

  1. Compile Firefox yourself and link it against libstdc++.so.6

    I don’t like this solution because it is cumbersome, requires time and space, and has to be repeated for each new version of Firefox.

  2. Refrain from using SCIM and resort to good old XIM X Input Method instead.

    This solution works basically exactly as descibed on the SCIM website.

    You will have to export XMODIFIERS=@im=SCIM and export GTK_IM_MODULE=xim.

    Remember that with XIM, you must also have set LC_CTYPE to the corresponding language, i.e. export LC_CTYPE=zh_CN.gb2312 or else you won’t be able to activate the IME with Ctrl+Space.

    Because of the heavy environment tampering required here, it is most easy to create a little startup script for Firefox that sets the variables accordingly before invocing the firefox.sh script

    The disadvantage of this method is that it uses XIM (for details why this is bad refer to the SCIM documentation) and that you have to fiddle with your locale environment. It also dictates a single language that you have to use. Furthermore, the XIM edit style is always “outside of the application window” — you might or might not like this editing style.

  3. Use the C scim-bridge instead!

    Instead of using the scim GTK_IM_MODULE, there is another GTK_IM_MODULE available called scim-bridge. It is written in C and uses a socket communication with the C++-scim instead of being written in C++ like the scim GTK_IM_MODULE and therefore avoids the libstdc++ problems explained above.

    This package is available in Debian as scim-bridge.

    The scim-bridge is my prefered solution to this problem as it avoids recompilation of Firefox or XIM and features “on the spot” editing style.

    As you’d still want to use the regular scim module for all the other applications, I also recommend using a small Firefox wrapper that sets up the environment like this:

    [ x"$GTK_IM_MODULE" = "xscim" ] && export GTK_IM_MODULE="$GTK_IM_MODULE-bridge"
    /opt/firefox/firefox "$@"

Bonus: To use SCIM with Opera, keep in mind that Opera is a Qt (“KDE”) application. You can either use the XIM method described above and set QT_IM_MODULE to xim, or (prefered) install the packages scim-qtimm and scim-bridge-client-qt. Then you can set QT_IM_MODULE to scim (editing style: “outside of application window”) or scim-bridge (“on spot” editing style).