Skip to content

Commit a3650c0

Browse files
kainino0xDawn LUCI CQ
authored andcommitted
[emscripten] Error on LINK_AS_CXX=0 in emdawnwebgpu.port.py
webgpu.cpp uses C++ library functions, so it needs to be linked with C++ support, otherwise it gets a long list of missing C++ STL symbol errors. Make this an explicit error so people know what to do if they get this error (because they're using -sSTRICT or -sNO_DEFAULT_TO_CXX). Initial discussion: emscripten-core/emscripten#25397 (comment) Bug: none Change-Id: I99b766298f47b946e0ba49eacad04fe8b427f6de Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/264434 Reviewed-by: Loko Kung <[email protected]> Commit-Queue: Kai Ninomiya <[email protected]>
1 parent 71ab167 commit a3650c0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.github/workflows/package-emdawnwebgpu.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ LICENSE = "Some files: BSD 3-Clause License. Other files: Emscripten's license (
113113
DESCRIPTION = "Emdawnwebgpu implements webgpu.h on WebGPU, replacing -sUSE_WEBGPU. **For info on usage and filing feedback, see link below.**"
114114
URL = 'https://dawn.googlesource.com/dawn/+/${SHA}/src/emdawnwebgpu/pkg/README.md'
115115
116+
116117
# Emscripten <4.0.10 won't notice EXTERNAL_PORT and will try to use this.
117118
def get(ports, settings, shared):
118119
raise Exception('Remote ports require Emscripten 4.0.10+.')
120+
121+
122+
# (Make this look like a port so that the error message above can be hit.)
119123
def clear(ports, settings, shared):
120124
pass
121125
EOF

src/emdawnwebgpu/pkg/emdawnwebgpu.port.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ def linker_setup(ports, settings):
181181
if settings.USE_WEBGPU:
182182
raise Exception('emdawnwebgpu may not be used with -sUSE_WEBGPU=1')
183183

184+
if not settings.LINK_AS_CXX:
185+
raise Exception(
186+
'emdawnwebgpu requires C++. Link using em++ (or emcc -sDEFAULT_TO_CXX), instead of emcc.'
187+
)
188+
184189
# These will be processed in order; library_webgpu.js must come after
185190
# the generated files, because it depends on them.
186191
settings.JS_LIBRARIES += [
@@ -189,6 +194,7 @@ def linker_setup(ports, settings):
189194
os.path.join(_src_dir, 'library_webgpu_generated_sig_info.js'),
190195
os.path.join(_src_dir, 'library_webgpu.js'),
191196
]
197+
192198
if 'CLOSURE_ARGS' in settings.keys():
193199
# This works in Emscripten >4.0.7. In <=4.0.7, the user has to pass it.
194200
settings.CLOSURE_ARGS += [

0 commit comments

Comments
 (0)