[llvm] 864beb1 - [llvm][CMake] Expand error message shown when -fuse-ld= test fails (#66778)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 01:08:55 PDT 2023


Author: David Spickett
Date: 2023-10-03T09:08:50+01:00
New Revision: 864beb179280f9b2e81b303462dfff90c283c8be

URL: https://github.com/llvm/llvm-project/commit/864beb179280f9b2e81b303462dfff90c283c8be
DIFF: https://github.com/llvm/llvm-project/commit/864beb179280f9b2e81b303462dfff90c283c8be.diff

LOG: [llvm][CMake] Expand error message shown when -fuse-ld= test fails (#66778)

This is one of the most common issues new users face, especially as so
many reccomended CMake configurations include `-DLLVM_ENABLE_LLD=ON`.

I don't want the error message to get too long but let's at least say
that there are 2 main reasons for the failure. If it's not those then
maybe folks will find the actual problem while trying to discount them.

The new message looks like:
```
CMake Error at cmake/modules/HandleLLVMOptions.cmake:330 (message):
  Host compiler does not support '-fuse-ld=not_a_linker'.  Please make sure
  that 'not_a_linker' is installed and that your host compiler can compile a
  simple program when given the option '-fuse-ld=not_a_linker'.
Call Stack (most recent call first):
  CMakeLists.txt:910 (include)
```

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index f72c41aaffb5061..c5142c9e660fba4 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -327,7 +327,10 @@ if( LLVM_USE_LINKER )
     CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
   check_cxx_source_compiles("int main() { return 0; }" CXX_SUPPORTS_CUSTOM_LINKER)
   if ( NOT CXX_SUPPORTS_CUSTOM_LINKER )
-    message(FATAL_ERROR "Host compiler does not support '-fuse-ld=${LLVM_USE_LINKER}'")
+    message(FATAL_ERROR "Host compiler does not support '-fuse-ld=${LLVM_USE_LINKER}'. "
+                        "Please make sure that '${LLVM_USE_LINKER}' is installed and "
+                        "that your host compiler can compile a simple program when "
+                        "given the option '-fuse-ld=${LLVM_USE_LINKER}'.")
   endif()
 endif()
 


        


More information about the llvm-commits mailing list