Cannot build qt from source with xcode 8 despite xcrun-to-xcodebuild fix
This happens under El Capitan , 10.11.6.
I already have the default Qt 5.7 installed for mac. I wanted to compile another version from source. So I downloaded the qt 5.7 source. After a first attempt without fixing any file, I simply run ./configure and get the "Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild without arguments."
I had this problem when compiling my app in Qt, and there are fixes for this, e.g. here:
So I tried to fix the file in the source file in <src dir>/qtbase/mkspecs/features/mac/default_pre.prf
I replaced the 2nd xcrun with xcodebuild so I get:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))):
Then i tried ./configure again in the <src dir>, but I still have the same xcode error:
raphaela-nb:qt-everywhere-opensource-src-5.7.0 raphaela$ ./configure + cd qtbase + /Users/raphaela/Dev/qt-everywhere-opensource-src-5.7.0/qtbase/configure -top-level Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild without arguments.
Again, here I am trying to build Qt, not building an app from within Qt Creator. I insist on this because all I find on google are fixes for xcode 8 bug when compiling an app from Qt Creator, which I've already been through.
I have see this once or twice. I wouldn't call it an error but more something you need to do.
When XCode is updated it will complete the installation when it is launched. On startup a prompt will appear that says some additional items need to be installed and ask for your root password (sudo root) to do it. If you try to compile anything through the command line this is what you will get until this step is done.
So, if you haven't tried this already, simply startup XCode and let it do its thing.
In fact that's the very first thing I tried. I'm used to xcode update, and I'm used to that behaviour. I run xcode app each time after i update. So, that didn't fix the issue unfortunately.
I don't believe this problem is from Qt. I suspect that if you try to compile anything from the command line you will have the same message.
Maybe installing (or updating) the command line tools for XCode if you haven't tried this already.
There might be more than one version of XCode on your system (?). If there is maybe the version seen from the console window is different than what you see in the applications folder. If you use the 'locate' command it might tell you if you are running some other version.
locate g++ or locate clang++ // I would expect this will return some path to XCode from the Applications folder as a minimum. // You might have to build the locate database if you haven't used this command before
Whatever is causing this I don't think you will find a solution in Qt.