日志
高版本xcode编译qt项目出现启动程序出错的解决方案
2024-01-10 17:19
Solving problems using Qt with Xcode 15 Published on October 4, 2023 by CrystalIDEA Once you upgrade to macOS Sonoma, you have to use Xcode 15 (Xcode 14 won’t work) and might face similar problems as described below. Problem #1: QMake does not work with Xcode 15 When trying to build a project on macOS you get the following error: failed to parse default search paths from compiler output Solution: this has been fixed in Qt 6.5.3 (will be also fixed in Qt 5.15.16 commercial), for earlier Qt version you should apply the following patch to mkspecs/features/toolchain.prf file before compiling. It can be easily backported to Qt 5.15.x - example. Problem #2: your Qt app crashes when running on macOS < 14 (and iOS < 17) Crash report will have something like this: dyld[56529]: Symbol not found: __ZTVNSt3__13pmr15memory_resourceEReferenced from: <UUID> qt6/qtbase/build_arm64/libexec/mocExpected in: <UUID> /usr/lib/libc++.1.dylib Solution: this has been fixed in Qt 6.5.3 (will be also fixed in Qt 5.15.16 commercial), for earlier Qt version you should apply the following patch to some headers before compiling. It can be easily backported to Qt 5.15.x - example. Problem #3: your Qt app crashes when running on macOS < 13 (and iOS < 15) Crash reports might look different, our report on macOS 11: Crashed Thread: 0 mainThread Dispatch queue: com.apple.main-threadException Type: EXC_BAD_ACCESS (SIGSEGV)Exception Codes: KERN_INVALID_ADDRESS at 0x0000000008cfe004Exception Note: EXC_CORPSE_NOTIFYTermination Signal: Segmentation fault: 11Termination Reason: Namespace SIGNAL, Code 0xbTerminating Process: exc handler [1068]Thread 0 Crashed:: mainThread Dispatch queue: com.apple.main-thread0 org.qt-project.QtCore 0x0000000109e5a4a9 operator==(QString const&, QString const&) + 91 org.qt-project.QtCore 0x0000000109faafd0 QObject::setObjectName(QString const&) + 1122 com.crystalidea.anytoiso 0x0000000108d0c513 0x108cfe000 + 586433 com.crystalidea.anytoiso 0x0000000108d0c128 QAppMainWindow::QAppMainWindow(QWidget*, QFlags<Qt::WindowType>) + 884 com.crystalidea.anytoiso 0x0000000108d0ac79 main + 1535 libdyld.dylib 0x00007fff20480f3d start + 1 It’s caused by the new optimized Xcode 15 linker when linking static libraries.
Xcode release notes with detailed explanation Solution: add this to your .pro file LIBS += -Wl,-ld_classic https://crystalidea.com/blog/qt-apps-crash-when-using-xcode-15 |