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

Saturday, October 2, 2010

Building QtCreator

Whats so cool and new about it...? I build it using clang. Linking to a Qt compilation made with clang. Now that's a big step!

Some details: I compiled yesterday clang, and bootstapped into stage 3 (first compiled clang using gcc = stage 1, then compiled clang using clang from stage 2, and then compiled stage 3 using clang from stage 2, as a stress test to clang).

Then I compiled git cloned qt (http://gitorious.org/~elcuco/qt/llvm-support use clang-support-linux as your branch).  I used this configure line for qt: 


./configure -fast -no-pch -no-webkit -no-mmx -opensource -confirm-license -continue -prefix -platform linux-clang 


Some notes: mxx is disabled, since the the clang runtime does not yet support some MMX functions needed. Also webkit does not compile yet, but some work has been done upstream (in WebKit, not integrated into Qt yet) to compile using clang. I think the PCH support can be re-enabled, I will test in the next weeks.

Note also the "platform", this is an mkspec available from my repository. I also hacked configure.exe's source to have clang support. I still need to rebuild configure.exe using cl.exe and adding this to the repository. This is on my TODO list (also make this whole test under windows as well).


The next step was cloning QtCreator, and then

mkdir build-qmake-clang
cd build-qmake-clang
~/src/build-qt-clang/bin/qmake ..
make -j 10


I used 10 threads to compile, since clang compilations are really slow, and I did not see the 4 cores of my machine working too hard. (when building Qt I used -j4). I will test the next few days how stable, or non-stable is this QtCreator build, but it seems promissing. More stats in the next weeks as I gather more information.



Mandatory screenshot - nothing special here, right? 



PS: as a special bonus - this is a 64bit compilation: clang, Qt and QtCreator. How cool is that?

Friday, March 19, 2010

Tab animation - bad!

I have disabled the tab anymation in my install(s). This was just frustration - the tab has already changed, it's displayed on screen, but it's "slowly" fades in so I can see it.

It become too much distracting and my life is better since. Has anyone else been feeling the same? Do we have a lot of complains on this issue? If we do, this might be a good idea disabling this feature by default.

Sunday, February 28, 2010

Qt + clang

1) What is clang?
It's a c++ compiler that is been developed using llvm. It should be very fast, it consumes less memory, it's BSD licensed, it should eventually provide better optimizations. It's still beeing developed

2) Can it compile Qt?
Dunno, not always. It does not work for me, but some people have reported that it works for them.

3) me too! me too! me too! me too! me too!
ok, shut up and type this:

# get + build clang
mkdir -p ~/src/llvm/
svn co http://llvm.org/svn/llvm-project/llvm/trunk ~/src/llvm
mkdir -p ~/src/llvm/tools/clang/
svn co http://llvm.org/svn/llvm-project/cfe/trunk ~/src/llvm/tools/clang
mkdir -p ~/src/llvm/cmake-build
cd ~/src/llvm/cmake-build
cmake ../
make -j 127

# compile Qt using the new clang
mkdir $QTDIR/qt-build-clang
cd $QTDIR/qt-build-clang
export PATH=~/src/llvm/cmake-build/bin:$PATH
export CC=clang
export CXX=clang++
$QTDIR/configure

# next time, update:
svn up ~/src/llvm/ ~/src/llvm/tools/clang/


As you might guess by now clang is quite compatible with GCC, it behaves more or less like it, uses the same headers, and uses the same command line switches.

4) Yes, but can clang do this? nah nah nah nah nah nah nah ...
OMG... what is wrong with you? are you an orange...?


5) Is it ready for "enterprise"?
No. There are no reported compiles of a Linux kernel, it just recently became self hosting, and I still have problems compiling Qt with it. I even have problems with small applications.


// http://llvm.org/bugs/show_bug.cgi?id=6295
#include < new >
int main( int argc, char *argv[] )
{
return 0;
}


6) So? whats so good about it?
It's an alternative. Freedom is all about alternatives, they mean competition, which means improovement, which means better applications.

