Hebrew and BiDi in KDE

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

Saturday, April 16, 2011

clang+Qt+QtCreator binary package - compiled with clang alpha1

To continue what I did last week today I uploaded to GoogleCode (I have a working project there, but not abusing it...?) a snapshot build of clang (trunk) Qt (master) and QtCreator (master). The code was pulled around 2AM (GMT+3), a really random time stamp.

The script I used (which is included in the tarball) first compiles clang using the native compiler, then it compiles clang again using the first generation compiler (2 stage bootstrap), then it compile Qt with the 2nd stage compiler and finally QtCreator with Qt/clang. All compilations are done out of source, and clang/llvm is compiled using "cmake" and not "configure". Someone asked last week what changes are needed to compile this beast, the answer is none, it all compiles out of the box.

A few notes:
  1. I added a script which sets up the environment variables for this beast to work (LD_LIBRARY_PATH, PATH). You get a shell working, from which you can call the new "qmake" and "clang" commands, as well as running the QtCreator.
  2. The build is 64bit linux only, it was built on Ubuntu 10.10, but I think it should run on every modern linux distro. I will try to build 32bit builds in the future.
  3. The code east  kittens, tested very briefly for 20 seconds.Not recommended at all.
  4. The code has been pulled from the corresponding SCM at random times, so it's possible that clang is borked, Qt is borked or CtCreator is borked. Be warned - it is not supposed to work :)
  5. QtCreator picks the correct qmake (the clang bootstrapped) by default. However, even if it picks the correct mkspec, it will not really work as you expect, as QtCreator does not know (yet?) how to parse the output of clang. It should compile your applications though.
  6. The tarball contains the build script, and also the full build log - ~26mb long. If you are interested in re-produce this, look at the script and the output. Contact me for more details, I am available sometimes in IRC (#qt, -> cuco) or email (elcuco -> kde, diegoiast -> gmail)
Again, I cannot stress this enough - this build is very experimental, and not recommended. But still, if you are interested - here is the download link: http://code.google.com/p/qtedit4/downloads/detail?name=qtsdk-clang-amd64-alpha1.tar.xz

Sunday, April 10, 2011

Qt + clang = it compiles!

After more than a year I have been compiling Qt with clang, now I can honestly say it compiles and runs. Not only I can bootstrap clang properly, and it compiles the core Qt4, but it also compiles the WebKit module (and runs flash!), I also saw on the console messages about JDK being loaded, so the browser demo seems very functional to me:



I have also tested the browser using the SubSpider test, and I see that the browser is not that slow (QtSDK/64bit from Nokia runs at 360.0ms +/- 2.5%, and the compiled one in 415.4ms +/- 3.6%, Chromium runs at 249.2ms +/- 11.0%).

As a special bonus, I decided to build Qt-Creator. It compiles and works quite good. I assume you can even use the new toolchain to compile applications, even tough that the error messages will not be recognized by the IDE.


I will try to clean up my build scripts so I can publish it online. I am also thinking of releasing the results as a "qt-clang-sdk" or something. Is anyone interested in such thing?

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!