I'm trying to get Qt 4.1.1. to work in coLinux/debian. I've compiled a static version of Qt and I can run non-graphical applications. However, as soon as I try to run something graphical such as designer or assistant I get segfaults. To debug, I started out with this minimal application:

Qt Code:
  1. #include <QApplication>
  2. #include <QMessageBox>
  3.  
  4. int main( int argc, char **argv )
  5. {
  6. QApplication a( argc, argv );
  7.  
  8. QMessageBox::information( 0, "", "Now it works!" );
  9.  
  10. return 0;
  11. }
To copy to clipboard, switch view to plain text mode 
The application builds and work with the message box line commented out, but when I try to run it in the shape that it is above, I get the follow backtrace from gdb:

Qt Code:
  1. (gdb) run
  2. Starting program: /home/johan/coding/testall/testall
  3. [Thread debugging using libthread_db enabled]
  4. [New Thread -1220707488 (LWP 481)]
  5. Qt: gdb: -nograb added to command-line options.
  6. Use the -dograb option to enforce grabbing.
  7.  
  8. Program received signal SIGSEGV, Segmentation fault.
  9. [Switching to Thread -1220707488 (LWP 481)]
  10. 0xb7be83c5 in QFontDatabase::loadXlfd (screen=0, script=0,
  11. request=@0xbfffc890, force_encoding_id=-1) at qfontdatabase_x11.cpp:1678
  12. 1678 qfontdatabase_x11.cpp: No such file or directory.
  13. in qfontdatabase_x11.cpp
  14. (gdb) bt
  15. #0 0xb7be83c5 in QFontDatabase::loadXlfd (screen=0, script=0,
  16. request=@0xbfffc890, force_encoding_id=-1) at qfontdatabase_x11.cpp:1678
  17. #1 0xb7be884a in QFontDatabase::load (d=0x806f968, script=0)
  18. at qfontdatabase_x11.cpp:1751
  19. #2 0xb7b71fae in QFontPrivate::engineForScript (this=0x806f968, script=0)
  20. at qfont_p.h:155
  21. #3 0xb7be3787 in QFontMetricsF::leading (this=0xbffff370)
  22. at text/qfontmetrics.cpp:1047
  23. #4 0xb7b6e8c6 in qt_format_text (fnt=@0xbffff420, _r=@0xbffff430,
  24. tf=134236177, str=@0xbffff570, brect=0xbffff450, tabstops=0,
  25. tabarraylen=0, painter=0x0) at painting/qpainter.cpp:5527
  26. #5 0xb7be2f57 in QFontMetrics::boundingRect (this=0xbffff550, r=@0xbffff4b0,
  27. flgs=2048, str=@0xbffff570, tabstops=0, tabarray=0x0)
  28. at text/qfontmetrics.cpp:688
  29. #6 0xb7be301b in QFontMetrics::size (this=0xbffff550, flgs=2048,
  30. text=@0xbffff570, tabstops=0, tabarray=0x0) at text/qfontmetrics.cpp:720
  31. #7 0xb7d95494 in QPushButton::sizeHint (this=0x8077778)
  32. at widgets/qpushbutton.cpp:379
  33. #8 0xb7e29e77 in QMessageBox::resizeEvent (this=0xbffff830)
  34. at dialogs/qmessagebox.cpp:922
  35. #9 0xb7ab54d8 in QWidget::event (this=0xbffff830, event=0xbffff7a0)
  36. at kernel/qwidget.cpp:5140
  37. #10 0xb7e299c2 in QMessageBox::setButtonText (this=0xbffff830, button=1,
  38. ---Type <return> to continue, or q <return> to quit---
  39. text=@0xbffff820) at dialogs/qmessagebox.cpp:840
  40. #11 0xb7e2ac63 in textBox (parent=0x0, severity=Information,
  41. caption=@0xbffff8f0, text=@0xbffff900, button0Text=@0xbffff910,
  42. button1Text=@0xbffff920, button2Text=@0xbffff930, defaultButtonNumber=0,
  43. escapeButtonNumber=-1) at dialogs/qmessagebox.cpp:1311
  44. #12 0xb7e2adbe in QMessageBox::information (parent=0x0, caption=@0xbffff8f0,
  45. text=@0xbffff900, button0Text=@0xbffff910, button1Text=@0xbffff920,
  46. button2Text=@0xbffff930, defaultButtonNumber=0, escapeButtonNumber=-1)
  47. at dialogs/qmessagebox.cpp:1367
  48. #13 0x08048abf in main (argc=1, argv=0xbffff9e4) at main.cpp:8
To copy to clipboard, switch view to plain text mode 
To me, it looks like it is desc.size->count that fails somehow:
Qt Code:
  1. ...
  2. QList<int> encodings;
  3. if (desc.encoding)
  4. encodings.append(int(desc.encoding->encoding));
  5.  
  6. // append all other encodings for the matched font
  7. for (int i = 0; i < desc.size->count; ++i) {
  8. QtFontEncoding *e = desc.size->encodings + i;
  9. if (e == desc.encoding)
  10. continue;
  11. encodings.append(int(e->encoding));
  12. ...
To copy to clipboard, switch view to plain text mode