Skip to content

[libc++abi] Provide an explicit error when trying to build for MSVC #119370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Dec 10, 2024

Fixes #119322

@ldionne ldionne requested a review from a team as a code owner December 10, 2024 12:42
@llvmbot llvmbot added the libc++abi libc++abi C++ Runtime Library. Not libc++. label Dec 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 10, 2024

@llvm/pr-subscribers-libunwind

@llvm/pr-subscribers-libcxxabi

Author: Louis Dionne (ldionne)

Changes

Fixes #119322


Full diff: https://github.com/llvm/llvm-project/pull/119370.diff

1 Files Affected:

  • (modified) libcxxabi/CMakeLists.txt (+5)
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index da0e8b286cddc1..158d61ff4fcb25 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -34,6 +34,11 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
  build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
  )
 
+if (MSVC)
+  message(FATAL_ERROR "Libc++abi can't be built for MSVC targets, and doing so is pointless anyway because such "
+                      "targets must use the MS C++ ABI, and libc++abi provides the Itanium C++ ABI.")
+endif()
+
 #===============================================================================
 # Setup CMake Options
 #===============================================================================

@mstorsjo
Copy link
Member

Looks resonable.

We could also consider doing the same for libunwind. While most of libunwind also is pointless as it is tied to the Itanium ABI, one could in theory want to use an API like _Unwind_Backtrace. But libunwind doesn't build in this configuration right now, and would require some more tweaks. (This was suggested in https://reviews.llvm.org/D86612 earlier.) So until that's actually fixed up so that libunwind compiles in that configuration, libunwind probably also would benefit from such an early message to users who try to enable it without knowing why they would need it.

@ldionne ldionne force-pushed the review/libcxxabi-error-on-msvc branch from 3b3465d to c9f8359 Compare December 10, 2024 15:08
@ldionne ldionne requested a review from a team as a code owner December 10, 2024 15:08
Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@ldionne ldionne force-pushed the review/libcxxabi-error-on-msvc branch from c9f8359 to 259f1ee Compare December 10, 2024 15:30
@ldionne ldionne merged commit b0b546d into llvm:main Dec 11, 2024
62 checks passed
@ldionne ldionne deleted the review/libcxxabi-error-on-msvc branch December 11, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++. libunwind
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libcxxabi] build failure
3 participants