Monday, December 31, 2012

Building QtMobility 1.2 on Mac OS X Lion

After a lot of pain and time I found that under Lion, QtMobility can't be compiled because it reverts to LLVM instead of GCC, giving the following error:
 ld: file not found: QtDBus.framework/Versions/4/QtDBus for architecture x86_64.  
I don't know why exactly, but I found a workaround to use GCC and it works fine. What I saw is that if you want to compile only a part of QtMobility, instead of the whole framework, it gives you this error with other Qt modules too, not just with QtDBus. Normally you should run the following steps to do a build:
  • Open a console and type: git clone git://gitorious.org/qt-mobility/qt-mobility.git
  • Once download has completed, you can build it using ./configure, make and make install (don't do it now)
  • Even if after the configure script has done its work you do qmake -spec /usr/local/Qt4.8/mkspecs/macx-g++, it just changes the compiler in the parent Makefile, and not in the rest of children projects (Bearer, Contacts, Multimedia ...). You should repeat it manually for each QtMobility module, or..
To do it in one move, open the configure.sh script, locate the following lines:
 checkostype(){  
   match="Darwin"  
   if [ `uname -s` = "${match}" ]; then  
     OS="darwin"  
     QMKSPEC="-spec macx-g++"  
     if [[ `gcc --version` =~ .*llvm.* ]]; then  
       QMKSPEC="-spec macx-llvm"  
     else  
       QMKSPEC="-spec macx-g++"  
     fi  
     echo "QMAKESPEC = "$QMKSPEC >> "$CONFIG_IN"  
   fi  
 }  
 checkostype  
and change them to:
 checkostype(){  
   match="Darwin"  
   if [ `uname -s` = "${match}" ]; then  
     OS="darwin"  
     QMKSPEC="-spec macx-g++"  
     #if [[ `gcc --version` =~ .*llvm.* ]]; then  
     #  QMKSPEC="-spec macx-llvm"  
     #else  
     #  QMKSPEC="-spec macx-g++"  
     #fi  
     echo "QMAKESPEC = "$QMKSPEC >> "$CONFIG_IN"  
   fi  
 }  
 checkostype  

Good coding!

No comments:

Post a Comment