Skip to content
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

[runtimes] Always define cxx_shared, cxx_static & other targets #80007

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Jan 30, 2024

This patch always defines the cxx_shared, cxx_static & other top-level targets. However, they are marked as EXCLUDE_FROM_ALL when we don't want to build them. Simply declaring the targets should be of no harm, and it allows other projects to mention these targets regardless of whether they end up being built or not.

This patch basically moves the definition of e.g. cxx_shared out of the if (LIBCXX_ENABLE_SHARED) and instead marks it as EXCLUDE_FROM_ALL conditionally on whether LIBCXX_ENABLE_SHARED is passed. It then does the same for libunwind and libc++abi targets. I purposefully avoided to reformat the files (which now has inconsistent indentation) because I wanted to keep the diff minimal, and I know this is an area of the code where folks may have downstream diffs. I will re-indent the code separately once this patch lands.

This is a reapplication of 79ee034, which was reverted in a353909 because it broke the TSAN and the Fuchsia builds.

Resolves #77654

Differential Revision: https://reviews.llvm.org/D134221

@ldionne ldionne requested review from a team as code owners January 30, 2024 14:14
@llvmbot llvmbot added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libc++abi libc++abi C++ Runtime Library. Not libc++. libunwind labels Jan 30, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 30, 2024

@llvm/pr-subscribers-libcxx

@llvm/pr-subscribers-libunwind

Author: Louis Dionne (ldionne)

Changes

However, mark them as EXCLUDE_FROM_ALL when we don't want to build them. Simply declaring the targets should be of no harm, and it allows other projects to mention these targets regardless of whether they end up being built or not.

This patch basically moves the definition of e.g. cxx_shared out of the if (LIBCXX_ENABLE_SHARED) and instead marks it as EXCLUDE_FROM_ALL conditionally on whether LIBCXX_ENABLE_SHARED is passed. It then does the same for libunwind and libc++abi targets.

This is a reapplication of 79ee034, which was reverted in a353909 because it broke the TSAN and the Fuchsia builds.

Resolves #77654

Differential Revision: https://reviews.llvm.org/D134221


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

4 Files Affected:

  • (modified) libcxx/cmake/caches/AIX.cmake (+7)
  • (modified) libcxx/src/CMakeLists.txt (+9-11)
  • (modified) libcxxabi/src/CMakeLists.txt (+11-11)
  • (modified) libunwind/src/CMakeLists.txt (+10-10)
diff --git a/libcxx/cmake/caches/AIX.cmake b/libcxx/cmake/caches/AIX.cmake
index c01aa5b14df0..d9de35d75d91 100644
--- a/libcxx/cmake/caches/AIX.cmake
+++ b/libcxx/cmake/caches/AIX.cmake
@@ -15,3 +15,10 @@ set(LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
 set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
 set(LIBUNWIND_ENABLE_SHARED ON CACHE BOOL "")
 set(LIBUNWIND_ENABLE_STATIC OFF CACHE BOOL "")
+
+# On AIX, both shared and static libraries are archived. As a result, both the static and the shared targets end
+# up with a `.a` suffix, which conflict. To workaround that, we set a different output name for the static
+# libraries, which we never actually build anyway. For more information, see https://gitlab.kitware.com/cmake/cmake/-/issues/19494.
+set(LIBCXX_STATIC_OUTPUT_NAME "c++-static" CACHE STRING "")
+set(LIBCXXABI_STATIC_OUTPUT_NAME "c++abi-static" CACHE STRING "")
+set(LIBUNWIND_STATIC_OUTPUT_NAME "unwind-static" CACHE STRING "")
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 44a088663463..007491897170 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -155,10 +155,6 @@ if (LIBCXX_CONFIGURE_IDE)
   endif()
 endif()
 
-if(NOT LIBCXX_INSTALL_LIBRARY)
-  set(exclude_from_all EXCLUDE_FROM_ALL)
-endif()
-
 if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY)
   find_compiler_rt_library(profile LIBCXX_COVERAGE_LIBRARY)
 endif()
@@ -194,8 +190,7 @@ split_list(LIBCXX_COMPILE_FLAGS)
 split_list(LIBCXX_LINK_FLAGS)
 
 # Build the shared library.
