From 26c1d689ae4cd24d228df1c35a2067fa970c52cc Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Fri, 21 Aug 2020 12:54:31 -0700 Subject: [PATCH] [compiler-rt] Disable ranlib when using libtool libtool already produces a table of contents, and ranlib just gives spurious errors because it doesn't understand universal binaries. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D86365 --- compiler-rt/cmake/Modules/UseLibtool.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler-rt/cmake/Modules/UseLibtool.cmake b/compiler-rt/cmake/Modules/UseLibtool.cmake index 38d197d..130810c 100644 --- a/compiler-rt/cmake/Modules/UseLibtool.cmake +++ b/compiler-rt/cmake/Modules/UseLibtool.cmake @@ -34,6 +34,14 @@ if(CMAKE_LIBTOOL) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_LIBTOOL}\" -static ${LIBTOOL_NO_WARNING_FLAG} -o ") endforeach() + + # By default, CMake invokes ranlib on a static library after installing it. + # libtool will have produced the table of contents for us already, and ranlib + # does not understanding universal binaries, so skip this step. It's important + # to set it to empty instead of unsetting it to shadow the cache variable, and + # we don't want to unset the cache variable to not affect anything outside + # this scope. + set(CMAKE_RANLIB "") endif() # If DYLD_LIBRARY_PATH is set we need to set it on archiver commands -- 2.7.4