<?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>316000</bug_id>
          
          <creation_ts>2026-06-01 08:13:58 -0700</creation_ts>
          <short_desc>REGRESSION(314042@main): Intermittent build failures on CMake+Gtk/Swift builds</short_desc>
          <delta_ts>2026-06-01 15:12:19 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CMake</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>315699</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nikolas Zimmermann">zimmermann</reporter>
          <assigned_to name="Nikolas Zimmermann">zimmermann</assigned_to>
          <cc>adrian_taylor</cc>
    
    <cc>ggaren</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2216385</commentid>
    <comment_count>0</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2026-06-01 08:13:58 -0700</bug_when>
    <thetext>On the GTK EWS builder GTK-GTK3-LibWebRTC-Build-EWS (#173), build-webkit fails sporadically (passes on retry) with:

&lt;snippet&gt;
[267/2053] Generating ../../WebKitGTK/DerivedSources/InspectorGResourceBundle.c, ../../WebKitGTK/DerivedSources/InspectorGResourceBundle.c.deps
[269/2053] Generating ../../DerivedSources/WebKit/GeneratedSerializers.h, ../../DerivedSources/WebKit/GeneratedSerializersShared.cpp, ../../DerivedSources/WebKit/GeneratedSerializersWebProcess.cpp, ../../DerivedSources/WebKit/GeneratedSerializersGPUProcess.cpp, ../../DerivedSources/WebKit/GeneratedSerializersNetworkProcess.cpp, ../../DerivedSources/WebKit/GeneratedSerializersPlatform.cpp, ../../DerivedSources/WebKit/GeneratedSerializersModelProcess.cpp, ../../DerivedSources/WebKit/GeneratedSerializersUIProcess.cpp, ../../DerivedSources/WebKit/GeneratedSerializersCommon.cpp, ../../DerivedSources/WebKit/GeneratedWebKitSecureCoding.h, ../../DerivedSources/WebKit/GeneratedWebKitSecureCoding.cpp, ../../DerivedSources/WebKit/SerializedTypeInfo.cpp, ../../DerivedSources/WebKit/WebKitPlatformGeneratedSerializers.cpp
generate-serializers.py: 6 type(s) fell into GeneratedSerializersCommon.cpp (residual bucket): WebCore::DocumentSyncData, WebCore::DocumentSyncSerializationData, WebCore::FrameTreeSyncData, WebCore::FrameTreeSyncSerializationData, WebCore::SharedTimebaseHandle, WebKit::SharedPreferencesForWebProcess
[270/2053] Generating WebKit Swift-C++ header
FAILED: DerivedSources/WebKit/WebKit-Swift-CPP.h.stamp DerivedSources/WebKit/WebKit-Swift-CPP.h /sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h.stamp /sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h 
cd /sdk/webkit/WebKitBuild/GTK/Release/Source/WebKit &amp;&amp; /usr/bin/cmake -E copy_if_different /sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h.tmp /sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h &amp;&amp; /usr/bin/cmake -E touch /sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h.stamp
Error copying file (if different) from &quot;/sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h.tmp&quot; to &quot;/sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h&quot;.
[271/2053] Generating ../../JavaScriptCore/DerivedSources/LLIntDesiredSettings.h
ninja: build stopped: subcommand failed.
&lt;/snippet&gt;

See https://ews-build.webkit.org/#/builders/173/builds/22800 for the full log.
Same happend on e.g. builds 22806, 22804. The without-change rebuild then succeeds, so EWS blames the PR, but it is environmental flakiness, not the change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2216394</commentid>
    <comment_count>1</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2026-06-01 08:36:44 -0700</bug_when>
    <thetext>Before 314042@main a single, independent `swiftc -typecheck` command was the _only_ writer of WebKit-Swift-CPP.h.tmp, and it copied in the same step -&gt; one writer, no race.
314042@main removed that command, made the header a side-effect of the real compile, and because the legacy (pre-CMP0157 -- we still have CMake 3.28 in the CI) model compiles Swift in the link step - added the WebKit_SwiftCompile helper. The helper inherits the emit flag, so now both the helper and the real libwebkitgtk link write the same temp, and the copy waits on only one....


From build.ninja

1. First writer

```
#############################################
# Link the shared library lib/libwebkitgtk-6.0.so.4.17.2

build lib/libwebkitgtk-6.0.so.4.17.2 Source/WebKit/CMakeFiles/WebKit.dir/UIProcess/SwiftDemoLogo.swift.o ... -emit-clang-header-path /sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h.tmp ...
  INCLUDES = -I /sdk/webkit/WebKitBuild/GTK/Release/Source/WebKit/include ...
...
```

2. Second writer

```
#############################################
# Link the static library lib/libWebKit_SwiftCompile.a
  
build lib/libWebKit_SwiftCompile.a Source/WebKit/CMakeFiles/WebKit_SwiftCompile.dir/UIProcess/SwiftDemoLogo.swift.o  -emit-clang-header-path /sdk/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/WebKit-Swift-CPP.h.tmp ...
  INCLUDES = -I /opt/swift/usr/lib/swift -I /sdk/webkit/WebKitBuild/GTK/Release/Source/WebKit/include ...
...
```

--&gt; Two  rules write the same WebKit-Swift-CPP.h.tmp; the copy waits for one of them and reads the file while the other may still be writing it. Since neither rule declares .tmp as a ninja output,  ninja never serializes them. That&apos;s my guess for the sporadic error &quot;Error copying file&quot; that we observe...

We need to support CMake &lt; 3.29, so needs a proper fix. Newer CMake versions are not affected, since the -emit-clang-header-path... is only done once.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2216505</commentid>
    <comment_count>2</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2026-06-01 14:16:01 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/66199</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2216527</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-06-01 15:12:17 -0700</bug_when>
    <thetext>Committed 314322@main (9584faf20f98): &lt;https://commits.webkit.org/314322@main&gt;

Reviewed commits have been landed. Closing PR #66199 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>