-if (LIBCXX_ENABLE_SHARED)
-  add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  add_library(cxx_shared SHARED $<$<NOT:$<BOOL:LIBCXX_ENABLE_SHARED>>:EXCLUDE_FROM_ALL> ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
   target_include_directories(cxx_shared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
   target_link_libraries(cxx_shared PUBLIC cxx-headers
                                    PRIVATE ${LIBCXX_LIBRARIES})
@@ -274,7 +269,10 @@ if (LIBCXX_ENABLE_SHARED)
     )
   endif()
 
+if (LIBCXX_ENABLE_SHARED)
   list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
+endif()
+
   if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
     # Since we most likely do not have a mt.exe replacement, disable the
     # manifest bundling.  This allows a normal cmake invocation to pass which
@@ -282,13 +280,11 @@ if (LIBCXX_ENABLE_SHARED)
     set_target_properties(cxx_shared PROPERTIES
                           APPEND_STRING PROPERTY LINK_FLAGS " /MANIFEST:NO")
   endif()
-endif()
 
 set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
 
 # Build the static library.
-if (LIBCXX_ENABLE_STATIC)
-  add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  add_library(cxx_static STATIC $<$<NOT:$<BOOL:LIBCXX_ENABLE_STATIC>>:EXCLUDE_FROM_ALL> ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
   target_include_directories(cxx_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
   target_link_libraries(cxx_static PUBLIC cxx-headers
                                    PRIVATE ${LIBCXX_LIBRARIES}
@@ -314,16 +310,18 @@ if (LIBCXX_ENABLE_STATIC)
     target_compile_definitions(cxx_static PRIVATE _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=)
   endif()
 
-  list(APPEND LIBCXX_BUILD_TARGETS "cxx_static")
+  if (LIBCXX_ENABLE_STATIC)
+    list(APPEND LIBCXX_BUILD_TARGETS "cxx_static")
+  endif()
   # Attempt to merge the libc++.a archive and the ABI library archive into one.
   if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY)
     target_link_libraries(cxx_static PRIVATE libcxx-abi-static-objects)
   endif()
-endif()
 
 # Add a meta-target for both libraries.
 add_custom_target(cxx DEPENDS ${LIBCXX_BUILD_TARGETS})
 
+# Build the experimental static library
 set(LIBCXX_EXPERIMENTAL_SOURCES
   experimental/keep.cpp
   )
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 4198827203fc..ed357ba63f45 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -183,8 +183,7 @@ if (CMAKE_POSITION_INDEPENDENT_CODE OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CO
   set_target_properties(cxxabi_shared_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) # must set manually because it's an object library
 endif()
 
-if (LIBCXXABI_ENABLE_SHARED)
-  add_library(cxxabi_shared SHARED)
+  add_library(cxxabi_shared SHARED $<$<NOT:$<BOOL:LIBCXXABI_ENABLE_SHARED>>:EXCLUDE_FROM_ALL>)
   set_target_properties(cxxabi_shared
     PROPERTIES
       LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}"
@@ -207,10 +206,12 @@ if (LIBCXXABI_ENABLE_SHARED)
     PUBLIC cxxabi_shared_objects
     PRIVATE ${LIBCXXABI_LIBRARIES})
 
+if (LIBCXXABI_ENABLE_SHARED)
   list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
-  if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
-    list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
-  endif()
+endif()
+if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
+  list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
+endif()
 
   add_library(cxxabi-reexports INTERFACE)
 
@@ -240,7 +241,6 @@ if (LIBCXXABI_ENABLE_SHARED)
       endif()
     endif()
   endif()
-endif()
 
 # Build the static library.
 add_library(cxxabi_static_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
@@ -276,8 +276,7 @@ if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
       _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=)
 endif()
 
-if (LIBCXXABI_ENABLE_STATIC)
-  add_library(cxxabi_static STATIC)
+  add_library(cxxabi_static STATIC $<$<NOT:$<BOOL:LIBCXXABI_ENABLE_STATIC>>:EXCLUDE_FROM_ALL>)
   if (LIBCXXABI_USE_LLVM_UNWINDER AND NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
     target_link_libraries(cxxabi_static PUBLIC unwind_static)
   endif()
@@ -290,10 +289,11 @@ if (LIBCXXABI_ENABLE_STATIC)
     PUBLIC cxxabi_static_objects
     PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
 
+if (LIBCXXABI_ENABLE_STATIC)
   list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_static")
-  if (LIBCXXABI_INSTALL_STATIC_LIBRARY)
-    list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static")
-  endif()
+endif()
+if (LIBCXXABI_INSTALL_STATIC_LIBRARY)
+  list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static")
 endif()
 
 # Add a meta-target for both libraries.
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 9c6f5d908b09..eca127792287 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -162,8 +162,7 @@ if (CMAKE_POSITION_INDEPENDENT_CODE OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CO
   set_target_properties(unwind_shared_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) # must set manually because it's an object library
 endif()
 
-if (LIBUNWIND_ENABLE_SHARED)
-  add_library(unwind_shared SHARED)
+  add_library(unwind_shared SHARED $<$<NOT:$<BOOL:LIBUNWIND_ENABLE_SHARED>>:EXCLUDE_FROM_ALL>)
   target_link_libraries(unwind_shared PUBLIC unwind_shared_objects)
   set_target_properties(unwind_shared
     PROPERTIES
@@ -174,10 +173,11 @@ if (LIBUNWIND_ENABLE_SHARED)
       SOVERSION "1"
   )
 
+if (LIBUNWIND_ENABLE_SHARED)
   list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared")
-  if (LIBUNWIND_INSTALL_SHARED_LIBRARY)
-    list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared")
-  endif()
+endif()
+if (LIBUNWIND_INSTALL_SHARED_LIBRARY)
+  list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared")
 endif()
 
 # Build the static library.
@@ -205,8 +205,7 @@ if(LIBUNWIND_HIDE_SYMBOLS)
   target_compile_definitions(unwind_static_objects PRIVATE _LIBUNWIND_HIDE_SYMBOLS)
 endif()
 
-if (LIBUNWIND_ENABLE_STATIC)
-  add_library(unwind_static STATIC)
+  add_library(unwind_static STATIC $<$<NOT:$<BOOL:LIBUNWIND_ENABLE_STATIC>>:EXCLUDE_FROM_ALL>)
   target_link_libraries(unwind_static PUBLIC unwind_static_objects)
   set_target_properties(unwind_static
     PROPERTIES
@@ -215,10 +214,11 @@ if (LIBUNWIND_ENABLE_STATIC)
       OUTPUT_NAME "${LIBUNWIND_STATIC_OUTPUT_NAME}"
   )
 
+if (LIBUNWIND_ENABLE_STATIC)
   list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_static")
-  if (LIBUNWIND_INSTALL_STATIC_LIBRARY)
-    list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static")
-  endif()
+endif()
+if (LIBUNWIND_INSTALL_STATIC_LIBRARY)
+  list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static")
 endif()
 
 # Add a meta-target for both libraries.

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 30, 2024

@llvm/pr-subscribers-libcxxabi

Author: Louis Dionne (ldionne)

Changes

However, mark them as EXCLUDE_FROM_ALL when we don't want to build them. Simply declaring the targets should be of no harm, and it allows other projects to mention these targets regardless of whether they end up being built or not.

This patch basically moves the definition of e.g. cxx_shared out of the if (LIBCXX_ENABLE_SHARED) and instead marks it as EXCLUDE_FROM_ALL conditionally on whether LIBCXX_ENABLE_SHARED is passed. It then does the same for libunwind and libc++abi targets.

This is a reapplication of 79ee034, which was reverted in a353909 because it broke the TSAN and the Fuchsia builds.

Resolves #77654

Differential Revision: https://reviews.llvm.org/D134221


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

4 Files Affected:

  • (modified) libcxx/cmake/caches/AIX.cmake (+7)
  • (modified) libcxx/src/CMakeLists.txt (+9-11)
  • (modified) libcxxabi/src/CMakeLists.txt (+11-11)
  • (modified) libunwind/src/CMakeLists.txt (+10-10)
diff --git a/libcxx/cmake/caches/AIX.cmake b/libcxx/cmake/caches/AIX.cmake
index c01aa5b14df06..d9de35d75d916 100644
--- a/libcxx/cmake/caches/AIX.cmake
+++ b/libcxx/cmake/caches/AIX.cmake
@@ -15,3 +15,10 @@ set(LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
 set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
 set(LIBUNWIND_ENABLE_SHARED ON CACHE BOOL "")
 set(LIBUNWIND_ENABLE_STATIC OFF CACHE BOOL "")
+
+# On AIX, both shared and static libraries are archived. As a result, both the static and the shared targets end
+# up with a `.a` suffix, which conflict. To workaround that, we set a different output name for the static
+# libraries, which we never actually build anyway. For more information, see https://gitlab.kitware.com/cmake/cmake/-/issues/19494.
+set(LIBCXX_STATIC_OUTPUT_NAME "c++-static" CACHE STRING "")
+set(LIBCXXABI_STATIC_OUTPUT_NAME "c++abi-static" CACHE STRING "")
+set(LIBUNWIND_STATIC_OUTPUT_NAME "unwind-static" CACHE STRING "")
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 44a088663463c..007491897170f 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -155,10 +155,6 @@ if (LIBCXX_CONFIGURE_IDE)
   endif()
 endif()
 
-if(NOT LIBCXX_INSTALL_LIBRARY)
-  set(exclude_from_all EXCLUDE_FROM_ALL)
-endif()
-
 if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY)
   find_compiler_rt_library(profile LIBCXX_COVERAGE_LIBRARY)
 endif()
@@ -194,8 +190,7 @@ split_list(LIBCXX_COMPILE_FLAGS)
 split_list(LIBCXX_LINK_FLAGS)
 
 # Build the shared library.
-if (LIBCXX_ENABLE_SHARED)
-  add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  add_library(cxx_shared SHARED $<$<NOT:$<BOOL:LIBCXX_ENABLE_SHARED>>:EXCLUDE_FROM_ALL> ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
   target_include_directories(cxx_shared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
   target_link_libraries(cxx_shared PUBLIC cxx-headers
                                    PRIVATE ${LIBCXX_LIBRARIES})
@@ -274,7 +269,10 @@ if (LIBCXX_ENABLE_SHARED)
     )
   endif()
 
+if (LIBCXX_ENABLE_SHARED)
   list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
+endif()
+
   if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
     # Since we most likely do not have a mt.exe replacement, disable the
     # manifest bundling.  This allows a normal cmake invocation to pass which
@@ -282,13 +280,11 @@ if (LIBCXX_ENABLE_SHARED)
     set_target_properties(cxx_shared PROPERTIES
                           APPEND_STRING PROPERTY LINK_FLAGS " /MANIFEST:NO")
   endif()
-endif()
 
 set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
 
 # Build the static library.
-if (LIBCXX_ENABLE_STATIC)
-  add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  add_library(cxx_static STATIC $<$<NOT:$<BOOL:LIBCXX_ENABLE_STATIC>>:EXCLUDE_FROM_ALL> ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
   target_include_directories(cxx_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
   target_link_libraries(cxx_static PUBLIC cxx-headers
                                    PRIVATE ${LIBCXX_LIBRARIES}
@@ -314,16 +310,18 @@ if (LIBCXX_ENABLE_STATIC)
     target_compile_definitions(cxx_static PRIVATE _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=)
   endif()
 
-  list(APPEND LIBCXX_BUILD_TARGETS "cxx_static")
+  if (LIBCXX_ENABLE_STATIC)
+    list(APPEND LIBCXX_BUILD_TARGETS "cxx_static")
+  endif()
   # Attempt to merge the libc++.a archive and the ABI library archive into one.
   if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY)
     target_link_libraries(cxx_static PRIVATE libcxx-abi-static-objects)
   endif()
-endif()
 
 # Add a meta-target for both libraries.
 add_custom_target(cxx DEPENDS ${LIBCXX_BUILD_TARGETS})
 
+# Build the experimental static library
 set(LIBCXX_EXPERIMENTAL_SOURCES
   experimental/keep.cpp
   )
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 4198827203fc8..ed357ba63f452 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -183,8 +183,7 @@ if (CMAKE_POSITION_INDEPENDENT_CODE OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CO
   set_target_properties(cxxabi_shared_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) # must set manually because it's an object library
 endif()
 
-if (LIBCXXABI_ENABLE_SHARED)
-  add_library(cxxabi_shared SHARED)
+  add_library(cxxabi_shared SHARED $<$<NOT:$<BOOL:LIBCXXABI_ENABLE_SHARED>>:EXCLUDE_FROM_ALL>)
   set_target_properties(cxxabi_shared
     PROPERTIES
       LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}"
@@ -207,10 +206,12 @@ if (LIBCXXABI_ENABLE_SHARED)
     PUBLIC cxxabi_shared_objects
     PRIVATE ${LIBCXXABI_LIBRARIES})
 
+if (LIBCXXABI_ENABLE_SHARED)
   list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
-  if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
-    list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
-  endif()
+endif()
+if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
+  list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
+endif()
 
   add_library(cxxabi-reexports INTERFACE)
 
@@ -240,7 +241,6 @@ if (LIBCXXABI_ENABLE_SHARED)
       endif()
     endif()
   endif()
-endif()
 
 # Build the static library.
 add_library(cxxabi_static_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
@@ -276,8 +276,7 @@ if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
       _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=)
 endif()
 
-if (LIBCXXABI_ENABLE_STATIC)
-  add_library(cxxabi_static STATIC)
+  add_library(cxxabi_static STATIC $<$<NOT:$<BOOL:LIBCXXABI_ENABLE_STATIC>>:EXCLUDE_FROM_ALL>)
   if (LIBCXXABI_USE_LLVM_UNWINDER AND NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
     target_link_libraries(cxxabi_static PUBLIC unwind_static)
   endif()
@@ -290,10 +289,11 @@ if (LIBCXXABI_ENABLE_STATIC)
     PUBLIC cxxabi_static_objects
     PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
 
+if (LIBCXXABI_ENABLE_STATIC)
   list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_static")
-  if (LIBCXXABI_INSTALL_STATIC_LIBRARY)
-    list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static")
-  endif()
+endif()
+if (LIBCXXABI_INSTALL_STATIC_LIBRARY)
+  list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static")
 endif()
 
 # Add a meta-target for both libraries.
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 9c6f5d908b094..eca1277922871 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -162,8 +162,7 @@ if (CMAKE_POSITION_INDEPENDENT_CODE OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CO
   set_target_properties(unwind_shared_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) # must set manually because it's an object library
 endif()
 
-if (LIBUNWIND_ENABLE_SHARED)
-  add_library(unwind_shared SHARED)
+  add_library(unwind_shared SHARED $<$<NOT:$<BOOL:LIBUNWIND_ENABLE_SHARED>>:EXCLUDE_FROM_ALL>)
   target_link_libraries(unwind_shared PUBLIC unwind_shared_objects)
   set_target_properties(unwind_shared
     PROPERTIES
@@ -174,10 +173,11 @@ if (LIBUNWIND_ENABLE_SHARED)
       SOVERSION "1"
   )
 
+if (LIBUNWIND_ENABLE_SHARED)
   list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared")
-  if (LIBUNWIND_INSTALL_SHARED_LIBRARY)
-    list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared")
-  endif()
+endif()
+if (LIBUNWIND_INSTALL_SHARED_LIBRARY)
+  list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared")
 endif()
 
 # Build the static library.
@@ -205,8 +205,7 @@ if(LIBUNWIND_HIDE_SYMBOLS)
   target_compile_definitions(unwind_static_objects PRIVATE _LIBUNWIND_HIDE_SYMBOLS)
 endif()
 
-if (LIBUNWIND_ENABLE_STATIC)
-  add_library(unwind_static STATIC)
+  add_library(unwind_static STATIC $<$<NOT:$<BOOL:LIBUNWIND_ENABLE_STATIC>>:EXCLUDE_FROM_ALL>)
   target_link_libraries(unwind_static PUBLIC unwind_static_objects)
   set_target_properties(unwind_static
     PROPERTIES
@@ -215,10 +214,11 @@ if (LIBUNWIND_ENABLE_STATIC)
       OUTPUT_NAME "${LIBUNWIND_STATIC_OUTPUT_NAME}"
   )
 
+if (LIBUNWIND_ENABLE_STATIC)
   list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_static")
-  if (LIBUNWIND_INSTALL_STATIC_LIBRARY)
-    list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static")
-  endif()
+endif()
+if (LIBUNWIND_INSTALL_STATIC_LIBRARY)
+  list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static")
 endif()
 
 # Add a meta-target for both libraries.

@ldionne
Copy link
Member Author

ldionne commented Jan 30, 2024

CC @petrhosek @vitalybuka since this broke your setups last time. The reproduction steps were really non-trivial so I never got around to reproducing, but it would be great to see if this is still problematic.

@ldionne ldionne force-pushed the review/cmake-always-define-targets branch from 01ff9da to 01012cc Compare March 11, 2024 14:41
@ldionne ldionne force-pushed the review/cmake-always-define-targets branch from 01012cc to ad17e28 Compare August 19, 2024 19:25
@ldionne
Copy link
Member Author

ldionne commented Aug 21, 2024

Ping @petrhosek @vitalybuka. I would like to merge this patch this week. CI seems to be happy, but your CI may be doing something different since IIRC this patch upset your bots the last time I tried landing it. Can you take it for a round to see if that's still the case?

@ldionne ldionne force-pushed the review/cmake-always-define-targets branch from ad17e28 to 33a4c25 Compare October 3, 2024 14:38
@ldionne
Copy link
Member Author

ldionne commented Oct 3, 2024

@petrhosek @vitalybuka Gentle ping.

If the CI is green, I will land this next week unless someone objects to it. I don't want to purposefully break anyone's build, but I also don't want to hold off on this change forever if there's nothing actionable.

Last time in https://reviews.llvm.org/D134221#3853050, @petrhosek you said:

All Fuchsia builders started failing after this change landed with the following error:

/b/s/w/ir/x/w/staging/llvm_build/./bin/clang++ --target=x86_64-unknown-fuchsia --sysroot=/b/s/w/ir/x/w/cipd/sdk/arch/x64/sysroot -fPIC --target=x86_64-unknown-fuchsia -I/b/s/w/ir/x/w/cipd/sdk/pkg/sync/include -I/b/s/w/ir/x/w/cipd/sdk/pkg/fdio/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections  -O3 -DNDEBUG  -L/b/s/w/ir/x/w/cipd/sdk/arch/x64/lib -Wl,-z,defs  -nostdlib++ -shared -Wl,-soname,libc++abi.so.1 -o lib/libc++abi.so.1.0 libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_aux_runtime.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_default_handlers.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_demangle.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_exception_storage.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_guard.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_vector.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_virtual.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/stdlib_exception.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/stdlib_stdexcept.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/stdlib_typeinfo.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/abort_message.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/fallback_malloc.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/private_typeinfo.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/stdlib_new_delete.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_noexception.cpp.obj libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_thread_atexit.cpp.obj  -lc  -lgcc  -lgcc_s && :
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s

There's no libgcc on Fuchsia, we always use compiler-rt builtins so it's not clear to me why the build is now trying link libgcc when targeting Fuchsia after this change.

It looks like this could be caused by a check for something like if (TARGET cxxabi_shared) that used to be false and is now true, but it's hard to say without more information (and ideally reproducing locally).

@vitalybuka
Copy link
Collaborator

Can't comment on fuchsia, but buildbot_standard.sh which is mentioned on original review was shutdown for a while.
Some steps were moved to buildbot_cmake.sh based bots, I can try those.

Copy link
Collaborator

@vitalybuka vitalybuka left a comment

Choose a reason for hiding this comment

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

I can not reproduce linux bot issue with the patch.

However, mark them as EXCLUDE_FROM_ALL when we don't want to build them.
Simply declaring the targets should be of no harm, and it allows other
projects to mention these targets regardless of whether they end up
being built or not.

This patch basically moves the definition of e.g. cxx_shared out of
the `if (LIBCXX_ENABLE_SHARED)` and instead marks it as EXCLUDE_FROM_ALL
conditionally on whether LIBCXX_ENABLE_SHARED is passed. It then does the
same for libunwind and libc++abi targets.

This is a reapplication of 79ee034, which was reverted in a353909
because it broke the TSAN and the Fuchsia builds.

Resolves llvm#77654

Differential Revision: https://reviews.llvm.org/D134221
@ldionne ldionne force-pushed the review/cmake-always-define-targets branch from 33a4c25 to 447159a Compare October 8, 2024 20:26
@ldionne
Copy link
Member Author

ldionne commented Oct 8, 2024

I had to fix how we were excluding targets from EXCLUDE_FROM_ALL, which didn't work as intended and was breaking the MinGW CI. I'll merge this if the CI passes.

@petrhosek
Copy link
Member

I tested this locally in a clean build but I'm seeing the following build error:

CMake Error:
  Running

   '/usr/local/google/home/phosek/fuchsia/prebuilt/third_party/ninja/linux-x64/ninja' '-C' '/usr/local/google/home/phosek/llvm/llvm-project/build/fuchsia/runtimes/runtimes-armv6m-none-eabi-bins' '-t' 'recompact'

  failed with:

   ninja: error: build.ninja:52568: multiple rules generate /usr/local/google/home/phosek/llvm/llvm-project/build/fuchsia/lib/armv6m-unknown-none-eabi/libc++.a

@ldionne
Copy link
Member Author

ldionne commented Oct 9, 2024

@petrhosek Where is the cache generating that build?

The fix for this is:

# On embedded platforms that don't support shared library targets, CMake implicitly changes shared
# library targets to be static library targets. This results in duplicate definitions of the static
# library targets even though we might not ever build the shared library target, which breaks the
# build. To work around this, we change the output name of the  shared library target so that it
# can't conflict with the static library target.
#
# This is tracked by https://gitlab.kitware.com/cmake/cmake/-/issues/25759.
set(LIBCXX_SHARED_OUTPUT_NAME "c++-shared" CACHE STRING "")
set(LIBCXXABI_SHARED_OUTPUT_NAME "c++abi-shared" CACHE STRING "")
set(LIBUNWIND_SHARED_OUTPUT_NAME "unwind-shared" CACHE STRING "")

petrhosek added a commit to petrhosek/llvm-project that referenced this pull request Oct 10, 2024
@petrhosek
Copy link
Member

@petrhosek Where is the cache generating that build?

The fix for this is:

# On embedded platforms that don't support shared library targets, CMake implicitly changes shared
# library targets to be static library targets. This results in duplicate definitions of the static
# library targets even though we might not ever build the shared library target, which breaks the
# build. To work around this, we change the output name of the  shared library target so that it
# can't conflict with the static library target.
#
# This is tracked by https://gitlab.kitware.com/cmake/cmake/-/issues/25759.
set(LIBCXX_SHARED_OUTPUT_NAME "c++-shared" CACHE STRING "")
set(LIBCXXABI_SHARED_OUTPUT_NAME "c++abi-shared" CACHE STRING "")
set(LIBUNWIND_SHARED_OUTPUT_NAME "unwind-shared" CACHE STRING "")

With #111791 everything builds without any issues.

ldionne pushed a commit that referenced this pull request Oct 10, 2024
@ldionne ldionne merged commit 917ada3 into llvm:main Oct 10, 2024
64 checks passed
@ldionne ldionne deleted the review/cmake-always-define-targets branch October 10, 2024 12:00
ldionne added a commit to ldionne/llvm-project that referenced this pull request Oct 10, 2024
This is a purely mechanical commit for fixing the indentation of the
runtimes' CMakeLists files after llvm#80007. That PR didn't update the
indentation in order to make the diff easier to review and for merge
conflicts to be easier to resolve (for downstream changes).

This doesn't change any code, it only reindents it.
@ilovepi
Copy link
Contributor

ilovepi commented Oct 10, 2024

Hi, I think we're seeing a bunch of ASAN test failures both on Aarch64 and x86_64 Linux bots. It seems like these tests are now failing to find the right shared library. Would you mind taking a look?

@petrhosek do you know if this is something we need to update in our cache file? or is this a more general problem w/ the CMake?

Aarch64 bot: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-arm64/b8734460807473127393/overview
x64 bot: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8734465123369888721/overview

Logs for x64: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8734465123369888721/+/u/clang/test/stdout

Example error:

FAIL: AddressSanitizer-x86_64-linux :: TestCases/Linux/asan_default_suppressions.cpp (50 of 15170)
******************** TEST 'AddressSanitizer-x86_64-linux :: TestCases/Linux/asan_default_suppressions.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /b/s/w/ir/x/w/llvm_build/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only   -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/Linux/asan_default_suppressions.cpp -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/asan_default_suppressions.cpp.tmp && not  /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/asan_default_suppressions.cpp.tmp 2>&1 | FileCheck /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/Linux/asan_default_suppressions.cpp
+ /b/s/w/ir/x/w/llvm_build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/Linux/asan_default_suppressions.cpp -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/asan_default_suppressions.cpp.tmp
+ not /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/asan_default_suppressions.cpp.tmp
+ FileCheck /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/Linux/asan_default_suppressions.cpp
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/Linux/asan_default_suppressions.cpp:6:11: error: CHECK: expected string not found in input
// CHECK: AddressSanitizer: failed to parse suppressions
          ^
<stdin>:1:1: note: scanning from here
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/asan_default_suppressions.cpp.tmp: error while loading shared libraries: libc++.so.2: cannot open shared object file: No such file or directory
^
<stdin>:1:116: note: possible intended match here
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/asan_default_suppressions.cpp.tmp: error while loading shared libraries: libc++.so.2: cannot open shared object file: No such file or directory
                                                                                                                   ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/Linux/asan_default_suppressions.cpp

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/asan_default_suppressions.cpp.tmp: error while loading shared libraries: libc++.so.2: cannot open shared object file: No such file or directory 
check:6'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:6'1                                                                                                                        ?                                                                                                                                                                     possible intended match
           2: error: No such file or directory 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

--

********************

ldionne added a commit that referenced this pull request Oct 10, 2024
This is a purely mechanical commit for fixing the indentation of the
runtimes' CMakeLists files after #80007. That PR didn't update the
indentation in order to make the diff easier to review and for merge
conflicts to be easier to resolve (for downstream changes).

This doesn't change any code, it only reindents it.
@ldionne
Copy link
Member Author

ldionne commented Oct 10, 2024

@ilovepi Some things that could be going wrong: The cxx_shared target is now defined when it wasn't before, and something in your CMake has e.g. if (TARGET cxx_shared) and does something it shouldn't based on that.

Otherwise, it's also possible that libc++.so doesn't get installed at the right location anymore in case it's not part of the all target under that configuration, but that seems unlikely because previously the target would not have existed at all.

@ldionne
Copy link
Member Author

ldionne commented Oct 10, 2024

Also, this is another reminder that we would benefit from having Fuchsia builders in the pre-commit CI. We've asked before and we'll keep asking until we get them: Fuchsia is amongst the last platform that frequently reports errors but doesn't provide us with any pre-commit visibility.

ericastor pushed a commit to ericastor/llvm-project that referenced this pull request Oct 10, 2024
This is a purely mechanical commit for fixing the indentation of the
runtimes' CMakeLists files after llvm#80007. That PR didn't update the
indentation in order to make the diff easier to review and for merge
conflicts to be easier to resolve (for downstream changes).

This doesn't change any code, it only reindents it.
@ilovepi
Copy link
Contributor

ilovepi commented Oct 10, 2024

I think I understand what's happening, but not why. We don't normally build cxx_shared on Linux, but now we do. I'm not sure why that's causing a problem on this test per se, but we set LIBCXX_ENABLE_SHARED=OFF in our build files, so I'm surprised its happening now. In fact under build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins I only see LIBCXX_ENABLE_SHARED=OFF in all of the CMake files. Seems like this isn't propagating correctly anymore?

@ilovepi
Copy link
Contributor

ilovepi commented Oct 10, 2024

Also, this is another reminder that we would benefit from having Fuchsia builders in the pre-commit CI. We've asked before and we'll keep asking until we get them: Fuchsia is amongst the last platform that frequently reports errors but doesn't provide us with any pre-commit visibility.

Agreed. I'd also like us to be in that situation.

@MarkMurrayARM
Copy link
Contributor

Hi - is this being worked on? We are still seeing build failures that look like

-- ABI list file not generated for configuration aarch64-none-elf.libcxxabi.v2.unstable.exceptions.nonew, `check-cxx-abilist` will not be available.
-- Configuring done
-- Generating done
CMake Error:
  Running

   '/usr/bin/ninja' '-C' '/home/marmur02/oss/LLVM-embedded-toolchain-for-Arm/build/libcxx_libcxxabi_libunwind/aarch64a_exn_rtti/src/libcxx_libcxxabi_libunwind_aarch64a_exn_rtti-build' '-t' 'recompact'

  failed with:
   ninja: error: build.ninja:524: multiple rules generate lib/libunwind.a [-w dupbuild=err]

... which don't happen with this change locally backed out.

@MarkMurrayARM
Copy link
Contributor

NM - fixed in our builds.

@ldionne
Copy link
Member Author

ldionne commented Oct 11, 2024

If other folks get here because of an error like multiple rules generate lib/SOMETHING.a, this is the issue (from #80007 (comment)):

The fix for this is:

# On embedded platforms that don't support shared library targets, CMake implicitly changes shared
# library targets to be static library targets. This results in duplicate definitions of the static
# library targets even though we might not ever build the shared library target, which breaks the
# build. To work around this, we change the output name of the  shared library target so that it
# can't conflict with the static library target.
#
# This is tracked by https://gitlab.kitware.com/cmake/cmake/-/issues/25759.
set(LIBCXX_SHARED_OUTPUT_NAME "c++-shared" CACHE STRING "")
set(LIBCXXABI_SHARED_OUTPUT_NAME "c++abi-shared" CACHE STRING "")
set(LIBUNWIND_SHARED_OUTPUT_NAME "unwind-shared" CACHE STRING "")

Also, please consider pinging the CMake issue referenced.

ilovepi added a commit that referenced this pull request Oct 14, 2024
After #80007 Fuchsia builds are
now always building cxx_shared for arm64 and x64 Linux. Ultimately, this
is because the LIBCXX_ENABLE_SHARED is not used in compiler-rt to select
the correct libc++ target, and because cxx_shared is now always defined,
it is selected as a dependency when building runtimes tests.

---------

Co-authored-by: Petr Hosek <[email protected]>
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
…#80007)

This patch always defines the cxx_shared, cxx_static & other top-level
targets. However, they are marked as EXCLUDE_FROM_ALL when we don't want
to build them. Simply declaring the targets should be of no harm, and it
allows other projects to mention these targets regardless of whether
they end up being built or not.

This patch basically moves the definition of e.g. cxx_shared out of the
`if (LIBCXX_ENABLE_SHARED)` and instead marks it as EXCLUDE_FROM_ALL
conditionally on whether LIBCXX_ENABLE_SHARED is passed. It then does
the same for libunwind and libc++abi targets. I purposefully avoided to
reformat the files (which now has inconsistent indentation) because I
wanted to keep the diff minimal, and I know this is an area of the code
where folks may have downstream diffs. I will re-indent the code
separately once this patch lands.

This is a reapplication of 79ee034, which was reverted in
a353909 because it broke the TSAN and the Fuchsia builds.

Resolves llvm#77654

Differential Revision: https://reviews.llvm.org/D134221
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
This is a purely mechanical commit for fixing the indentation of the
runtimes' CMakeLists files after llvm#80007. That PR didn't update the
indentation in order to make the diff easier to review and for merge
conflicts to be easier to resolve (for downstream changes).

This doesn't change any code, it only reindents it.
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
…2257)

After llvm#80007 Fuchsia builds are
now always building cxx_shared for arm64 and x64 Linux. Ultimately, this
is because the LIBCXX_ENABLE_SHARED is not used in compiler-rt to select
the correct libc++ target, and because cxx_shared is now always defined,
it is selected as a dependency when building runtimes tests.

---------

Co-authored-by: Petr Hosek <[email protected]>
bricknerb pushed a commit to bricknerb/llvm-project that referenced this pull request Oct 17, 2024
This is a purely mechanical commit for fixing the indentation of the
runtimes' CMakeLists files after llvm#80007. That PR didn't update the
indentation in order to make the diff easier to review and for merge
conflicts to be easier to resolve (for downstream changes).

This doesn't change any code, it only reindents it.
bricknerb pushed a commit to bricknerb/llvm-project that referenced this pull request Oct 17, 2024
…2257)

After llvm#80007 Fuchsia builds are
now always building cxx_shared for arm64 and x64 Linux. Ultimately, this
is because the LIBCXX_ENABLE_SHARED is not used in compiler-rt to select
the correct libc++ target, and because cxx_shared is now always defined,
it is selected as a dependency when building runtimes tests.

---------

Co-authored-by: Petr Hosek <[email protected]>
EricWF pushed a commit to efcs/llvm-project that referenced this pull request Oct 22, 2024
…2257)

After llvm#80007 Fuchsia builds are
now always building cxx_shared for arm64 and x64 Linux. Ultimately, this
is because the LIBCXX_ENABLE_SHARED is not used in compiler-rt to select
the correct libc++ target, and because cxx_shared is now always defined,
it is selected as a dependency when building runtimes tests.

---------

Co-authored-by: Petr Hosek <[email protected]>
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++. libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libunwind
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[D134221] [runtimes] Always define the cxx_shared, cxx_static & other targets
6 participants