#1772·oneTBB

CMake build fails when building a universal binary on MacOS

Author: alex-teeCreated Jul 5, 2025Updated Jun 11, 2026
Labelsbug

Summary

This line introduces -mrtm and -mwaitpkg to the compiler flags even when building a universal binary, and this line tries to use the waitpkg functionality, resulting in build errors (see below).

Version

2022.2.0

Environment

  • Hardware: Mac Mini Apple M2
  • OS name and version: Sequoia 15.4.1
  • Compiler version arm64-apple-darwin24.4.0
  • CMake generator used: Xcode (Xcode version 16.3)

Observed Behavior

My builds fail due to the introduction of -mrtm and -mwaitpkg (xcode build invocation log):

    cd /Users/alex/builds/KydKbRm4x/0/zrythm/zrythm
    write-file /Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/build/tbb.build/Release/Objects-normal/arm64/tbb.LinkFileList
WriteAuxiliaryFile /Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/build/tbb.build/Release/Objects-normal/arm64/82b82416624d2658e5098eb0a28c15c5-common-args.resp (in target 'tbb' from project 'zrythm')
    cd /Users/alex/builds/KydKbRm4x/0/zrythm/zrythm
    write-file /Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/build/tbb.build/Release/Objects-normal/arm64/82b82416624d2658e5098eb0a28c15c5-common-args.resp
-target arm64-apple-macos11.0 '-std=c++23' -fpascal-strings -O3 '-flto=thin' '-DCMAKE_INTDIR="Release"' -D__TBB_BUILD '-D__TBB_DYNAMIC_LOAD_ENABLED=0' '-D__TBB_SOURCE_DIRECTLY_INCLUDED=1' '-D__TBB_SKIP_DEPENDENCY_SIGNATURE_VERIFICATION=1' -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -I/Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/appleclang_17.0_cxx23_64_release/include -I/Users/alex/.cache/CPM/tbb/1281/include -I/Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/build/tbb.build/Release/DerivedSources-normal/arm64 -I/Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/build/tbb.build/Release/DerivedSources/arm64 -I/Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/build/tbb.build/Release/DerivedSources -F/Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/build_mac_arm-Release/appleclang_17.0_cxx23_64_release -DNDEBUG '-std=c++2b' '-flto=thin' -fPIC '-fvisibility=hidden' -fvisibility-inlines-hidden -D_XOPEN_SOURCE -mrtm -mwaitpkg '-ffile-prefix-map=/Users/alex/builds/KydKbRm4x/0/zrythm/zrythm/=' '-ffile-prefix-map=../../..//='
(more build instructions...)
clang: error: unsupported option '-mrtm' for target 'arm64-apple-macos11.0'
clang: error: unsupported option '-mwaitpkg' for target 'arm64-apple-macos11.0'

Expected Behavior

No build failures in MacOS universal builds.

Steps To Reproduce

Try to build with set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64") in the project's CMakeLists.txt. For reference, here is my full CMakeLists.txt. Apparently this was intended to be fixed in https://github.com/uxlfoundation/oneTBB/issues/910, but the following if-statement passes due to x86_64 being part of CMAKE_OSX_ARCHITECTURES:

if ("${TARGET_ARCHITECTURES}" MATCHES "(x86_64|amd64|AMD64)") # OSX systems are 64-bit only

Note that I have tried commenting out that CMake part that adds the flags, but the build still fails due to this code getting enabled. Manually #undef-ing and #define-ing that macro as 0 fixes the issue, so that check probably needs modification too.