Xcode build error in llvm-project/.../CMakeLists.txt - "not allowed by the Xcode "new build system" "

Hi everyone,

I'm running into an error involving llvm-project/.../CMakeLists.txt while trying to build for xcode today after a rebase and update-checkout. Here is the full output, but specifically I am getting this error while building the llvm-macosx-arm64 directory:

-- Configuring done
-- Generating done
CMake Error in /Users/amritpankaur/swift-project/llvm-project/clang/lib/Headers/CMakeLists.txt:
  The custom command generating

    /Users/amritpankaur/swift-project/build/Xcode-DebugAssert/llvm-macosx-arm64/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/13.0.0/include/float.h

  is attached to multiple targets:

    clang-resource-headers
    arm-resource-headers
    aarch64-resource-headers
    cuda-resource-headers
    hexagon-resource-headers
    hip-resource-headers
    mips-resource-headers
    opencl-resource-headers
    ppc-resource-headers
    riscv-resource-headers
    systemz-resource-headers
    ve-resource-headers
    webassembly-resource-headers
    windows-resource-headers
    x86-resource-headers

  but none of these is a common dependency of the other(s).  This is not
  allowed by the Xcode "new build system".


CMake Error in /Users/amritpankaur/swift-project/llvm-project/third-party/benchmark/CMakeLists.txt:
  The custom command generating

    /Users/amritpankaur/swift-project/build/Xcode-DebugAssert/llvm-macosx-arm64/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/13.0.0/include/float.h

  is attached to multiple targets:

    clang-resource-headers
    arm-resource-headers
    aarch64-resource-headers
    cuda-resource-headers
    hexagon-resource-headers
    hip-resource-headers
    mips-resource-headers
    opencl-resource-headers
    ppc-resource-headers
    riscv-resource-headers
    systemz-resource-headers
    ve-resource-headers
    webassembly-resource-headers
    windows-resource-headers
    x86-resource-headers

  but none of these is a common dependency of the other(s).  This is not
  allowed by the Xcode "new build system".

I'm also running into this same error when I attempt to build the swift/llvm directories to use with the Xcode-with-ninja method of building the compiler.

Has anyone else encountered this? I've attempted the build script with --reconfigure, with --clean, have also deleted the build folder and rebuilt, and have deleted the entire swift-project directory, re-cloned and re-built, but no success so far.

I encountered the same issue recently. However, in my case, it is

CMake Error in /Users/tongjiew/Code/swift-project/llvm-project/clang/lib/Headers/CMakeLists.txt:
  The custom command generating

    /Users/tongjiew/Code/swift-project/build/Xcode-RelWithDebInfoAssert/llvm-macosx-arm64/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/13.0.0/include/openmp_wrappers/new

and

CMake Error in /Users/tongjiew/Code/swift-project/llvm-project/third-party/benchmark/CMakeLists.txt:
  The custom command generating

    /Users/tongjiew/Code/swift-project/build/Xcode-RelWithDebInfoAssert/llvm-macosx-arm64/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib/clang/13.0.0/include/openmp_wrappers/new

these two CMakeLists.txt files having the "not allowed in Xcode new build system" issue.

I'm using the "Xcode with Ninja" method to generate the Xcode project as well. My Xcode version is 13.4.1.

1 Like

Assuming it works at all (it's late and I should be sleeping instead of typing), this should fix it;
https://github.com/apple/llvm-project/pull/5168

2 Likes

This fixed it for me. Thank you!!

1 Like