Sunday, January 31, 2010

Bootstrapping Qt using clang - part 3

As thiago asked, I run ./configure -no-mmx -no-3dnow -no-sse -no-sse2 && make, here are the warnings/errors found. Ifind it interesting that the inotify code used gcc extensions - as it seems on linux, this is the "only" usable C++ compiler. Second error should be trivial to fix, more on that on the next post.

Still FAIL.


/home/elcuco/src/llvm/build-cmake/bin/clang++ -c -pipe -g -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O2 -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DELF_INTERPRETER=\"/lib/ld-linux.so.2\" -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I.moc/release-shared -o .obj/release-shared/qfilesystemwatcher_inotify.o io/qfilesystemwatcher_inotify.cpp In file included from io/qfilesystemwatcher_inotify.cpp:43:                                                                                    
In file included from io/qfilesystemwatcher_inotify_p.h:56:                                                                                    
In file included from io/qfilesystemwatcher_p.h:60:                                                                                            
In file included from ../../include/QtCore/private/qobject_p.h:1:                                                                              
In file included from ../../include/QtCore/private/../../../src/corelib/kernel/qobject_p.h:62:                                                 
In file included from ../../include/QtCore/qvariant.h:1:                                                                                       
In file included from ../../include/QtCore/../../src/corelib/kernel/qvariant.h:49:                                                             
In file included from ../../include/QtCore/qmap.h:1:                                                                                           
../../include/QtCore/../../src/corelib/tools/qmap.h:127:7: warning: field 'value' with variable sized type 'struct inotify_event' not at the   
      end of a struct or class is a GNU extension                                                                                              
    T value;                                                                                                                                   
      ^                                                                                                                                        
../../include/QtCore/../../src/corelib/tools/qmap.h:626:25: note: in instantiation of template class                                           
      'struct QMapNode' requested here                                                                              
            concreteNode->key.~Key();                                                                                                          
                        ^                                                                                                                      
../../include/QtCore/../../src/corelib/tools/qmap.h:167:59: note: in instantiation of member function                                          
      'QMap::freeData' requested here                                                                               
    inline ~QMap() { if (!d) return; if (!d->ref.deref()) freeData(d); }                                                                       
                                                          ^                                                                                    
io/qfilesystemwatcher_inotify.cpp:359:30: note: in instantiation of member function 'QMap::~QMap' requested here    
    QMap eventForId;                                                                                                       
                             ^                                                                                                                 
In file included from io/qfilesystemwatcher_inotify.cpp:43:                                                                                    
In file included from io/qfilesystemwatcher_inotify_p.h:56:                                                                                    
In file included from io/qfilesystemwatcher_p.h:60:                                                                                            
In file included from ../../include/QtCore/private/qobject_p.h:1:                                                                              
In file included from ../../include/QtCore/private/../../../src/corelib/kernel/qobject_p.h:62:                                                 
In file included from ../../include/QtCore/qvariant.h:1:                                                                                       
In file included from ../../include/QtCore/../../src/corelib/kernel/qvariant.h:49:                                                             
In file included from ../../include/QtCore/qmap.h:1:                                                                                           
../../include/QtCore/../../src/corelib/tools/qmap.h:136:7: warning: field 'value' with variable sized type 'struct inotify_event' not at the   
      end of a struct or class is a GNU extension                                                                                              
    T value;                                                                                                                                   
      ^                                                                                                                                        
../../include/QtCore/../../src/corelib/tools/qmap.h:151:42: note: in instantiation of template class 'struct QMapPayloadNode
      inotify_event>' requested here                                                                                                           
    static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); }                                                     
                                         ^                                                                                                     
../../include/QtCore/../../src/corelib/tools/qmap.h:633:25: note: in instantiation of member function                                          
      'QMap::payload' requested here                                                                                
    x->continueFreeData(payload());                                                                                                            
                        ^                                                                                                                      
../../include/QtCore/../../src/corelib/tools/qmap.h:167:59: note: in instantiation of member function                                          
      'QMap::freeData' requested here                                                                               
    inline ~QMap() { if (!d) return; if (!d->ref.deref()) freeData(d); }                                                                       
                                                          ^                                                                                    
