tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.85k stars 320 forks source link

Xcode path is not set. Please use xcode-select to choose Xcode installation path. #318

Open iforce2d opened 2 years ago

iforce2d commented 2 years ago

All the scripts for building osxcross appear to have worked correctly, and I can compile the test.cpp sample.

Now I am getting this error when trying to configure Qt5 sources for building. Is there some other step I need to do?

Project ERROR: Xcode path is not set. Please use xcode-select to choose Xcode installation path.

This is on Fedora 35.

iforce2d commented 2 years ago

okay I managed to figure this out.

The initial problem above was caused by some of the Qt build scripts trying to use the explicit path /usr/bin/xcrun instead of just xcrun to find it in the system path. I made a symbolic link to solve this.

After that I was able to build Qt5 from source, albeit not without a number of tweaks here and there. Some of these might be caused by using SDK 11.3 instead of the 10.15 that the Qt sources officially support. I'll leave my notes here in case it helps anyone, and also as a future reference for myself.


Add this in the __cplusplus section at the beginning of qtbase/src/corelib/global/qglobal.h

include <limits>

Add this in qtbase/mkspecs/features/mac/default_pre.prf, and comment out check for license agreement QMAKE_XCODE_DEVELOPER_PATH = /usr/local/osxcross/SDK/MacOSX11.3.sdk

Add this in qtbase/mkspecs/features/mac/sdk.mk QT_MAC_SDK_NO_VERSION_CHECK = 1

Change -fconstant-cfstrings to -mconstant-cfstrings in qtbase/mkspecs/features/qt_module.prf

In qtbase/src/corelib/kernel/qcore_mac_p.h make comments as below: //using QCFType::QCFType; inline QCFString(const QString &str) : /QCFType(0),/ string(str) {}

In qtbase/src/corelib/kernel/qcore_mac.mm, comment out stuff in qt_mac_applicationIsInDarkMode

In qtbase/src/plugins/platforms/cocoa/qcocoatheme.mm, comment out checks for builtin_available In qtbase/src/plugins/styles/mac/qmacstyle_mac.mm, comment out checks for builtin_available

In qtbase/src/plaformsupport/fontdatabases/qcoretextfontdatabase.mm, QCoreTextFontDatabase::defaultFont() const, add cast to CFStringRef 536: auto fallbackFamilyName = QCFString((CFStringRef)CTFontDescriptorCopyAttribute(fallbackDescriptor, kCTFontFamilyNameAttribute)); 774: defaultFontName = QCFString((CFStringRef)CTFontDescriptorCopyAttribute(systemFont, kCTFontFamilyNameAttribute));

./configure -xplatform macx-clang -device-option CROSS_COMPILE=x86_64-apple-darwin20.4- -opensource -shared -release -sql-sqlite -opengl desktop -no-openvg -no-accessibility -qt-zlib -qt-libpng -qt-libjpeg -no-openssl -make tools -nomake examples -no-dbus -skip qtwebengine -skip qtactiveqt -skip qtdeclarative -prefix /usr/local/myqt/mac64/Qt-5.15.2