This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new be36cc0e2 [cmake_modules] recognize linker coming with LLVM 15
be36cc0e2 is described below

commit be36cc0e2edd6a73b7e0936f570612d8c724ac24
Author: Alexey Serbin <[email protected]>
AuthorDate: Mon Mar 25 19:22:34 2024 -0700

    [cmake_modules] recognize linker coming with LLVM 15
    
    This patch updates the GET_LINKER_VERSION cmake's function to work
    with ld linker that comes with LLVM 15 as a part of Xcode 15.3 on macOS.
    Without this patch, running cmake in the build directory on macOS
    using Xcode 15.3 would fail with an error like below:
    
      -- Checking linker version when not specifying any flags
      CMake Error at cmake_modules/KuduLinker.cmake:87 (message):
        Could not find a suitable linker
    
    Change-Id: If120b281a44fa7a9b9976d078c34f36ab942f089
    Reviewed-on: http://gerrit.cloudera.org:8080/21202
    Reviewed-by: Abhishek Chennaka <[email protected]>
    Tested-by: Alexey Serbin <[email protected]>
---
 cmake_modules/KuduLinker.cmake | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/cmake_modules/KuduLinker.cmake b/cmake_modules/KuduLinker.cmake
index 399883ccd..e19ff6c7c 100644
--- a/cmake_modules/KuduLinker.cmake
+++ b/cmake_modules/KuduLinker.cmake
@@ -167,6 +167,21 @@ function(GET_LINKER_VERSION)
     set(LINKER_FOUND TRUE)
     set(LINKER_FAMILY "ld64")
     set(LINKER_VERSION "${CMAKE_MATCH_1}")
+  elseif (LINKER_STDERR MATCHES "PROJECT:ld")
+    # ld outputs the versioning information into stderr.
+    # This is an example of output from newer versions of the LLVM's linker:
+    # e.g. the linker which comes along with CLANG 15.0.0 (clang-1500.3.9.4)
+    # as a part of Xcode 15.3 on macOS.
+    #
+    # Sample:
+    #   @(#)PROGRAM:ld PROJECT:ld-1053.12
+    if (NOT "${LINKER_STDERR}" MATCHES "PROJECT:ld-([0-9]+(\\.[0-9]+)?)")
+      message(SEND_ERROR "Could not extract ld version. "
+        "Linker version output: ${LINKER_STDOUT}")
+    endif()
+    set(LINKER_FOUND TRUE)
+    set(LINKER_FAMILY "ld64")
+    set(LINKER_VERSION "${CMAKE_MATCH_1}")
   else()
     set(LINKER_FOUND FALSE)
   endif()

Reply via email to