io/qfilesystemwatcher_inotify.cpp:359:30: note: in instantiation of member function 'QMap::~QMap' requested here    
    QMap eventForId;                                                                                                       
                             ^                                                                                                                 
9 diagnostics generated.                                                                                                                       
/home/elcuco/src/gitorious/qt/bin/moc -DQT_SHARED -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DELF_INTERPRETER=\"/lib/ld-linux.so.2\" -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I.moc/release-shared io/qfilesystemwatcher_dnotify.cpp -o .moc/release-shared/qfilesystemwatcher_dnotify.moc




/home/elcuco/src/llvm/build-cmake/bin/clang++ -c -pipe -g -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O2 -Wall -W -D_REENTRANT -I/usr/include/freetype2 -fPIC -DQT_SHARED -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_NO_OPENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYLE_WINDOWSMOBILE -DQT_NO_STYLE_S60 -DQ_INTERNAL_QAPP_SRC -DQT_NO_DEBUG -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include -I../../include/QtGui -I.rcc/release-shared -I../3rdparty/xorg -I/usr/include/freetype2 -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-shared -I/usr/X11R6/include -I.uic/release-shared -o .obj/release-shared/qprintengine_ps.o painting/qprintengine_ps.cpp
painting/qprintengine_ps.cpp:686:37: error: allocation of incomplete type 'struct sigaction'
        users_sigpipe_handler = new struct sigaction;
                                    ^
painting/qprintengine_ps.cpp:686:44: note: forward declaration of 'struct sigaction'
        users_sigpipe_handler = new struct sigaction;
                                           ^
painting/qprintengine_ps.cpp:687:26: error: invalid use of incomplete type 'struct sigaction'
        struct sigaction tmp_sigpipe_handler;
                         ^
painting/qprintengine_ps.cpp:686:44: note: forward declaration of 'struct sigaction'
        users_sigpipe_handler = new struct sigaction;
                                           ^
painting/qprintengine_ps.cpp:687:26: warning: unused variable 'tmp_sigpipe_handler' [-Wunused-variable]
        struct sigaction tmp_sigpipe_handler;
                         ^
5 diagnostics generated.
make[1]: *** [.obj/release-shared/qprintengine_ps.o] Error 1
make[1]: Leaving directory `/home/elcuco/src/gitorious/qt/src/gui'
make: *** [sub-gui-make_default-ordered] Error 2
[elcuco@pinky ~/src/gitorious/qt]

Thursday, January 28, 2010

Bootstrapping Qt using clang - part 2

This week it actually compiled a working qmake, configure actually worked. The problem now is Qt


make[1]: Entering directory `/home/elcuco/src/gitorious/qt/src/gui'
/home/elcuco/src/llvm/build-cmake/bin/clang++ -c -Winline -m3dnow -mmmx -pipe -g -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -Wall -W -D_REENTRANT -I/usr/include/freetype2 -fPIC -DQT_SHARED -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_NO_OPENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYLE_WINDOWSMOBILE -DQT_NO_STYLE_S60 -DQ_INTERNAL_QAPP_SRC -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include -I../../include/QtGui -I.rcc/debug-shared -I../3rdparty/xorg -I/usr/include/freetype2 -I../3rdparty/harfbuzz/src -Idialogs -I.moc/debug-shared -I/usr/X11R6/include -I.uic/debug-shared painting/qdrawhelper_mmx3dnow.cpp -o .obj/debug-shared/qdrawhelper_mmx3dnow.o
painting/qdrawhelper_mmx3dnow.cpp:47:10: fatal error: 'mm3dnow.h' file not found

Again, nothing done to the code. Great job by the clang guys!

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
CC=/home/elcuco/src/llvm/build-cmake/bin/clang
CXX=/home/elcuco/src/llvm/build-cmake/bin/clang++
export CC
export CXX
./configure 

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 ()
(gdb)

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