Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alcroito/36092ab6ef46c8446a914ccd258ddb0e to your computer and use it in GitHub Desktop.
Save alcroito/36092ab6ef46c8446a914ccd258ddb0e to your computer and use it in GitHub Desktop.
Qt 5.7 WebEngine with XCode 5.1.1 on OSX 10.9 (Mavericks) and OSX 10.11 (El Capitan)

Qt 5.7 WebEngine on OSX 10.9 with XCode 5.1.1

To succesfully build Qt 5.7 WebEngine on OSX 10.9 with XCode 5.1.1, the following items are required:

  • XCode 5.1.1 for the toolchain
  • XCode 6.3 for the OSX 10.10.3 SDK

XCode 6.2 which is the last supported version to run on OSX 10.9 does not contain the latest 10.10 SDK (which is 10.10.3, which introduced Force Touch APIs in a patch release, used by Chromium starting with version 49....).

Then do the following steps:

  • Extract XCode 5.1.1 into /Application/XCode511/Xcode.app
  • Extract XCode 6.3 into /Application/XCode63/Xcode.app
  • Run the following code:
cp -r /Application/XCode63/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk /Applications/XCode511/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
sudo xcode-select --switch /Applications/XCode511/Xcode.app/Contents/Developer
  • Build Qt / Qt WebEngine
  • Restore the usual XCode after you're done, with:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

OSX 10.11 (El Capitan) with XCode 5.1.1

All the information below does not guarantee the whole process will succeed for you, as it did for me.

The same procedure, with possible slight adjustments in src/core/config/mac_osx.pri, can be used to build a project on OSX 10.11 El Capitan with XCode 5.1.1 (XCode itself won't open, but the build tools seem to work correctly (at least Qt WebEngine was successfully built with it, and ran normally)).

One small issue that might happen on El Capitan is that the ld linker from XCode 5.1.1 might refuse to work, specifically hang and eat CPU. To fix that, you can use the following procedure:

  • Run sudo opensnoop -n ld in a terminal
  • Run ld -v in another terminal
  • The first terminal will output something like:
  UID    PID COMM          FD PATH
  501  82018 ld             3 /usr/lib/libxcselect.dylib
  501  82018 ld             3 /dev/dtracehelper
  501  82018 ld             3 /Applications/XCode511/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib
  501  82018 ld             3 /var/folders/_x/l798cjd52ql19nfxydb17_c80000gn/T/xcrun_db
  501  82018 ld             3 /dev/dtracehelper
  501  82018 ld             3 /Applications/XCode51/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/libLTO.dylib
  • Kill both of the processes with Ctrl-C
  • Backup, or remove the /var/folders/_x/l798cjd52ql19nfxydb17_c80000gn/T/xcrun_db file
  • Running ld -v should now properly return:
$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-236.4
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 armv6m armv7m armv7em
LTO support using: LLVM version 3.4svn

Note that you will need to disable DTrace SIP protection (rootless mode) on El Capitan, so that opensnoop works properly.

mac_osx.pri adjustments

For development purposes, if you don't want to rebuild the whole of Qt with XCode 5.1.1, you can rebuild only the Chromium part of Qt WebEngine by modifying the path to the compiler and SDK in /path/to/qt/source/qtwebengine/src/core/config/mac_osx.pri.

Specifically override:

  • QMAKE_MAC_SDK_PATH -> "/Applications/XCode511/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk",
  • QMAKE_CLANG_PATH -> "/Applications/XCode511/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  • QMAKE_MAC_SDK_VERSION -> macosx10.10
  • mac_sdk_min -> \"10.10\"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment