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
305785
[GTK] Failed to build the Swift demo URI scheme
https://bugs.webkit.org/show_bug.cgi?id=305785
Summary
[GTK] Failed to build the Swift demo URI scheme
Alberto Garcia
Reported
2026-01-19 10:36:10 PST
Created
attachment 478072
[details]
Patch Hi, when trying to build WebKitGTK (commit b1d17224788592b0e9352be9ec57ea02136640bd) using -DENABLE_SWIFT_DEMO_URI_SCHEME=ON on Debian sid I get these two errors: /tmp/WebKit/Source/WebKit/Modules/Internal/WebKitInternalCxx.h:28:9: note: in file included from /tmp/WebKit/Source/WebKit/Modules/Internal/WebKitInternalCxx.h:28: 26 | // Add project-level C++ header files here to be able to access them from within Swift sources. 27 | 28 | #import "IPCTesterReceiverMessages.h" | `- note: in file included from /tmp/WebKit/Source/WebKit/Modules/Internal/WebKitInternalCxx.h:28: 29 | #import "UIProcess/SwiftDemoLogoConfirmation.h" 30 | /tmp/WebKit/build-gtk3/DerivedSources/WebKit/IPCTesterReceiverMessages.h:27:5: error: function-like macro 'ENABLE' is not defined 25 | #pragma once 26 | 27 | #if ENABLE(IPC_TESTING_API) | `- error: function-like macro 'ENABLE' is not defined 28 | 29 | #include "ArgumentCoders.h" /tmp/WebKit/Source/WebKit/UIProcess/SwiftDemoLogo.swift:27:17: error: could not build C module 'WebKit_Internal' 25 | 26 | import Foundation 27 | internal import WebKit_Internal | `- error: could not build C module 'WebKit_Internal' 28 | 29 | extension Data { I worked around this with the following change: --- webkitgtk.orig/Source/WebKit/Modules/Internal/WebKitInternalCxx.h +++ webkitgtk/Source/WebKit/Modules/Internal/WebKitInternalCxx.h @@ -25,5 +25,6 @@ // Add project-level C++ header files here to be able to access them from within Swift sources. +#import "wtf/Platform.h" #import "IPCTesterReceiverSwiftMessages.h" #import "UIProcess/SwiftDemoLogoConfirmation.h" ------------------------- The only problem is that some of the compiler options are rejected by swiftc so I think the swiftc-wrapper.sh script should filter them. I'm attaching a patch for both issues.
Attachments
Patch
(1.52 KB, patch)
2026-01-19 10:36 PST
,
Alberto Garcia
no flags
Details
Formatted Diff
Diff
Error messages when building with -static-stdlib
(28.41 KB, text/plain)
2026-01-21 03:44 PST
,
Alberto Garcia
no flags
Details
Patch for swiftc-wrapper.sh
(1.12 KB, patch)
2026-01-25 10:49 PST
,
Alberto Garcia
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alberto Garcia
Comment 1
2026-01-19 10:38:10 PST
> The only problem is that some of the compiler options are rejected by swiftc
I meant the **other** problem
Michael Catanzaro
Comment 2
2026-01-20 05:36:59 PST
You noted in Matrix that the Swift runtime uses unversioned shared libraries, which is not acceptable: ``` $ ldd /usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/MiniBrowser |grep -i swift libswiftCore.so => /usr/libexec/swift/lib/swift/linux/libswiftCore.so (0x00007f1e54600000) libswift_Concurrency.so => /usr/libexec/swift/lib/swift/linux/libswift_Concurrency.so (0x00007f1e550f6000) libswift_StringProcessing.so => /usr/libexec/swift/lib/swift/linux/libswift_StringProcessing.so (0x00007f1e5503a000) libswift_RegexParser.so => /usr/libexec/swift/lib/swift/linux/libswift_RegexParser.so (0x00007f1e54ce7000) libswiftGlibc.so => /usr/libexec/swift/lib/swift/linux/libswiftGlibc.so (0x00007f1e56bdd000) libBlocksRuntime.so => /usr/libexec/swift/lib/swift/linux/libBlocksRuntime.so (0x00007f1e56ffa000) libdispatch.so => /usr/libexec/swift/lib/swift/linux/libdispatch.so (0x00007f1e545a1000) libswiftDispatch.so => /usr/libexec/swift/lib/swift/linux/libswiftDispatch.so (0x00007f1e55497000) libFoundation.so => /usr/libexec/swift/lib/swift/linux/libFoundation.so (0x00007f1e53e00000) libFoundationEssentials.so => /usr/libexec/swift/lib/swift/linux/libFoundationEssentials.so (0x00007f1e53600000) libFoundationInternationalization.so => /usr/libexec/swift/lib/swift/linux/libFoundationInternationalization.so (0x00007f1e53417000) lib_FoundationICU.so => /usr/libexec/swift/lib/swift/linux/lib_FoundationICU.so (0x00007f1e4f400000) libswiftSynchronization.so => /usr/libexec/swift/lib/swift/linux/libswiftSynchronization.so (0x00007f1e527ee000) ``` Adrian suggested that we use `-Xswiftc -static-stdlib` to link these runtimes statically instead.
Michael Catanzaro
Comment 3
2026-01-20 05:39:48 PST
(That was suggested by Adrian Perez, not Adrian Taylor.)
Alberto Garcia
Comment 4
2026-01-20 05:50:05 PST
My first attempt to use -static-stdlib results in lots of errors like this one: /usr/libexec/swift/lib/swift_static/shims/module.modulemap:26:8: error: redefinition of module '_SwiftConcurrencyShims' 24 | } 25 | 26 | module _SwiftConcurrencyShims { | `- error: redefinition of module '_SwiftConcurrencyShims' 27 | header "_SwiftConcurrency.h" 28 | }
adrian_taylor
Comment 5
2026-01-20 07:56:29 PST
I think the better fix for the Messages.h ENABLE problem is to get messages.py to emit #include <wtf/PlatformEnable.h> (or similar) before it adds a condition. I've got a commit somewhere which does that - I'll try to turn it into a PR. As to the static/dynamic/versioning issue, could I suggest you add a comment to
https://github.com/swiftlang/swift-corelibs-foundation/issues/4456
with your perspectives and needs, and then I'll try to nudge some folks to take a look? (I'm not sure if that's the canonical issue, it's just the one I found through searching).
adrian_taylor
Comment 6
2026-01-20 08:59:19 PST
https://github.com/WebKit/WebKit/pull/56906
for the ENABLE issue.
Michael Catanzaro
Comment 7
2026-01-20 09:10:53 PST
I have left a comment in that upstream issue.
Alberto Garcia
Comment 8
2026-01-21 03:44:24 PST
Created
attachment 478088
[details]
Error messages when building with -static-stdlib For reference here's the full error that I get when I use -static-stdlib. I'm adding that flag to the swiftc-wrapper.sh script, that's why you don't see it in the output.
Alberto Garcia
Comment 9
2026-01-25 10:49:16 PST
Created
attachment 478126
[details]
Patch for swiftc-wrapper.sh Here's the patch that I used for swiftc-wrapper.sh I have been able to build WebKitGTK on Debian with it. I also updated the script to set REAL_SWIFTC=swiftc by default. This is optional but I think that it makes sense. It can still be overridden with --original-swift-compiler.
Alberto Garcia
Comment 10
2026-03-14 04:52:57 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/60628
EWS
Comment 11
2026-03-16 03:02:12 PDT
Committed
309313@main
(76fd1a827851): <
https://commits.webkit.org/309313@main
> Reviewed commits have been landed. Closing PR #60628 and removing active labels.
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