[compiler-rt] 8cf7ddb - Revert "Prepare Compiler-RT for GnuInstallDirs, matching libcxx"

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 10 00:50:19 PDT 2021


Author: Martin Storsjö
Date: 2021-07-10T10:45:54+03:00
New Revision: 8cf7ddbdd4e5af966a369e170c73250f2e3920e7

URL: https://github.com/llvm/llvm-project/commit/8cf7ddbdd4e5af966a369e170c73250f2e3920e7
DIFF: https://github.com/llvm/llvm-project/commit/8cf7ddbdd4e5af966a369e170c73250f2e3920e7.diff

LOG: Revert "Prepare Compiler-RT for GnuInstallDirs, matching libcxx"

This reverts commit 9a9bc76c0eb72f0f2732c729a460abbd5239c2e3.

That commit broke "ninja install" when building compiler-rt for mingw
targets, building standalone (pointing cmake at the compiler-rt
directory) with cmake 3.16.3 (the one shipped in ubuntu 20.04), with
errors like this:

-- Install configuration: "Release"
CMake Error at cmake_install.cmake:44 (file):
  file cannot create directory: /include/sanitizer.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/cmake_install.cmake:37 (include)

FAILED: include/CMakeFiles/install-compiler-rt-headers
cd /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/include && /usr/bin/cmake -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers" -P /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/cmake_install.cmake
ninja: build stopped: subcommand failed.

Added: 
    

Modified: 
    compiler-rt/cmake/Modules/AddCompilerRT.cmake
    compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
    compiler-rt/cmake/Modules/CompilerRTUtils.cmake
    compiler-rt/cmake/base-config-ix.cmake
    compiler-rt/include/CMakeLists.txt
    compiler-rt/lib/dfsan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index bc69ec95c4195..1e9e7c58664b6 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -371,7 +371,7 @@ function(add_compiler_rt_runtime name type)
         add_custom_command(TARGET ${libname}
           POST_BUILD  
           COMMAND codesign --sign - $<TARGET_FILE:${libname}>
-          WORKING_DIRECTORY ${COMPILER_RT_OUTPUT_LIBRARY_DIR}
+          WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
         )
       endif()
     endif()
@@ -511,7 +511,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
   add_custom_target(${target_name} DEPENDS ${dst_file})
   # Install in Clang resource directory.
   install(FILES ${file_name}
-    DESTINATION ${COMPILER_RT_INSTALL_DATA_DIR}
+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
     COMPONENT ${component})
   add_dependencies(${component} ${target_name})
 
@@ -528,7 +528,7 @@ macro(add_compiler_rt_script name)
   add_custom_target(${name} DEPENDS ${dst})
   install(FILES ${dst}
     PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
-    DESTINATION ${COMPILER_RT_INSTALL_BINARY_DIR})
+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
 endmacro(add_compiler_rt_script src name)
 
 # Builds custom version of libc++ and installs it in <prefix>.

diff  --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 380ae031a0fea..a38ad8c55af03 100644
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -457,8 +457,8 @@ macro(darwin_add_builtin_libraries)
                       PARENT_TARGET builtins
                       LIPO_FLAGS ${${os}_cc_kext_lipo_flags}
                       DEPENDS ${${os}_cc_kext_libs}
-                      OUTPUT_DIR ${COMPILER_RT_OUTPUT_LIBRARY_DIR}
-                      INSTALL_DIR ${COMPILER_RT_INSTALL_LIBRARY_DIR})
+                      OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+                      INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR})
     endif()
   endforeach()
 
@@ -467,8 +467,8 @@ macro(darwin_add_builtin_libraries)
                      PARENT_TARGET builtins
                      LIPO_FLAGS ${${os}_builtins_lipo_flags}
                      DEPENDS ${${os}_builtins_libs}
-                     OUTPUT_DIR ${COMPILER_RT_OUTPUT_LIBRARY_DIR}
-                     INSTALL_DIR ${COMPILER_RT_INSTALL_LIBRARY_DIR})
+                     OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+                     INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR})
   endforeach()
   darwin_add_embedded_builtin_libraries()
 endmacro()
@@ -506,9 +506,9 @@ macro(darwin_add_embedded_builtin_libraries)
     set(DARWIN_macho_embedded_ARCHS armv6m armv7m armv7em armv7 i386 x86_64)
 
     set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
-      ${COMPILER_RT_OUTPUT_LIBRARY_DIR}/macho_embedded)
+      ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
     set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
-      ${COMPILER_RT_INSTALL_LIBRARY_DIR}/macho_embedded)
+      ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
       
     set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
     set(CFLAGS_i386 "-march=pentium")

diff  --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index 5543e3c6afc62..88ee021fe68c9 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -498,18 +498,18 @@ endfunction()
 function(get_compiler_rt_install_dir arch install_dir)
   if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
     get_compiler_rt_target(${arch} target)
