aboutsummaryrefslogtreecommitdiffstats
path: root/testing/emscripten/embuilder-fix-task-all-for-wasm.patch
blob: 375891e6eb32fe3580aff26afc6f7d0681c5dc87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 2 Apr 2017 23:11:41 +0200
Subject: [PATCH] embuilder: if EMCC_WASM_BACKEND, omit tasks using pthreads
 from ALL

Fixes the following error:

    $ EMCC_WASM_BACKEND=1 ./embuild build ALL
    Traceback (most recent call last):
      File "emscripten/src/emscripten-1.37.9/emcc", line 13, in <module>
        emcc.run()
      File "emscripten/src/emscripten-1.37.9/emcc.py", line 1278, in run
        assert not shared.Settings.USE_PTHREADS, 'WebAssembly does not support pthreads'
    AssertionError: WebAssembly does not support pthreads

Upstream-Issue: https://github.com/kripken/emscripten/pull/5107
---
 embuilder.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/embuilder.py b/embuilder.py
index 6674ccd..eaa762a 100755
--- a/embuilder.py
+++ b/embuilder.py
@@ -84,6 +84,10 @@ def build_port(port_name, lib_name, params):
   tasks = sys.argv[2:]
   if 'ALL' in tasks:
     tasks = ['libc', 'libc-mt', 'dlmalloc', 'dlmalloc_threadsafe', 'pthreads', 'libcxx', 'libcxx_noexcept', 'libcxxabi', 'gl', 'binaryen', 'bullet', 'freetype', 'libpng', 'ogg', 'sdl2', 'sdl2-image', 'sdl2-ttf', 'sdl2-net', 'vorbis', 'zlib']
+    if os.environ.get('EMCC_WASM_BACKEND') == '1':
+      skip_tasks = {'libc-mt', 'dlmalloc_threadsafe', 'pthreads'}
+      print('Skipping building of %s, because WebAssembly does not support pthreads.' % ', '.join(skip_tasks))
+      tasks = [x for x in tasks if x not in skip_tasks]
     if os.environ.get('EMSCRIPTEN_NATIVE_OPTIMIZER'):
       print 'Skipping building of native-optimizer since environment variable EMSCRIPTEN_NATIVE_OPTIMIZER is present and set to point to a prebuilt native optimizer path.'
     elif hasattr(shared, 'EMSCRIPTEN_NATIVE_OPTIMIZER'):