<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>236365</bug_id>
          
          <creation_ts>2022-02-09 07:21:05 -0800</creation_ts>
          <short_desc>[CMake] REGRESSION(r288994): Setting multiple values in LDFLAGS causes incorrect linker detection</short_desc>
          <delta_ts>2022-02-09 08:36:17 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=235476</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=236366</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adrian Perez">aperez</reporter>
          <assigned_to name="Adrian Perez">aperez</assigned_to>
          <cc>annulen</cc>
    
    <cc>aperez</cc>
    
    <cc>cgarcia</cc>
    
    <cc>clopez</cc>
    
    <cc>darin</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mrobinson</cc>
    
    <cc>pnormand</cc>
    
    <cc>ryuan.choi</cc>
    
    <cc>saam</cc>
    
    <cc>sergio</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1839136</commentid>
    <comment_count>0</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-02-09 07:21:05 -0800</bug_when>
    <thetext>After r288994, doing something like the following will cause the linker
to be wrongly identified:

  LDFLAGS=&apos;-Wl,-O1 -Wl,--as-needed&apos; Tools/Scripts/build-webkit [...]

and CMake will print the following (it should read “BFD”):

  -- Linker variant in use: UNKNOWN</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839138</commentid>
    <comment_count>1</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-02-09 07:26:51 -0800</bug_when>
    <thetext>This is caused by CMake&apos;s execute_process() passing arguments verbatim
to the command without using the shell nor doing any splitting. Setting 
LDFLAGS=&apos;-Wl,-O1 -Wl,--as-needed&apos; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839141</commentid>
    <comment_count>2</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-02-09 07:30:52 -0800</bug_when>
    <thetext>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=&apos;ccache gcc&apos; CXX=&apos;ccache g++&apos; 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.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839145</commentid>
    <comment_count>3</comment_count>
      <attachid>451375</attachid>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-02-09 07:33:58 -0800</bug_when>
    <thetext>Created attachment 451375
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839183</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-02-09 08:35:47 -0800</bug_when>
    <thetext>Committed r289473 (247016@main): &lt;https://commits.webkit.org/247016@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 451375.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839184</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-02-09 08:36:17 -0800</bug_when>
    <thetext>&lt;rdar://problem/88691618&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>451375</attachid>
            <date>2022-02-09 07:33:58 -0800</date>
            <delta_ts>2022-02-09 08:35:51 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-236365-20220209173357.patch</filename>
            <type>text/plain</type>
            <size>2264</size>
            <attacher name="Adrian Perez">aperez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjg5NDY3CmRpZmYgLS1naXQgYS9Tb3VyY2UvY21ha2UvT3B0
aW9uc0NvbW1vbi5jbWFrZSBiL1NvdXJjZS9jbWFrZS9PcHRpb25zQ29tbW9uLmNtYWtlCmluZGV4
IDQwYzI0YmExMDY0YzMxZDdlZjQ0OGI1ZmU3ZmE2Mzc1YzZlYzc4OTEuLjlmNDU1MzY1YjVkMTdl
NDM1MzYwYjBjNDRkOTY5ODFmMjM0YmJjZjAgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9jbWFrZS9Pc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