OSX: Qt Creator 4.8



  • After install, an attempt to compile a simple sample application:

    "error: g++-4.2: No such file or directory"

    A bit ironic since the installer goes to a ton of work to download several different packages only for the end result to be an incomplete installation.



  • That is a bug in the compile toolchain detection code. We were able to work around it by switching to the clang toolchain.

    The Qt Creator installation is complete, the compiler is part of Xcode. g++-4.2 exists in /usr/bin if you have Xcode for OSX 10.6 installed. It is usually not installed on 10.7.



  • Thanks for the reply. Yeah, I'm running 10.7.



  • Same error here, wasted a lot of time trying to get Qt Creator to build.


  • Moderators

    It would rock if somebody could check whether http://codereview.qt-project.org/#change,11297 fixes this issue.

    As a work-around you can either create a symlink in /usr/bin from g++/gcc to g++-4.2/gcc-4.2 or change the mkspec used in the Project settings (Project->Build Settings->qmake step).

    Originally we just used the un-versioned mkspec, but that got me quite a few bug reports when people were using older xcode versions to write software that worked well on all the older Mac OS X boxes out there. Nobody reported this breaking in Mac OS X 10.7 with a new Xcode till after the release:-( Sorry for the inconvenience.



  • how to modify the mkspec used in the Project settings...because i cannot change that.


  • Moderators

    Just add "-spec macx-gcc" into the "Additional arguments" field of the qmake step (click "Details" to show it!).



  • Thanks it worked if i added "-spec macx-g++" and i had to modify the qglobal.h to make 10.7 a supported OS



  • Wait wait wait, don't edit qglobal.h :-) Mac Os 10.7 is not a (fully) supported platform of Qt 4.7. You should stick to the Mac Os 10.6 SDK. Simply add a deployment target to your QMake project like this:

    macx:QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.6.sdk

    This makes the warning message go away, and is actually closer to reality :-)

    Cheers,

    Mirko.



  • i did that and the warning message did not go away but the app worked.



  • Hi Miroslav,

    I am trying out Qt for the very first time and I am working on OSX 10.7.2 and have Xcode 4.2 installed. While I have programming experience, I am pretty new to C++ development and I was wondering, if you could explain a little bit more in detail how I need to configure Qt in order to make it work. I am not sure where I have to make the changes that you explained in this post and would appreciate your help greatly. Thanks, Michael



  • Hi, I am having this same problem. I went into projects, changed the toolchain to clang++, and I receive the same error that g++-4.2: no such file or directory found.

    I also tried adding "-spec macx-g++" and "-spec macx-gcc" in all variations to the qmake.

    I have /usr/bin/gcc, /usr/bin/g++, Developer/usr/bin/gcc, and /Developer/usr/bin/g++

    I am running macos 10.7.1 and qt creator 4.7.4


  • Moderators

    Please make sure that qmake is rerun after changing the spec parameter. QMake generates the makefiles used to build the project and if it is not rerun then you will still have the old ones which refer to g++-4.2.



  • How do you rerun qmake? I don't see any options to do this.


  • Moderators

    Build->Run Qmake or Build->Rebuild Project X or Build->Clean Project X followed by a normal build should all trigger qmake to be rerun.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.