-    set(${install_dir} ${COMPILER_RT_INSTALL_LIBRARY_DIR}/${target} PARENT_SCOPE)
+    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
   else()
-    set(${install_dir} ${COMPILER_RT_INSTALL_LIBRARY_DIR} PARENT_SCOPE)
+    set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
   endif()
 endfunction()
 
 function(get_compiler_rt_output_dir arch output_dir)
   if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
     get_compiler_rt_target(${arch} target)
-    set(${output_dir} ${COMPILER_RT_OUTPUT_LIBRARY_DIR}/${target} PARENT_SCOPE)
+    set(${output_dir} ${COMPILER_RT_OUTPUT_DIR}/lib/${target} PARENT_SCOPE)
   else()
-    set(${output_dir} ${COMPILER_RT_OUTPUT_LIBRARY_DIR} PARENT_SCOPE)
+    set(${output_dir} ${COMPILER_RT_LIBRARY_OUTPUT_DIR} PARENT_SCOPE)
   endif()
 endfunction()
 

diff  --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index c4d78098d070d..1edab43e7c0dd 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -68,8 +68,8 @@ else()
     "Path where built compiler-rt libraries should be stored.")
   set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
     "Path where built compiler-rt executables should be stored.")
-  set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
-    "Prefix for directories where built compiler-rt artifacts should be installed.")
+  set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+    "Path where built compiler-rt libraries should be installed.")
   option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
   option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
   # Use a host compiler to compile/link tests.
@@ -89,24 +89,16 @@ if(NOT DEFINED COMPILER_RT_OS_DIR)
   string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
 endif()
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-  set(COMPILER_RT_OUTPUT_LIBRARY_DIR
-    ${COMPILER_RT_OUTPUT_DIR}/lib)
-  set(COMPILER_RT_INSTALL_LIBRARY_DIR
-    ${COMPILER_RT_INSTALL_PATH}/lib CACHE PATH
-    "Path where built compiler-rt libraries should be installed.")
-else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-  set(COMPILER_RT_OUTPUT_LIBRARY_DIR
+  set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+    ${COMPILER_RT_OUTPUT_DIR})
+  set(COMPILER_RT_LIBRARY_INSTALL_DIR
+    ${COMPILER_RT_INSTALL_PATH})
+else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+  set(COMPILER_RT_LIBRARY_OUTPUT_DIR
     ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
-  set(COMPILER_RT_INSTALL_LIBRARY_DIR
-    ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR} CACHE PATH
-    "Path where built compiler-rt libraries should be installed.")
+  set(COMPILER_RT_LIBRARY_INSTALL_DIR
+    ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
 endif()
-set(COMPILER_RT_INSTALL_BINARY_DIR "${COMPILER_RT_INSTALL_PATH}/bin" CACHE PATH
-  "Path where built compiler-rt executables should be installed.")
-set(COMPILER_RT_INSTALL_INCLUDE_DIR "${COMPILER_RT_INSTALL_PATH}/include" CACHE PATH
-  "Path where compiler-rt headers should be installed.")
-set(COMPILER_RT_INSTALL_DATA_DIR "${COMPILER_RT_INSTALL_PATH}/share" CACHE PATH
-  "Path where compiler-rt data files should be installed.")
 
 if(APPLE)
   # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but

diff  --git a/compiler-rt/include/CMakeLists.txt b/compiler-rt/include/CMakeLists.txt
index 7b415f0b88a37..b00e8caa1ddd1 100644
--- a/compiler-rt/include/CMakeLists.txt
+++ b/compiler-rt/include/CMakeLists.txt
@@ -69,22 +69,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
 install(FILES ${SANITIZER_HEADERS}
   COMPONENT compiler-rt-headers
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/sanitizer)
+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
 # Install fuzzer headers.
 install(FILES ${FUZZER_HEADERS}
   COMPONENT compiler-rt-headers
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/fuzzer)
+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
 # Install xray headers.
 install(FILES ${XRAY_HEADERS}
   COMPONENT compiler-rt-headers
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/xray)
+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
 # Install profile headers.
 install(FILES ${PROFILE_HEADERS}
   COMPONENT compiler-rt-headers
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/profile)
+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
 
 if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
   add_custom_target(install-compiler-rt-headers

diff  --git a/compiler-rt/lib/dfsan/CMakeLists.txt b/compiler-rt/lib/dfsan/CMakeLists.txt
index 45cb9c97e2eb5..b06ae472f073d 100644
--- a/compiler-rt/lib/dfsan/CMakeLists.txt
+++ b/compiler-rt/lib/dfsan/CMakeLists.txt
@@ -65,4 +65,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
                    DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
 add_dependencies(dfsan dfsan_abilist)
 install(FILES ${dfsan_abilist_filename}
-        DESTINATION ${COMPILER_RT_INSTALL_DATA_DIR})
+        DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)


        


More information about the llvm-commits mailing list