Skip to content

Commit 864beb1

Browse files
[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) ```
1 parent 853e126 commit 864beb1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,10 @@ if( LLVM_USE_LINKER )
327327
CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
328328
check_cxx_source_compiles("int main() { return 0; }" CXX_SUPPORTS_CUSTOM_LINKER)
329329
if ( NOT CXX_SUPPORTS_CUSTOM_LINKER )
330-
message(FATAL_ERROR "Host compiler does not support '-fuse-ld=${LLVM_USE_LINKER}'")
330+
message(FATAL_ERROR "Host compiler does not support '-fuse-ld=${LLVM_USE_LINKER}'. "
331+
"Please make sure that '${LLVM_USE_LINKER}' is installed and "
332+
"that your host compiler can compile a simple program when "
333+
"given the option '-fuse-ld=${LLVM_USE_LINKER}'.")
331334
endif()
332335
endif()
333336

0 commit comments

Comments
 (0)