After r288994, doing something like the following will cause the linker to be wrongly identified: LDFLAGS='-Wl,-O1 -Wl,--as-needed' Tools/Scripts/build-webkit [...] and CMake will print the following (it should read “BFD”): -- Linker variant in use: UNKNOWN
This is caused by CMake's execute_process() passing arguments verbatim to the command without using the shell nor doing any splitting. Setting LDFLAGS='-Wl,-O1 -Wl,--as-needed' before running CMake results in the variable CMAKE_EXE_LINKER_FLAGS having the literal value of LDFLAGS, and then this: execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_EXE_LINKER_FLAGS} -Wl,--version OUTPUT_VARIABLE LD_VERSION ERROR_QUIET ) Results in trying to executing (argument index in square brackets): [0]: cc [1]: -Wl,-O1 -Wl,--as-needed [2]: -Wl,--version When what is needed is: [0]: cc [1]: -Wl,-O1 [2]: -Wl,--as-needed [3]: -Wl,--version I have a patch to fix the two usages of execute_process() introduced in r288994 but we might want to audit all the callsites where this CMake command is used to make sure no other similar problems lurk undiscovered.
Note that previous uses of execute_process() would hit the same issue when setting LD/CC/CXX in the environment to some value that includes spaces, so the following would fail even before the patch from r288994: CC='ccache gcc' CXX='ccache g++' Tools/Scripts/build-webkit [...] This explains why I have a vague memory of trying to use “ccache” by adding it as prefix for the compiler command and it failed (of course this is *not* the recommended way of using “ccache”, but the same issue would break the build with any other similar compiler wrappers.)
Created attachment 451375 [details] Patch
Committed r289473 (247016@main): <https://commits.webkit.org/247016@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 451375 [details].
<rdar://problem/88691618>