Fix build compatibility with macOS 26 and Apple Clang 21#4295
Open
ikkoham wants to merge 7 commits intoNVIDIA:mainfrom
Open
Fix build compatibility with macOS 26 and Apple Clang 21#4295ikkoham wants to merge 7 commits intoNVIDIA:mainfrom
ikkoham wants to merge 7 commits intoNVIDIA:mainfrom
Conversation
Signed-off-by: ikkoham <ikkoham@users.noreply.github.com>
Collaborator
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
I, ikkoham <ikkoham@users.noreply.github.com>, hereby add my Signed-off-by to this commit: 0ece0b6 Signed-off-by: ikkoham <ikkoham@users.noreply.github.com>
Collaborator
Command Bot: Processing... |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Signed-off-by: ikkoham <ikkoham@users.noreply.github.com>
4 tasks
Collaborator
|
Thanks for putting this together Ikko. I don't have my macOS machine with me this week but will test and review next week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
macOS 26 (Tahoe) SDK removed
__has_builtinguards from libc++ headers (e.g.,__builtin_ctzg,__is_nothrow_convertible), making them incompatible with LLVM 16's clang. Additionally, Apple Clang 21 introduced new warnings that break the build under-Werror.This PR fixes both issues so that CUDA-Q builds and passes all tests on macOS 26 with Apple Clang 21.
LLVM libc++ runtimes (SDK 26+)
set_env_defaults.sh: Auto-detect active SDK version viaxcrun --show-sdk-version. When SDK >= 26, includeruntimesinLLVM_PROJECTSto build LLVM's own libc++.cudaq-quake.cpp: Use-nostdinc++to suppress SDK C++ headers when LLVM's libc++ is available, while keeping-isysrootfor C standard headers.nvq++.in: Add-Wl,-syslibrootforld64.lldto findlibSystemin the SDK. Add-lc++abiduring final link when LLVM'slibc++abiis present.build_llvm.sh: Do not bake SDK sysroot paths intoclang++.cfgon macOS (they become stale after Xcode updates). Sysroot is resolved at runtime bynvq++.Relocatable linking
nvq++.in: LLVM 16'sld64.llddoes not implement-r(relocatable linking). Probe the configured linker and fall back to systemldfor the object merge step if needed.device_call.cpp: Update FileCheck pattern to match both Appleldandld64.llderror formats.Apple Clang 21 warnings
CMakeLists.txt: Add-Wno-character-conversionfor gtest (third-party).server_impl/CMakeLists.txt: Add-Wno-deprecated-literal-operatorfor Crow (third-party).cudaq.cpp: Fix-Wnontrivial-memcallonmemsetwithstd::vector<bool>.vqe_tester.cpp: Add missing#pragmato suppress-Wdeprecated-declarationsfor backward-compatibility test (matching existing pattern inbuilder_tester.cpp).