WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
236365
[CMake] REGRESSION(
r288994
): Setting multiple values in LDFLAGS causes incorrect linker detection
https://bugs.webkit.org/show_bug.cgi?id=236365
Summary
[CMake] REGRESSION(r288994): Setting multiple values in LDFLAGS causes incorr...
Adrian Perez
Reported
2022-02-09 07:21:05 PST
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
Attachments
Patch
(2.21 KB, patch)
2022-02-09 07:33 PST
,
Adrian Perez
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Adrian Perez
Comment 1
2022-02-09 07:26:51 PST
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.
Adrian Perez
Comment 2
2022-02-09 07:30:52 PST
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.)
Adrian Perez
Comment 3
2022-02-09 07:33:58 PST
Created
attachment 451375
[details]
Patch
EWS
Comment 4
2022-02-09 08:35:47 PST
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]
.
Radar WebKit Bug Importer
Comment 5
2022-02-09 08:36:17 PST
<
rdar://problem/88691618
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug