Skip to content

Commit a6b115b

Browse files
authored
Fix MLX C++20 errors (pytorch#22424)
1 parent 457a2a8 commit a6b115b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎backends/mlx/CMakeLists.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,14 @@ target_compile_options(mlxdelegate PRIVATE ${_common_compile_options})
452452
# Core tensor headers carry pre-existing narrowing conversions that trip Xcode's
453453
# -Wshorten-64-to-32 -Werror; suppress it here as XNNPACK and abseil already do.
454454
target_compile_options(mlxdelegate PRIVATE -Wno-shorten-64-to-32)
455+
# MLX headers use C++20 defaulted comparison operators while we build C++17.
456+
# They normally arrive via -isystem from the imported mlx target, which
457+
# suppresses the warning. But this backend also installs them for downstream
458+
# consumers, and every -I is searched before any -isystem, so once an install
459+
# has run they resolve out of ${CMAKE_INSTALL_PREFIX}/include instead and
460+
# -Werror turns fatal. That is why an incremental rebuild used to need a
461+
# cmake-out wipe: a clean tree has nothing installed yet.
462+
target_compile_options(mlxdelegate PRIVATE -Wno-c++20-extensions)
455463
if(EXECUTORCH_MLX_ENABLE_SANITIZERS)
456464
target_link_options(mlxdelegate PRIVATE ${_mlx_sanitizer_link_options})
457465
endif()

0 commit comments

Comments
 (0)