Random rants from a KDE user which also works on making KDE more Hebrew friendly.

Monday, January 25, 2010

Bootstrapping Qt using clang

Step 1  - checkout LLVM/Clang
mkdir -p ~/src
cd ~/src
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../../
mkdir build-cmake
cd build-cmake ../
make -j 334

Step 2 - checkout Qt, and configure it usig (the non installed) clang
cd ~/src
git clone http://git.gitorious.org/qt/qt.git 
cd qt
export CC
export CXX

Step 3
[elcuco@pinky ~/src/gitorious/qt] gdb ./bin/qmake
GNU gdb (GDB) Fedora (7.0.1-29.fc12)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /home/elcuco/src/gitorious/qt/bin/qmake...(no debugging symbols found)...done.
(gdb) r
Starting program: /home/elcuco/src/gitorious/qt/bin/qmake

Program received signal SIGSEGV, Segmentation fault.
0x08258211 in toLatin1_helper(QChar const*, int) ()
Missing separate debuginfos, use: debuginfo-install glibc-2.11.1-1.i686 libgcc-4.4.2-20.fc12.i686 libstdc++-4.4.2-20.fc12.i686
(gdb) bt
#0  0x08258211 in toLatin1_helper(QChar const*, int) ()
#1  0x08258168 in QString::toLatin1() const ()
#2  0x082582cc in QString::toLocal8Bit() const ()
#3  0x0827d12e in locale_encode(QString const&) ()
#4  0x0827e746 in QFile::encodeName(QString const&) ()
#5  0x0828170b in QFSFileEnginePrivate::nativeInitFileName() ()
#6  0x08288752 in QFSFileEngine::QFSFileEngine(QString const&) ()
#7  0x082c5d5e in QAbstractFileEngine::create(QString const&) ()
#8  0x082b5d4a in QFileInfoPrivate::initFileEngine(QString const&) ()
#9  0x082b68e9 in QFileInfo::QFileInfo(QString const&) ()
#10 0x08126851 in Option::init(int, char**) ()
#11 0x0807f994 in runQMake(int, char**) ()
#12 0x08080bab in main ()

FAIL. At least it compiled without any modification! yay configure!


Moltonel said...

Good to see it gets that far, but still a bit of an anticlimax.

Do you know if there is specific efforts ongoing to make qt compile+work with llvm, or is the current status just the result of general clang improvements ?

maelcum said...

Moltonel: clang currently compiles itself - into a binary that doesn't work. It has come a long way but it's not done yet. The development speed of clang seems to be very high though and I expect something more or less working definitely this year.

Stil said...

hmm, I have an error in configure

reating qmake. Please wait...
/home/stil/job/soft/llvm/cmake-build/bin/clang++ -c -o qbuffer.o -pipe -DQMAKE_OPENSOURCE_EDITION -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -I/home/stil/job/soft/qt/include -I/home/stil/job/soft/qt/include/QtCore -I/home/stil/job/soft/qt/src/corelib/global -I/home/stil/job/soft/qt/src/corelib/xml -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/home/stil/job/soft/qt/mkspecs/linux-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT /home/stil/job/soft/qt/src/corelib/io/qbuffer.cpp
In file included from /home/stil/job/soft/qt/src/corelib/io/qbuffer.cpp:43:
In file included from /home/stil/job/soft/qt/include/QtCore/private/qiodevice_p.h:1:
In file included from /home/stil/job/soft/qt/include/QtCore/private/../../../src/corelib/io/qiodevice_p.h:60:
In file included from /home/stil/job/soft/qt/include/QtCore/private/qringbuffer_p.h:1:
In file included from /home/stil/job/soft/qt/include/QtCore/private/../../../src/corelib/tools/qringbuffer_p.h:57:
In file included from /home/stil/job/soft/qt/include/QtCore/qlist.h:1:
In file included from /home/stil/job/soft/qt/include/QtCore/../../src/corelib/tools/qlist.h:54:
In file included from /usr/include/c++/4.4.1/new:39:
/usr/include/c++/4.4.1/cstddef:42:10: fatal error: 'bits/c++config.h' file not found
1 diagnostic generated.
gmake: *** [qbuffer.o] Ошибка 1