[Development] "error: ran out of registers during register allocation" when building qlibrary.cpp on macOS 11.6 with Clang 13

Mitch Curtis mitch.curtis at qt.io
Thu Feb 3 01:15:12 CET 2022


I just realised I never sent my reply to this; it was still a draft… well, at least I can add more info now. :)

> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Thiago Macieira
> Sent: Monday, 22 November 2021 6:07 PM
> To: development at qt-project.org
> Subject: Re: [Development] "error: ran out of registers during register
> allocation" when building qlibrary.cpp on macOS 11.6 with Clang 13
>
> On Monday, 22 November 2021 05:47:04 PST Mitch Curtis wrote:
> > error: ran out of registers during register allocation
>
> Unless it's complaining about inline assembly, I don't see how this could be
> our fault. I don't see any inline assembly in qlibrary.cpp or in headers it
> includes, so my guess is it's a compiler bug.
>
> Register allocation failures are more common in debug builds.

Using a RelWithDebInfo build does indeed work around it.

I had some success building clang myself and then building Qt with that, but shortly after I started getting the following error (or others like it) when building Qt Quick apps, so I gave up and tried the release build workaround.

    11:31:51: Running steps for project quick-cmake...
    11:31:51: Starting: "/usr/local/Cellar/cmake/3.21.1/bin/cmake" --build /Users/mitch/dev/temp/quick-cmake-qt_dev_self_built_clang_debug_non_fw-Debug --target all
    [1/1 3.5/sec] Linking CXX executable quick-cmake
    FAILED: quick-cmake
    : && /Users/mitch/dev/llvm-project/build/bin/clang-14 -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/quick-cmake.dir/quick-cmake_autogen/mocs_compilation.cpp.o CMakeFiles/quick-cmake.dir/main.cpp.o CMakeFiles/quick-cmake.dir/quick-cmake_autogen/EWIEGA46WW/qrc_qml.cpp.o -o quick-cmake  -Wl,-rpath,/Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib  /Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib/libQt6Quick_debug.6.3.0.dylib  /Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib/libQt6QmlModels_debug.6.3.0.dylib  /Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib/libQt6Qml_debug.6.3.0.dylib  /Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib/libQt6Network_debug.6.3.0.dylib  /Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib/libQt6OpenGL_debug.6.3.0.dylib  /Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib/libQt6Gui_debug.6.3.0.dylib  -framework  OpenGL  -framework  AGL  -framework AppKit  -framework ImageIO  -framework Metal  /Users/mitch/dev/qt-dev-self-built-clang-debug-non-fw/qtbase/lib/libQt6Core_debug.6.3.0.dylib  -framework DiskArbitration  -framework IOKit && :
    Undefined symbols for architecture x86_64:
    "std::terminate()", referenced from:
      ___clang_call_terminate in qrc_qml.cpp.o
    "operator delete(void*)", referenced from:
      std::__1::enable_if<((QtPrivate::FunctionPointer<main::$_0>::ArgumentCount) == (-(1))) && (!(std::is_convertible_v<main::$_0, char const*>)), QMetaObject::Connection>::type QObject::connect<void (QQmlApplicationEngine::*)(QObject*, QUrl const&), main::$_0>(QtPrivate::FunctionPointer<void (QQmlApplicationEngine::*)(QObject*, QUrl const&)>::Object const*, void (QQmlApplicationEngine::*)(QObject*, QUrl const&), QObject const*, main::$_0, Qt::ConnectionType) in main.cpp.o
      QtPrivate::QFunctorSlotObject<main::$_0, 2, QtPrivate::List<QObject*, QUrl const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) in main.cpp.o
    "operator new(unsigned long)", referenced from:
      std::__1::enable_if<((QtPrivate::FunctionPointer<main::$_0>::ArgumentCount) == (-(1))) && (!(std::is_convertible_v<main::$_0, char const*>)), QMetaObject::Connection>::type QObject::connect<void (QQmlApplicationEngine::*)(QObject*, QUrl const&), main::$_0>(QtPrivate::FunctionPointer<void (QQmlApplicationEngine::*)(QObject*, QUrl const&)>::Object const*, void (QQmlApplicationEngine::*)(QObject*, QUrl const&), QObject const*, main::$_0, Qt::ConnectionType) in main.cpp.o
    "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in qrc_qml.cpp.o
    "___gxx_personality_v0", referenced from:
      _main in main.cpp.o
      std::__1::enable_if<((QtPrivate::FunctionPointer<main::$_0>::ArgumentCount) == (-(1))) && (!(std::is_convertible_v<main::$_0, char const*>)), QMetaObject::Connection>::type QObject::connect<void (QQmlApplicationEngine::*)(QObject*, QUrl const&), main::$_0>(QtPrivate::FunctionPointer<void (QQmlApplicationEngine::*)(QObject*, QUrl const&)>::Object const*, void (QQmlApplicationEngine::*)(QObject*, QUrl const&), QObject const*, main::$_0, Qt::ConnectionType) in main.cpp.o
      QtPrivate::QFunctorSlotObject<main::$_0, 2, QtPrivate::List<QObject*, QUrl const&>, void>::QFunctorSlotObject(main::$_0) in main.cpp.o
      Dwarf Exception Unwind Info (__eh_frame) in main.cpp.o
      (anonymous namespace)::initializer::~initializer() in qrc_qml.cpp.o
      Dwarf Exception Unwind Info (__eh_frame) in qrc_qml.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
    11:31:51: The process "/usr/local/Cellar/cmake/3.21.1/bin/cmake" exited with code 1.
    Error while building/deploying project quick-cmake (kit: qt-dev-self-built-clang-debug-non-fw)
    When executing step "Build"
    11:31:51: Elapsed time: 00:01.

> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel DPG Cloud Engineering
>
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220203/299de061/attachment-0001.htm>


More information about the Development mailing list