# Mathematica9 linux version crash, how to fix it?

Ubuntu 12.04 x86_64 kernel 3.2.0-35-generic Mathematica 9 linux version (x86_64) crashes with errors:

X Error of failed request: BadGC (invalid GC parameter)
Major opcode of failed request: 59 (X_SetClipRectangles)
Resource id in failed request: 0x0
Serial number of failed request: 2266
Current serial number in output stream: 2268

X Error of failed request: BadGC (invalid GC parameter)
Major opcode of failed request: 59 (X_SetClipRectangles)
Resource id in failed request: 0x0
Serial number of failed request: 2267
Current serial number in output stream: 2268

...

The above errors occur when I run command mathematica as a general user. It crashes before GUI is started. However, if I run it as root sudo mathematica, all work well.

Can someone fix this problem?

-
How good are you with the command-line? This answer suggests, that it is a problem with the wrong Qt-libraries. You could use ldd to find out which libraries are used but it's a bit of work. – halirutan Jan 2 at 4:10
Antoher thing: Which desktop-environment are you using? I use the classic gnome (otherwise I have the same system as you) and everything works fine. Have you tried to select a different one? You can do this at the login-screen. – halirutan Jan 2 at 4:13
I use KDE desktop. – goodluck Jan 2 at 4:57
And can you debug what Qt libraries are use? If not, you can come to chat and I help you. – halirutan Jan 2 at 5:31

Thank halirutan very much! It's really the problem of a setting for QT. Mathematica9 crashes when "systemsettings -> Qt Graphics System -> Raster" is selected. This changes the file ~/.kde/env/qt-graphicssystem.sh and hence the QT_GRAPHICSSYSTEM envirenment variable.
QT_GRAPHICSSYSTEM=native  mathematica   # work