Build emscripten caches in sandbox
This makes it so that we actually build the various standard
library-like things built within the sandbox rather than being some
random files that I generate ad-hoc and copy into the correct folder.
This requires patching emcc so that it adds the necessary -isystem flags
when building those libraries.
Change-Id: I7b71b36cbbafd511df5d7a8396794aeee2403a05
diff --git a/build_tests/BUILD b/build_tests/BUILD
index 7d30723..07b84fe 100644
--- a/build_tests/BUILD
+++ b/build_tests/BUILD
@@ -8,6 +8,22 @@
srcs = ["helloworld.cc"],
)
+emcc_binary(
+ name = "webgl.html",
+ srcs = ["webgl_draw_triangle.c"],
+)
+
+emcc_binary(
+ name = "webgl2.html",
+ srcs = ["webgl2_draw_packed_triangle.c"],
+ # Enable WEBGL2 (-s is used by the emscripten
+ # compiler to specify sundry options).
+ linkopts = [
+ "-s",
+ "USE_WEBGL2=1",
+ ],
+)
+
cc_test(
name = "gflags_build_test",
size = "small",
diff --git a/build_tests/webgl2_draw_packed_triangle.c b/build_tests/webgl2_draw_packed_triangle.c
new file mode 100644
index 0000000..5dd74d7
--- /dev/null
+++ b/build_tests/webgl2_draw_packed_triangle.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2018 The Emscripten Authors. All rights reserved.
+ * Emscripten is available under two separate licenses, the MIT license and the
+ * University of Illinois/NCSA Open Source License. Both these licenses can be
+ * found in the LICENSE file.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <emscripten/emscripten.h>
+#include <emscripten/html5.h>
+#include <GLES3/gl3.h>
+
+GLuint compile_shader(GLenum shaderType, const char *src)
+{
+ GLuint shader = glCreateShader(shaderType);
+ glShaderSource(shader, 1, &src, NULL);
+ glCompileShader(shader);
+
+ GLint isCompiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &isCompiled);
+ if (!isCompiled)
+ {
+ GLint maxLength = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
+ char *buf = (char*)malloc(maxLength+1);
+ glGetShaderInfoLog(shader, maxLength, &maxLength, buf);
+ printf("%s\n", buf);
+ free(buf);
+ return 0;
+ }
+
+ return shader;
+}
+
+GLuint create_program(GLuint vertexShader, GLuint fragmentShader)
+{
+ GLuint program = glCreateProgram();
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, fragmentShader);
+ glBindAttribLocation(program, 0, "apos");
+ glBindAttribLocation(program, 1, "acolor");
+ glLinkProgram(program);
+ return program;
+}
+
+int main()
+{
+ EmscriptenWebGLContextAttributes attr;
+ emscripten_webgl_init_context_attributes(&attr);
+#ifdef EXPLICIT_SWAP
+ attr.explicitSwapControl = 1;
+#endif
+ attr.majorVersion = 2;
+ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context("#canvas", &attr);
+ assert(ctx && "Failed to create WebGL2 context");
+ emscripten_webgl_make_context_current(ctx);
+
+ static const char vertex_shader[] =
+ "#version 100\n"
+ "attribute vec4 apos;"
+ "attribute vec4 acolor;"
+ "varying vec4 color;"
+ "void main() {"
+ "color = acolor;"
+ "gl_Position = apos;"
+ "}";
+ GLuint vs = compile_shader(GL_VERTEX_SHADER, vertex_shader);
+
+ static const char fragment_shader[] =
+ "#version 100\n"
+ "precision lowp float;"
+ "varying vec4 color;"
+ "void main() {"
+ "gl_FragColor = color;"
+ "}";
+ GLuint fs = compile_shader(GL_FRAGMENT_SHADER, fragment_shader);
+
+ GLuint program = create_program(vs, fs);
+ glUseProgram(program);
+
+ static const uint32_t pos_and_color[] = {
+ // 1,0,y,x, a,b,g,r
+ 0x400b36cd, 0xc00003ff,
+ 0x400b3533, 0xc00ffc00,
+ 0x4004cc00, 0xfff00000,
+ };
+
+ GLuint vbo;
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(pos_and_color), pos_and_color, GL_STATIC_DRAW);
+ glVertexAttribPointer(0, 4, GL_INT_2_10_10_10_REV, GL_TRUE, 8, 0);
+// printf("%d\n", glGetError());
+#if 0
+ switch (glGetError()) {
+ case GL_NO_ERROR:
+ std::cout << "No error!";
+ break;
+ case GL_INVALID_ENUM:
+ std::cout << "Invliad enum.";
+ break;
+ }
+#endif
+ assert(glGetError() == GL_NO_ERROR && "glVertexAttribPointer with GL_INT_2_10_10_10_REV failed");
+ glVertexAttribPointer(1, 4, GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 8, (void*)4);
+ assert(glGetError() == GL_NO_ERROR && "glVertexAttribPointer with GL_UNSIGNED_INT_2_10_10_10_REV failed");
+
+ glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(1);
+
+ glClearColor(0.3f,0.3f,0.3f,1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+
+#ifdef EXPLICIT_SWAP
+ emscripten_webgl_commit_frame();
+#endif
+
+#ifdef REPORT_RESULT
+ REPORT_RESULT(0);
+#endif
+}
diff --git a/build_tests/webgl_draw_triangle.c b/build_tests/webgl_draw_triangle.c
new file mode 100644
index 0000000..be88173
--- /dev/null
+++ b/build_tests/webgl_draw_triangle.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2018 The Emscripten Authors. All rights reserved.
+ * Emscripten is available under two separate licenses, the MIT license and the
+ * University of Illinois/NCSA Open Source License. Both these licenses can be
+ * found in the LICENSE file.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <emscripten/emscripten.h>
+#include <emscripten/html5.h>
+#include <GLES2/gl2.h>
+
+GLuint compile_shader(GLenum shaderType, const char *src)
+{
+ GLuint shader = glCreateShader(shaderType);
+ glShaderSource(shader, 1, &src, NULL);
+ glCompileShader(shader);
+
+ GLint isCompiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &isCompiled);
+ if (!isCompiled)
+ {
+ GLint maxLength = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
+ char *buf = (char*)malloc(maxLength+1);
+ glGetShaderInfoLog(shader, maxLength, &maxLength, buf);
+ printf("%s\n", buf);
+ free(buf);
+ return 0;
+ }
+
+ return shader;
+}
+
+GLuint create_program(GLuint vertexShader, GLuint fragmentShader)
+{
+ GLuint program = glCreateProgram();
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, fragmentShader);
+ glBindAttribLocation(program, 0, "apos");
+ glBindAttribLocation(program, 1, "acolor");
+ glLinkProgram(program);
+ return program;
+}
+
+int main()
+{
+ EmscriptenWebGLContextAttributes attr;
+ emscripten_webgl_init_context_attributes(&attr);
+#ifdef EXPLICIT_SWAP
+ attr.explicitSwapControl = 1;
+#endif
+#ifdef DRAW_FROM_CLIENT_MEMORY
+ // This test verifies that drawing from client-side memory when enableExtensionsByDefault==false works.
+ attr.enableExtensionsByDefault = 0;
+#endif
+
+ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context("#canvas", &attr);
+ emscripten_webgl_make_context_current(ctx);
+
+ static const char vertex_shader[] =
+ "attribute vec4 apos;"
+ "attribute vec4 acolor;"
+ "varying vec4 color;"
+ "void main() {"
+ "color = acolor;"
+ "gl_Position = apos;"
+ "}";
+ GLuint vs = compile_shader(GL_VERTEX_SHADER, vertex_shader);
+
+ static const char fragment_shader[] =
+ "precision lowp float;"
+ "varying vec4 color;"
+ "void main() {"
+ "gl_FragColor = color;"
+ "}";
+ GLuint fs = compile_shader(GL_FRAGMENT_SHADER, fragment_shader);
+
+ GLuint program = create_program(vs, fs);
+ glUseProgram(program);
+
+ static const float pos_and_color[] = {
+ // x, y, r, g, b
+ -0.6f, -0.6f, 1, 0, 0,
+ 0.6f, -0.6f, 0, 1, 0,
+ 0.f, 0.6f, 0, 0, 1,
+ };
+
+#ifdef DRAW_FROM_CLIENT_MEMORY
+ glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 20, pos_and_color);
+ glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 20, (void*)(pos_and_color+2));
+#else
+ GLuint vbo;
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(pos_and_color), pos_and_color, GL_STATIC_DRAW);
+ glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 20, 0);
+ glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 20, (void*)8);
+#endif
+ glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(1);
+
+ glClearColor(0.3f,0.3f,0.3f,1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+
+#ifdef EXPLICIT_SWAP
+ emscripten_webgl_commit_frame();
+#endif
+
+#ifdef REPORT_RESULT
+ REPORT_RESULT(0);
+#endif
+}
diff --git a/debian/emscripten_toolchain.patch b/debian/emscripten_toolchain.patch
index 8a659d1..cf02316 100644
--- a/debian/emscripten_toolchain.patch
+++ b/debian/emscripten_toolchain.patch
@@ -30,4 +30,63 @@
if should_exit:
sys.exit(0)
+--- tools/system_libs.py
++++ tools/system_libs.py
+@@ -89,10 +89,20 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+ if os.name != 'nt' and '\r\n' in content:
+ raise Exception('Windows newlines \\r\\n detected in symbols file "' + path + '"! This could happen for example when copying Emscripten checkout from Windows to Linux or macOS. Please use Unix line endings on checkouts of Emscripten on Linux and macOS!')
+ return shared.Building.parse_symbols(content).defs
+
+- default_opts = ['-Werror']
++ default_opts = ['-Werror',
++ '-isystem',
++ shared.path_from_root('system', 'include'),
++ '-isystem',
++ shared.path_from_root('system', 'include', 'libcxx'),
++ '-isystem',
++ shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'emscripten'),
++ '-isystem',
++ shared.path_from_root('system', 'include', 'compat'),
++ '-isystem',
++ shared.path_from_root('system', 'include', 'libc')]
+
+ # XXX We also need to add libc symbols that use malloc, for example strdup. It's very rare to use just them and not
+ # a normal malloc symbol (like free, after calling strdup), so we haven't hit this yet, but it is possible.
+ libc_symbols = read_symbols(shared.path_from_root('system', 'lib', 'libc.symbols'))
+@@ -426,5 +436,5 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+ def create_al(libname): # libname is ignored, this is just one .o file
+ o = in_temp('al.o')
+- check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'al.c'), '-o', o, '-Os'] + get_cflags())
++ check_call([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'al.c'), '-o', o, '-Os'] + get_cflags() + default_opts)
+ return o
+
+@@ -447,5 +455,5 @@ def create_compiler_rt(libname):
+ for src in files:
+ o = in_temp(os.path.basename(src) + '.o')
+- commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-O2', '-o', o] + get_cflags())
++ commands.append([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', src), '-O2', '-o', o] + get_cflags() + default_opts)
+ o_s.append(o)
+ run_commands(commands)
+@@ -500,5 +506,5 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
+ def create_malloc(out_name):
+ o = in_temp(out_name)
+- cflags = ['-O2', '-fno-builtin']
++ cflags = default_opts + ['-O2', '-fno-builtin']
+ if shared.Settings.USE_PTHREADS:
+ cflags += ['-s', 'USE_PTHREADS=1']
+--- tools/gen_struct_info.py
++++ tools/gen_struct_info.py
+@@ -401,4 +401,12 @@ def inspect_code(headers, cpp_opts, structs, defines):
+ # Compile the program.
+ show('Compiling generated code...')
++ cpp_opts += ['-isystem',
++ shared.path_from_root('system', 'include'),
++ '-isystem',
++ shared.path_from_root('system', 'include', 'libcxx'),
++ '-isystem',
++ shared.path_from_root('system', 'lib', 'libc', 'musl', 'arch', 'emscripten'),
++ '-isystem',
++ shared.path_from_root('system', 'include', 'libc')]
+ # -Oz optimizes enough to avoid warnings on code size/num locals
+ cmd = [shared.PYTHON, shared.EMCC] + cpp_opts + ['-o', js_file[1], src_file[1], '-s', 'BOOTSTRAPPING_STRUCT_INFO=1', '-s', 'WARN_ON_UNDEFINED_SYMBOLS=0', '-O0', '--js-opts', '0', '--memory-init-file', '0', '-s', 'SINGLE_FILE=1', '-Wno-format']
diff --git a/tools/cpp/emscripten/BUILD b/tools/cpp/emscripten/BUILD
index dd304e1..6a67e4f 100644
--- a/tools/cpp/emscripten/BUILD
+++ b/tools/cpp/emscripten/BUILD
@@ -1,26 +1,46 @@
package(default_visibility = ["//visibility:public"])
+_minimum_fileset = [
+ "emar.sh",
+ "emcc.sh",
+ "@emscripten_clang//:all",
+ "@emscripten_toolchain//:all",
+ "@nodejs//:bin/node",
+]
+
+filegroup(
+ name = "minimum_files",
+ srcs = _minimum_fileset,
+)
+
filegroup(
name = "all",
- srcs = [
- "emar.sh",
- "emcc.sh",
+ srcs = _minimum_fileset + [
":emscripten_cache_content",
- "@emscripten_clang//:all",
- "@emscripten_toolchain//:all",
- "@nodejs//:bin/node",
],
)
-# TODO(james): There is a set of static files that emscripten will always
-# attempt to either rebuild or source from a cache. Ideally, we would make
-# the build of these files part of the normal build process; however, the
-# emscripten compiler handles sandboxing poorly for these files and so it
-# is simplest to just manually run emscripten outside of the sandbox and
-# copy over the cache folder for now.
+# A list of all the cached libraries generad and used by emscripten.
+_libs = \
+ ["emscripten_cache/asmjs/" + lib for lib in [
+ "generated_struct_info.json",
+ "libc.bc",
+ "libcompiler_rt.a",
+ "libc-wasm.bc",
+ "libpthreads_stub.bc",
+ "libhtml5.bc",
+ "libdlmalloc.bc",
+ "libal.bc",
+ "libc++_noexcept.a",
+ "libc++abi.bc",
+ "libgl-webgl2.bc",
+ "libgl.bc",
+ "libc-extras.bc",
+ ]]
+
filegroup(
name = "emscripten_cache_content",
- srcs = glob(["emscripten_cache/**/*"]),
+ srcs = glob(["emscripten_cache/**/*"]) + _libs,
)
cc_toolchain(
@@ -36,3 +56,22 @@
strip_files = ":empty",
supports_param_files = 0,
)
+
+# TODO(james): Currently, this gets built with the host configuration.
+# Currently, that doesn't actually impact the build since there's nothing that
+# affects how the genrule is run. However, that also means that changing
+# the configuration (and thus the flags that may be passed to the C++
+# compiler) will not change how these cache files are generated.
+genrule(
+ name = "gencache",
+ # Note that foo.o is just some arbitrary .o file. I had trouble getting
+ # emscripten to work properly when pointed at a literally empty file, but
+ # the exact contents of the .o aren't particularly important.
+ srcs = [":foo.o"],
+ outs = _libs,
+ cmd = "$(location gencache.sh) $(OUTS)",
+ tools = [
+ ":gencache.sh",
+ ":minimum_files",
+ ],
+)
diff --git a/tools/cpp/emscripten/emcc.sh b/tools/cpp/emscripten/emcc.sh
index 52ed893..814cd04 100755
--- a/tools/cpp/emscripten/emcc.sh
+++ b/tools/cpp/emscripten/emcc.sh
@@ -25,15 +25,17 @@
# Prepare the cache content so emscripten doesn't try to rebuild it all the time
cache_source=tools/cpp/emscripten/emscripten_cache
-if [ -d toolchain/emscripten_cache ]; then
- cache_source=toolchain/emscripten_cache
+# TODO(james): How do I avoid hardcoding this path? This is needed to make
+# gencache.sh work properly and to have it put the files in the correct spot.
+if [ -d bazel-out/host/bin/tools/cpp/emscripten/emscripten_cache ]; then
+ cache_source=bazel-out/host/bin/tools/cpp/emscripten/emscripten_cache
elif [ -d external/rules_emscripten/toolchain/emscripten_cache ]; then
cache_source=external/rules_emscripten/toolchain/emscripten_cache
fi
(
cd tmp/emscripten_cache;
for n in "../../$cache_source"/*;do
- ln -s "$n"
+ ln -f -s "$n"
done
)
diff --git a/tools/cpp/emscripten/emscripten_cache/asmjs/binaryen_tag_version_82.txt b/tools/cpp/emscripten/emscripten_cache/asmjs/binaryen_tag_version_82.txt
deleted file mode 100644
index 01e1f09..0000000
--- a/tools/cpp/emscripten/emscripten_cache/asmjs/binaryen_tag_version_82.txt
+++ /dev/null
@@ -1 +0,0 @@
-version_82
\ No newline at end of file
diff --git a/tools/cpp/emscripten/emscripten_cache/asmjs/generated_struct_info.json b/tools/cpp/emscripten/emscripten_cache/asmjs/generated_struct_info.json
deleted file mode 100644
index 1e636fd..0000000
--- a/tools/cpp/emscripten/emscripten_cache/asmjs/generated_struct_info.json
+++ /dev/null
@@ -1 +0,0 @@
-{"structs":{"utsname":{"sysname":0,"nodename":65,"domainname":325,"machine":260,"version":195,"release":130,"__size__":390},"sockaddr":{"sa_data":2,"sa_family":0,"__size__":16},"VRDisplayCapabilities":{"maxLayers":12,"hasPosition":0,"hasExternalDisplay":4,"canPresent":8,"__size__":16},"timespec":{"tv_sec":0,"tv_nsec":4,"__size__":8},"utimbuf":{"modtime":4,"actime":0,"__size__":8},"EmscriptenVisibilityChangeEvent":{"hidden":0,"visibilityState":4,"__size__":8},"SDL_MouseButtonEvent":{"timestamp":4,"button":16,"state":17,"windowID":8,"which":12,"y":24,"x":20,"padding2":19,"type":0,"padding1":18,"__size__":28},"sockaddr_in":{"sin_port":2,"sin_addr":{"s_addr":4,"__size__":4},"sin_family":0,"sin_zero":8,"__size__":16},"pthread":{"tsd":116,"attr":120,"canceldisable":72,"locale":188,"threadStatus":0,"tsd_used":60,"pid":56,"robust_list":168,"stack":92,"cancelasync":76,"tid":52,"threadExitCode":4,"detached":80,"profilerBlock":20,"self":24,"stack_size":96,"__size__":244},"stat":{"st_rdev":28,"st_mtim":{"tv_sec":64,"tv_nsec":68,"__size__":8},"st_blocks":52,"st_atim":{"tv_sec":56,"tv_nsec":60,"__size__":8},"st_nlink":16,"__st_ino_truncated":8,"st_ctim":{"tv_sec":72,"tv_nsec":76,"__size__":8},"st_mode":12,"st_blksize":48,"__st_dev_padding":4,"st_dev":0,"st_size":40,"st_gid":24,"__st_rdev_padding":32,"st_uid":20,"st_ino":80,"__size__":88},"SDL_KeyboardEvent":{"repeat":9,"keysym":12,"state":8,"windowID":4,"__size__":28,"type":0,"padding3":11,"padding2":10},"SDL_MouseMotionEvent":{"yrel":32,"timestamp":4,"state":16,"windowID":8,"which":12,"xrel":28,"y":24,"x":20,"type":0,"__size__":36},"SDL_Rect":{"y":4,"x":0,"h":12,"w":8,"__size__":16},"itimerspec":{"it_interval":{"tv_sec":0,"tv_nsec":4,"__size__":8},"it_value":{"tv_sec":8,"tv_nsec":12,"__size__":8},"__size__":16},"iovec":{"iov_len":4,"iov_base":0,"__size__":8},"timezone":{"tz_dsttime":4,"tz_minuteswest":0,"__size__":8},"flock":{"l_whence":2,"l_type":0,"l_start":8,"__size__":32,"l_len":16,"l_pid":24},"EmscriptenOrientationChangeEvent":{"orientationIndex":0,"orientationAngle":4,"__size__":8},"statfs":{"f_bsize":4,"f_bavail":16,"f_fsid":28,"f_files":20,"f_frsize":40,"f_namelen":36,"f_blocks":8,"f_ffree":24,"f_bfree":12,"f_flags":44,"__size__":64},"addrinfo":{"ai_flags":0,"ai_next":28,"ai_canonname":24,"ai_socktype":8,"ai_addr":20,"ai_protocol":12,"ai_family":4,"ai_addrlen":16,"__size__":32},"emscripten_fetch_t":{"status":42,"userData":4,"readyState":40,"__proxyState":108,"url":8,"totalBytes":32,"__attributes":112,"numBytes":16,"dataOffset":24,"statusText":44,"data":12,"id":0,"__size__":200},"SDL_ResizeEvent":{"h":8,"type":0,"w":4,"__size__":12},"tms":{"tms_stime":4,"tms_utime":0,"tms_cstime":12,"tms_cutime":8,"__size__":16},"SDL_Color":{"unused":3,"r":0,"b":2,"g":1,"__size__":4},"EmscriptenKeyboardEvent":{"code":32,"charValue":120,"locale":88,"shiftKey":72,"altKey":76,"which":160,"metaKey":80,"location":64,"key":0,"ctrlKey":68,"charCode":152,"keyCode":156,"repeat":84,"__size__":164},"emscripten_fetch_attr_t":{"userName":64,"userData":32,"withCredentials":56,"onerror":40,"requestHeaders":72,"onprogress":44,"onsuccess":36,"overriddenMimeType":76,"requestDataSize":84,"requestData":80,"requestMethod":0,"destinationPath":60,"timeoutMSecs":52,"attributes":48,"password":68,"__size__":88},"rusage":{"ru_msgrcv":56,"ru_utime":{"tv_sec":0,"tv_usec":4,"__size__":8},"ru_isrss":28,"ru_stime":{"tv_sec":8,"tv_usec":12,"__size__":8},"ru_nsignals":60,"ru_nivcsw":68,"ru_msgsnd":52,"ru_nswap":40,"ru_minflt":32,"ru_nvcsw":64,"ru_ixrss":20,"ru_inblock":44,"ru_idrss":24,"ru_maxrss":16,"ru_oublock":48,"ru_majflt":36,"__size__":136},"div_t":{"quot":0,"rem":4,"__size__":8},"timeval":{"tv_sec":0,"tv_usec":4,"__size__":8},"rlimit":{"rlim_cur":0,"rlim_max":8,"__size__":16},"in6_addr":{"__in6_union":{"__s6_addr16":0,"__s6_addr":0,"__s6_addr32":0,"__size__":16},"__size__":16},"tm":{"tm_sec":0,"tm_hour":8,"tm_mday":12,"tm_isdst":32,"tm_year":20,"tm_zone":40,"tm_mon":16,"tm_yday":28,"tm_gmtoff":36,"tm_wday":24,"tm_min":4,"__size__":44},"EmscriptenWebGLContextAttributes":{"majorVersion":32,"stencil":8,"renderViaOffscreenBackBuffer":52,"preserveDrawingBuffer":20,"failIfMajorPerformanceCaveat":28,"explicitSwapControl":44,"antialias":12,"depth":4,"minorVersion":36,"proxyContextToMainThread":48,"premultipliedAlpha":16,"enableExtensionsByDefault":40,"alpha":0,"powerPreference":24,"__size__":56},"EmscriptenBatteryEvent":{"dischargingTime":8,"level":16,"charging":24,"chargingTime":0,"__size__":32},"protoent":{"p_aliases":4,"p_proto":8,"p_name":0,"__size__":12},"SDL_Surface":{"userdata":24,"locked":28,"clip_rect":36,"format":4,"h":12,"refcount":56,"map":52,"flags":0,"w":8,"pitch":16,"lock_data":32,"pixels":20,"__size__":60},"EmscriptenTouchEvent":{"touches":20,"shiftKey":8,"altKey":12,"metaKey":16,"ctrlKey":4,"__size__":1684,"numTouches":0},"EmscriptenFocusEvent":{"id":128,"nodeName":0,"__size__":256},"sockaddr_in6":{"sin6_family":0,"sin6_flowinfo":4,"sin6_scope_id":24,"sin6_addr":{"__in6_union":{"__s6_addr16":8,"__s6_addr":8,"__s6_addr32":8,"__size__":16},"__size__":16},"__size__":28,"sin6_port":2},"SDL_JoyAxisEvent":{"__size__":12,"type":0,"value":8,"which":4,"padding2":7,"padding1":6,"axis":5},"netent":{"n_name":0,"n_net":12,"n_addrtype":8,"n_aliases":4,"__size__":16},"SDL_PixelFormat":{"palette":4,"Gloss":29,"Bmask":20,"Bloss":30,"Rloss":28,"format":0,"Gshift":33,"Aloss":31,"BitsPerPixel":8,"refcount":36,"next":40,"padding":10,"Rmask":12,"Bshift":34,"Gmask":16,"BytesPerPixel":9,"Amask":24,"Rshift":32,"Ashift":35,"__size__":44},"SDL_JoyButtonEvent":{"type":0,"button":5,"state":6,"which":4,"padding1":7,"__size__":8},"VRQuaternion":{"y":4,"x":0,"z":8,"w":12,"__size__":16},"in_addr":{"s_addr":0,"__size__":4},"EmscriptenDeviceOrientationEvent":{"timestamp":0,"beta":16,"alpha":8,"__size__":40,"gamma":24,"absolute":32},"libc":{"global_locale":40,"__size__":64},"SDL_WindowEvent":{"data2":16,"type":0,"data1":12,"windowID":4,"__size__":20,"padding1":9,"event":8,"padding3":11,"padding2":10},"SDL_Keysym":{"scancode":0,"mod":8,"unicode":12,"sym":4,"__size__":16},"cmsghdr":{"cmsg_type":8,"cmsg_level":4,"cmsg_len":0,"__size__":12},"VREyeParameters":{"offset":{"y":4,"x":0,"z":8,"__size__":12},"renderWidth":12,"renderHeight":16,"__size__":20},"EmscriptenUiEvent":{"windowInnerWidth":12,"detail":0,"scrollLeft":32,"documentBodyClientHeight":8,"windowInnerHeight":16,"scrollTop":28,"windowOuterHeight":24,"windowOuterWidth":20,"documentBodyClientWidth":4,"__size__":36},"thread_profiler_block":{"threadStatus":0,"timeSpentInStatus":16,"currentStatusStartTime":8,"name":72,"__size__":104},"pollfd":{"fd":0,"events":4,"revents":6,"__size__":8},"VRFrameData":{"pose":{"linearVelocity":{"y":280,"x":276,"z":284,"__size__":12},"orientation":{"y":304,"x":300,"z":308,"w":312,"__size__":16},"angularAcceleration":{"y":332,"x":328,"z":336,"__size__":12},"poseFlags":340,"angularVelocity":{"y":320,"x":316,"z":324,"__size__":12},"linearAcceleration":{"y":292,"x":288,"z":296,"__size__":12},"position":{"y":268,"x":264,"z":272,"__size__":12},"__size__":80},"rightViewMatrix":200,"timestamp":0,"leftProjectionMatrix":8,"leftViewMatrix":72,"rightProjectionMatrix":136,"__size__":344},"dirent":{"d_name":19,"d_off":8,"d_ino":0,"d_reclen":16,"d_type":18,"__size__":280},"EmscriptenTouchPoint":{"clientX":12,"clientY":16,"identifier":0,"targetX":36,"targetY":40,"isChanged":28,"canvasY":48,"canvasX":44,"pageX":20,"pageY":24,"screenY":8,"screenX":4,"onTarget":32,"__size__":52},"VRLayerInit":{"source":0,"rightBounds":20,"leftBounds":4,"__size__":36},"EmscriptenDeviceMotionEvent":{"timestamp":0,"accelerationIncludingGravityZ":48,"accelerationIncludingGravityX":32,"accelerationIncludingGravityY":40,"accelerationY":16,"accelerationX":8,"rotationRateBeta":64,"accelerationZ":24,"rotationRateGamma":72,"rotationRateAlpha":56,"__size__":80},"SDL_AudioSpec":{"padding":10,"userdata":20,"format":4,"channels":6,"callback":16,"samples":8,"freq":0,"size":12,"silence":7,"__size__":24},"hostent":{"h_addrtype":8,"h_addr_list":16,"h_name":0,"__size__":20,"h_aliases":4,"h_length":12},"SDL_MouseWheelEvent":{"timestamp":4,"windowID":8,"which":12,"y":20,"x":16,"type":0,"__size__":24},"linger":{"l_onoff":0,"l_linger":4,"__size__":8},"SDL_version":{"major":0,"patch":2,"minor":1,"__size__":3},"statvfs":{"f_bsize":0,"f_bavail":16,"f_fsid":32,"f_favail":28,"f_files":20,"f_frsize":4,"f_blocks":8,"f_ffree":24,"f_bfree":12,"f_flag":40,"f_namemax":44,"__size__":72},"EmscriptenFullscreenChangeEvent":{"elementWidth":264,"screenWidth":272,"nodeName":8,"elementHeight":268,"fullscreenEnabled":4,"screenHeight":276,"isFullscreen":0,"id":136,"__size__":280},"EmscriptenWheelEvent":{"deltaX":72,"deltaY":80,"deltaZ":88,"deltaMode":96,"mouse":0,"__size__":104},"VRPose":{"linearVelocity":{"y":16,"x":12,"z":20,"__size__":12},"orientation":{"y":40,"x":36,"z":44,"w":48,"__size__":16},"angularAcceleration":{"y":68,"x":64,"z":72,"__size__":12},"poseFlags":76,"angularVelocity":{"y":56,"x":52,"z":60,"__size__":12},"linearAcceleration":{"y":28,"x":24,"z":32,"__size__":12},"position":{"y":4,"x":0,"z":8,"__size__":12},"__size__":80},"SDL_TouchFingerEvent":{"timestamp":4,"dy":36,"touchId":8,"pressure":40,"dx":32,"type":0,"y":28,"x":24,"fingerId":16,"__size__":48},"SDL_AudioCVT":{"len_ratio":32,"len_cvt":24,"rate_incr":8,"filters":40,"len":20,"needed":0,"filter_index":80,"src_format":4,"len_mult":28,"__size__":88,"buf":16,"dst_format":6},"VRVector3":{"y":4,"x":0,"z":8,"__size__":12},"EmscriptenPointerlockChangeEvent":{"id":132,"nodeName":4,"isActive":0,"__size__":260},"EmscriptenMouseEvent":{"clientX":16,"clientY":20,"targetX":52,"buttons":42,"timestamp":0,"button":40,"targetY":56,"altKey":32,"canvasY":64,"metaKey":36,"movementX":44,"movementY":48,"shiftKey":28,"ctrlKey":24,"screenY":12,"screenX":8,"canvasX":60,"__size__":72},"msghdr":{"msg_iov":8,"msg_iovlen":12,"msg_namelen":4,"msg_controllen":20,"msg_flags":24,"msg_name":0,"msg_control":16,"__size__":28},"EmscriptenGamepadEvent":{"index":1300,"analogButton":528,"timestamp":0,"numButtons":12,"mapping":1368,"digitalButton":1040,"connected":1296,"numAxes":8,"__size__":1432,"id":1304,"axis":16},"SDL_Palette":{"ncolors":0,"colors":4,"version":8,"refcount":12,"__size__":16},"EmscriptenFullscreenStrategy":{"canvasResizedCallbackUserData":16,"canvasResolutionScaleMode":4,"scaleMode":0,"canvasResizedCallbackTargetThread":20,"canvasResizedCallback":12,"filteringMode":8,"__size__":24},"timeb":{"dstflag":8,"timezone":6,"time":0,"millitm":4,"__size__":12},"SDL_TextInputEvent":{"text":8,"windowID":4,"type":0,"__size__":40}},"defines":{"ETXTBSY":26,"EOF":-1,"EMSCRIPTEN_EVENT_MOUSEOVER":35,"ETOOMANYREFS":109,"ENAMETOOLONG":36,"ENOPKG":65,"UUID_TYPE_DCE_TIME":1,"_SC_XOPEN_LEGACY":129,"_SC_XOPEN_VERSION":89,"F_UNLCK":2,"_SC_BC_DIM_MAX":37,"EL3HLT":46,"S_IFDIR":16384,"EMSCRIPTEN_EVENT_KEYPRESS":1,"EINPROGRESS":115,"_SC_BARRIERS":133,"EMSCRIPTEN_EVENT_TOUCHMOVE":24,"EM_CALLBACK_THREAD_CONTEXT_MAIN_BROWSER_THREAD":1,"SDL_AUDIO_ALLOW_FREQUENCY_CHANGE":1,"AUDIO_U8":8,"EAI_AGAIN":-3,"_PC_MAX_CANON":1,"ENOTSUP":95,"EFBIG":27,"O_CREAT":64,"EMSCRIPTEN_EVENT_POINTERLOCKERROR":38,"_SC_2_PBS_LOCATE":170,"VR_POSE_ANGULAR_VELOCITY":16,"_CS_POSIX_V6_LP64_OFF64_LIBS":1126,"ENOLINK":67,"ABDAY_7":131078,"ABDAY_6":131077,"ABDAY_5":131076,"ABDAY_4":131075,"ABDAY_3":131074,"ABDAY_2":131073,"ABDAY_1":131072,"EL3RST":47,"YESEXPR":327680,"_SC_V6_ILP32_OFFBIG":177,"SDL_MINOR_VERSION":3,"EMSCRIPTEN_WEBGL_CONTEXT_PROXY_FALLBACK":1,"_SC_MEMLOCK":17,"ENOTUNIQ":76,"EMSCRIPTEN_RESULT_FAILED":-6,"ABMON_1":131086,"ELNRNG":48,"UUID_VARIANT_MICROSOFT":2,"EMSCRIPTEN_EVENT_TOUCHSTART":22,"ENOANO":55,"EMSCRIPTEN_EVENT_FOCUSIN":14,"EMSCRIPTEN_EVENT_MOUSEUP":6,"ENOPROTOOPT":92,"POLLIN":1,"S_IALLUGO":4095,"_SC_THREAD_KEYS_MAX":74,"EM_THREAD_STATUS_WAITPROXY":5,"O_RDWR":2,"EREMCHG":78,"AUDIO_S32LSB":32800,"_SC_2_PBS":168,"_SC_TRACE_INHERIT":183,"_SC_REGEXP":155,"_CS_POSIX_V6_LP64_OFF64_CFLAGS":1124,"_SC_DELAYTIMER_MAX":26,"S_IWUGO":146,"S_IFREG":32768,"F_GETLK64":12,"O_DIRECTORY":65536,"POLLHUP":16,"S_IFMT":61440,"F_SETLK64":13,"VR_POSE_LINEAR_VELOCITY":2,"_SC_XOPEN_CRYPT":92,"_PC_CHOWN_RESTRICTED":6,"EMSCRIPTEN_WEBGL_CONTEXT_PROXY_DISALLOW":0,"E2BIG":7,"ABMON_3":131088,"AM_STR":131110,"SDL_AUDIO_MASK_ENDIAN":4096,"ALT_DIGITS":131119,"EHOSTDOWN":112,"EBFONT":59,"ENOTEMPTY":39,"AUDIO_S16":32784,"TIOCGPGRP":21519,"EBUSY":16,"_SC_MQ_PRIO_MAX":28,"_SC_PAGE_SIZE":30,"EADDRINUSE":98,"ENOTSOCK":88,"PM_STR":131111,"O_WRONLY":1,"_SC_STREAM_MAX":5,"ABMON_9":131094,"ELIBACC":79,"EMSCRIPTEN_FETCH_WAITABLE":128,"S_IFIFO":4096,"EDQUOT":122,"EAI_SYSTEM":-11,"ENOENT":2,"EALREADY":114,"_SC_TIMERS":11,"O_SYNC":1052672,"SEEK_END":2,"EM_THREAD_STATUS_FINISHED":6,"_PC_REC_MIN_XFER_SIZE":16,"_PC_PATH_MAX":4,"_SC_SPORADIC_SERVER":160,"ECOMM":70,"_SC_NPROCESSORS_ONLN":84,"_CS_POSIX_V6_LPBIG_OFFBIG_LIBS":1130,"_PC_MAX_INPUT":2,"_SC_VERSION":29,"_SC_XBS5_LPBIG_OFFBIG":128,"_SC_CLK_TCK":2,"ABMON_2":131087,"EXFULL":54,"ABMON_7":131092,"ABMON_6":131091,"ABMON_5":131090,"ABMON_4":131089,"ENOTDIR":20,"ABMON_8":131093,"VR_EYE_RIGHT":1,"_SC_AIO_MAX":24,"ERA":131116,"POLLWRNORM":256,"_SC_THREAD_PRIO_INHERIT":80,"_PC_2_SYMLINKS":20,"_SC_XBS5_LP64_OFF64":127,"EMSCRIPTEN_EVENT_BATTERYLEVELCHANGE":30,"ENETRESET":102,"EAFNOSUPPORT":97,"VR_POSE_LINEAR_ACCELERATION":4,"MON_3":131100,"EMSCRIPTEN_EVENT_TARGET_WINDOW":2,"MON_1":131098,"EMSCRIPTEN_EVENT_DEVICEORIENTATION":16,"MON_7":131104,"MON_4":131101,"MON_5":131102,"_SC_SPAWN":159,"MON_8":131105,"MON_9":131106,"_CS_POSIX_V6_ILP32_OFF32_LDFLAGS":1117,"S_IFSOCK":49152,"S_IRUGO":292,"SOCK_DGRAM":2,"POLLERR":8,"EM_CALLBACK_THREAD_CONTEXT_CALLING_THREAD":2,"EINVAL":22,"_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS":1128,"POLLRDNORM":64,"AUDIO_F32SYS":33056,"_SC_TRACE_SYS_MAX":244,"AI_V4MAPPED":8,"AI_NUMERICHOST":4,"_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS":1,"EHOSTUNREACH":113,"ENOCSI":50,"AF_INET6":10,"EPROTONOSUPPORT":93,"_SC_AIO_PRIO_DELTA_MAX":25,"_SC_MONOTONIC_CLOCK":149,"ETIME":62,"ENOTTY":25,"_SC_XOPEN_ENH_I18N":93,"EAI_SERVICE":-8,"EAGAIN":11,"F_SETLKW64":14,"EMSGSIZE":90,"ELIBEXEC":83,"_SC_MEMORY_PROTECTION":19,"_SC_V6_ILP32_OFF32":176,"EMSCRIPTEN_FULLSCREEN_SCALE_CENTER":3,"SDL_AUDIO_ALLOW_FORMAT_CHANGE":2,"ECANCELED":125,"EMSCRIPTEN_EVENT_TARGET_SCREEN":3,"_SC_SPIN_LOCKS":154,"_SC_XOPEN_SHM":94,"_PC_LINK_MAX":0,"TIOCSPGRP":21520,"EOPNOTSUPP":95,"EMSCRIPTEN_EVENT_MOUSEENTER":33,"EAI_FAIL":-4,"NOEXPR":327681,"_SC_FSYNC":15,"_SC_GETGR_R_SIZE_MAX":69,"EDESTADDRREQ":89,"EADDRNOTAVAIL":99,"AUDIO_S32SYS":32800,"MON_2":131099,"_SC_TRACE_NAME_MAX":243,"_SC_BC_BASE_MAX":36,"EMSCRIPTEN_EVENT_CANVASRESIZED":37,"EPERM":1,"EAI_FAMILY":-6,"O_NOFOLLOW":131072,"SOCK_STREAM":1,"O_APPEND":1024,"_SC_XOPEN_STREAMS":246,"_SC_GETPW_R_SIZE_MAX":70,"MON_6":131103,"EPROTOTYPE":91,"_SC_CPUTIME":138,"ENOMEDIUM":123,"_SC_XBS5_ILP32_OFFBIG":126,"S_IFBLK":24576,"T_FMT_AMPM":131115,"SDL_PIXELFORMAT_RGBA8888":-2042224636,"F_SETLKW":14,"SDL_TOUCH_MOUSEID":-1,"EMSCRIPTEN_EVENT_SCROLL":11,"ELOOP":40,"_SC_OPEN_MAX":4,"EMSCRIPTEN_RESULT_DEFERRED":1,"_SC_2_FORT_RUN":50,"EMSCRIPTEN_EVENT_VISIBILITYCHANGE":21,"EREMOTE":66,"_SC_RE_DUP_MAX":44,"_SC_THREAD_PRIO_PROTECT":81,"_SC_2_PBS_CHECKPOINT":175,"_SC_2_PBS_TRACK":172,"MON_10":131107,"MON_11":131108,"MON_12":131109,"VR_POSE_POSITION":1,"_SC_THREAD_PROCESS_SHARED":82,"TCSETA":21510,"AF_INET":2,"_SC_SHARED_MEMORY_OBJECTS":22,"F_GETFD":1,"EMSCRIPTEN_EVENT_DEVICEMOTION":17,"SDL_MIX_MAXVOLUME":128,"TCGETA":21509,"_PC_ALLOC_SIZE_MIN":18,"TCSETS":21506,"ELIBMAX":82,"_SC_READER_WRITER_LOCKS":153,"EMULTIHOP":72,"_SC_PHYS_PAGES":85,"_SC_MEMLOCK_RANGE":18,"_SC_PRIORITY_SCHEDULING":10,"T_FMT":131114,"AI_ALL":16,"_PC_VDISABLE":8,"THOUSEP":65537,"_SC_TRACE_EVENT_FILTER":182,"ERA_T_FMT":131121,"_SC_THREAD_ATTR_STACKADDR":77,"_SC_THREAD_THREADS_MAX":76,"_SC_LOGIN_NAME_MAX":71,"EMSCRIPTEN_FETCH_LOAD_TO_MEMORY":1,"_SC_2_C_BIND":47,"_PC_NO_TRUNC":7,"ECONNABORTED":103,"EMSCRIPTEN_RESULT_SUCCESS":0,"_SC_SHELL":157,"EFAULT":14,"O_LARGEFILE":32768,"_SC_V6_LP64_OFF64":178,"_CS_GNU_LIBC_VERSION":2,"_SC_SEM_VALUE_MAX":33,"_SC_MQ_OPEN_MAX":27,"AI_ADDRCONFIG":32,"_SC_HOST_NAME_MAX":180,"_SC_THREAD_STACK_MIN":75,"_SC_TIMEOUTS":164,"POLLOUT":4,"_SC_IPV6":235,"_SC_CHILD_MAX":1,"EDOM":33,"_SC_2_PBS_MESSAGE":171,"EILSEQ":84,"UUID_VARIANT_DCE":1,"_SC_2_C_DEV":48,"_SC_TIMER_MAX":35,"FP_ZERO":2,"EPFNOSUPPORT":96,"TIOCSWINSZ":21524,"ENONET":64,"ECHRNG":44,"_SC_THREADS":67,"_SC_REALTIME_SIGNALS":9,"CLOCKS_PER_SEC":1000000,"ERA_D_T_FMT":131120,"ESRCH":3,"D_FMT":131113,"EM_FUNC_SIG_IIII":637534208,"POLLPRI":2,"_PC_ASYNC_IO":10,"DAY_2":131080,"DAY_3":131081,"DAY_1":131079,"DAY_6":131084,"DAY_7":131085,"DAY_4":131082,"DAY_5":131083,"_SC_SYNCHRONIZED_IO":14,"AT_REMOVEDIR":512,"EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF":1,"IPPROTO_UDP":17,"_SC_MAPPED_FILES":16,"EL2NSYNC":45,"_SC_NGROUPS_MAX":3,"ENOMSG":42,"EISDIR":21,"_SC_SEMAPHORES":21,"AI_NUMERICSERV":1024,"EMSCRIPTEN_RESULT_TIMED_OUT":-8,"EDEADLOCK":35,"EMSCRIPTEN_EVENT_WEBGLCONTEXTLOST":31,"ERA_D_FMT":131118,"EMSCRIPTEN_EVENT_BATTERYCHARGINGCHANGE":29,"EMSCRIPTEN_FETCH_SYNCHRONOUS":64,"EM_FUNC_SIG_II":570425344,"AUDIO_F32LSB":33056,"_SC_COLL_WEIGHTS_MAX":40,"SO_ERROR":4,"ECONNRESET":104,"AT_SYMLINK_NOFOLLOW":256,"_SC_TRACE_LOG":184,"AUDIO_U16LSB":16,"ESTRPIPE":86,"EMSCRIPTEN_FETCH_REPLACE":16,"ESHUTDOWN":108,"_PC_SOCK_MAXBUF":12,"_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS":1129,"EDEADLK":35,"_CS_POSIX_V6_ILP32_OFF32_CFLAGS":1116,"EBADRQC":56,"EM_FUNC_SIG_III":603979776,"_SC_THREAD_DESTRUCTOR_ITERATIONS":73,"_SC_TYPED_MEMORY_OBJECTS":165,"_SC_TRACE_EVENT_NAME_MAX":242,"_SC_BC_STRING_MAX":39,"_SC_2_SW_DEV":51,"FP_NAN":0,"F_SETOWN":8,"EMSCRIPTEN_EVENT_RESIZE":10,"_SC_ARG_MAX":0,"_SC_THREAD_PRIORITY_SCHEDULING":79,"F_GETLK":12,"EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF":2,"FIONREAD":21531,"_SC_THREAD_CPUTIME":139,"EMSCRIPTEN_EVENT_POINTERLOCKCHANGE":20,"EM_THREAD_STATUS_NOTSTARTED":0,"_CS_POSIX_V6_ILP32_OFF32_LIBS":1118,"EUNATCH":49,"AUDIO_S8":32776,"EMSCRIPTEN_EVENT_GAMEPADDISCONNECTED":27,"SDL_AUDIO_MASK_BITSIZE":255,"EMSCRIPTEN_WEBGL_CONTEXT_PROXY_ALWAYS":2,"AUDIO_F32MSB":37152,"_CS_POSIX_V6_LP64_OFF64_LDFLAGS":1125,"FP_INFINITE":1,"ECHILD":10,"EAI_MEMORY":-10,"O_TRUNC":512,"ETIMEDOUT":110,"S_IRWXO":7,"_SC_SYMLOOP_MAX":173,"EM_FUNC_SIG_I":536870912,"ENXIO":6,"NI_NUMERICHOST":1,"EMFILE":24,"F_GETOWN":9,"TIME_UTC":1,"EMLINK":31,"F_SETFD":2,"ENFILE":23,"EBADMSG":74,"EM_FUNC_SIG_V":0,"SDL_MAJOR_VERSION":1,"ENOMEM":12,"ENOSR":63,"SDL_AUDIO_ALLOW_ANY_CHANGE":7,"VR_POSE_ANGULAR_ACCELERATION":32,"_SC_CLOCK_SELECTION":137,"_PC_PRIO_IO":11,"ELIBSCN":81,"_SC_V6_LPBIG_OFFBIG":179,"EMSCRIPTEN_EVENT_CLICK":4,"EPIPE":32,"_SC_EXPR_NEST_MAX":42,"_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS":1120,"EBADSLT":57,"AUDIO_S16MSB":36880,"S_ISVTX":512,"EM_PROXIED_CREATE_CONTEXT":622854144,"EMSCRIPTEN_RESULT_UNKNOWN_TARGET":-4,"S_IRWXUGO":511,"_CS_GNU_LIBPTHREAD_VERSION":3,"_PC_REC_MAX_XFER_SIZE":15,"UUID_VARIANT_OTHER":3,"EMSCRIPTEN_EVENT_WEBGLCONTEXTRESTORED":32,"EM_PROXIED_PTHREAD_CREATE":687865856,"EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT":0,"RADIXCHAR":65536,"AF_UNSPEC":0,"ENOSTR":60,"W_OK":2,"AUDIO_S32":32800,"EACCES":13,"R_OK":4,"EM_HTML5_MEDIUM_STRING_LEN_BYTES":64,"EMSCRIPTEN_EVENT_MOUSEOUT":36,"EMSCRIPTEN_EVENT_FULLSCREENCHANGE":19,"EIO":5,"EMSCRIPTEN_RESULT_NOT_SUPPORTED":-1,"_SC_SIGQUEUE_MAX":34,"EWOULDBLOCK":11,"AUDIO_U16SYS":16,"EMSCRIPTEN_EVENT_FOCUSOUT":15,"EAI_OVERFLOW":-12,"SDL_AUDIO_MASK_DATATYPE":256,"MAP_PRIVATE":2,"_SC_TZNAME_MAX":6,"_CS_PATH":0,"SEEK_SET":0,"EAI_SOCKTYPE":-7,"EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED":-2,"INT_MAX":2147483647,"EMSCRIPTEN_EVENT_KEYDOWN":2,"EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH":1,"_SC_MESSAGE_PASSING":20,"_SC_THREAD_SAFE_FUNCTIONS":68,"ENODATA":61,"_PC_NAME_MAX":3,"O_EXCL":128,"_SC_TRACE_USER_EVENT_MAX":245,"_PC_REC_XFER_ALIGN":17,"EM_FUNC_SIG_VII":67108864,"VR_EYE_LEFT":0,"_SC_RAW_SOCKETS":236,"_SC_2_UPE":97,"EMSCRIPTEN_RESULT_NO_DATA":-7,"EMSCRIPTEN_EVENT_BLUR":12,"_SC_TTY_NAME_MAX":72,"_SC_RTSIG_MAX":31,"ESOCKTNOSUPPORT":94,"_SC_PRIORITIZED_IO":13,"_SC_XOPEN_UNIX":91,"CODESET":14,"IPPROTO_TCP":6,"_PC_REC_INCR_XFER_SIZE":14,"F_SETLK":13,"_PC_FILESIZEBITS":13,"_SC_XBS5_ILP32_OFF32":125,"RAND_MAX":2147483647,"EM_PROXIED_SYSCALL":621805568,"ENOLCK":37,"EMSCRIPTEN_EVENT_TARGET_INVALID":0,"AUDIO_U16":16,"EMSCRIPTEN_EVENT_MOUSELEAVE":34,"VR_POSE_ORIENTATION":8,"_PC_SYNC_IO":9,"EEXIST":17,"FP_NORMAL":4,"O_RDONLY":0,"_SC_SEM_NSEMS_MAX":32,"_SC_IOV_MAX":60,"EPROTO":71,"_SC_TRACE":181,"ESRMNT":69,"EM_HTML5_LONG_STRING_LEN_BYTES":128,"_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS":1121,"EM_PROXIED_RESIZE_OFFSCREENCANVAS":657457152,"INADDR_LOOPBACK":2130706433,"EM_FUNC_SIG_VIII":100663296,"EXDEV":18,"TIOCGWINSZ":21523,"EM_THREAD_STATUS_RUNNING":1,"EMSCRIPTEN_EVENT_BEFOREUNLOAD":28,"EM_THREAD_STATUS_WAITFUTEX":3,"EMSCRIPTEN_RESULT_INVALID_TARGET":-3,"_SC_THREAD_SPORADIC_SERVER":161,"F_SETFL":4,"AI_PASSIVE":1,"EMSCRIPTEN_FETCH_STREAM_DATA":2,"ELIBBAD":80,"_SC_LINE_MAX":43,"D_T_FMT":131112,"TCSETSF":21508,"ERANGE":34,"ESTALE":116,"TCSETSW":21507,"F_DUPFD":0,"AUDIO_F32":33056,"CLOCK_MONOTONIC":1,"EMSCRIPTEN_EVENT_GAMEPADCONNECTED":26,"F_GETOWN_EX":16,"_SC_ASYNCHRONOUS_IO":12,"ENOTRECOVERABLE":131,"ENOBUFS":105,"EIDRM":43,"EMSCRIPTEN_EVENT_ORIENTATIONCHANGE":18,"CRNCYSTR":262159,"EINTR":4,"EADV":68,"ENOSYS":38,"_CS_POSIX_V6_ILP32_OFFBIG_LIBS":1122,"F_GETFL":3,"S_IXUGO":73,"_SC_2_FORT_DEV":49,"SDL_COMPILEDVERSION":1300,"EUSERS":87,"CLOCK_REALTIME":0,"ENODEV":19,"O_DSYNC":4096,"_SC_ATEXIT_MAX":87,"_SC_SAVED_IDS":8,"SOL_SOCKET":1,"S_IFLNK":40960,"AUDIO_S16LSB":32784,"POLLNVAL":32,"EMSCRIPTEN_EVENT_TOUCHCANCEL":25,"EMSCRIPTEN_RESULT_INVALID_PARAM":-5,"EMSCRIPTEN_EVENT_MOUSEDOWN":5,"EM_THREAD_STATUS_SLEEPING":2,"_SC_JOB_CONTROL":7,"NI_NAMEREQD":8,"EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT":2,"EMSCRIPTEN_EVENT_MOUSEMOVE":8,"UUID_TYPE_DCE_RANDOM":4,"ENOTCONN":107,"_SC_ADVISORY_INFO":132,"ENETUNREACH":101,"_SC_XOPEN_REALTIME_THREADS":131,"TCGETS":21505,"_SC_2_LOCALEDEF":52,"_PC_SYMLINK_MAX":19,"EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT":0,"X_OK":1,"EMSCRIPTEN_EVENT_KEYUP":3,"AI_CANONNAME":2,"UUID_VARIANT_NCS":0,"ESPIPE":29,"AUDIO_S32MSB":36896,"EMSCRIPTEN_EVENT_WHEEL":9,"SDL_AUDIO_ALLOW_CHANNELS_CHANGE":4,"_SC_XOPEN_REALTIME":130,"EL2HLT":51,"TCSETAW":21511,"EMSCRIPTEN_FETCH_NO_DOWNLOAD":32,"EAI_NONAME":-2,"_PC_PIPE_BUF":5,"EOWNERDEAD":130,"EROFS":30,"TCSETAF":21512,"ECONNREFUSED":111,"_SC_2_PBS_ACCOUNTING":169,"EMSCRIPTEN_EVENT_FOCUS":13,"AUDIO_S16SYS":32784,"ENETDOWN":100,"ENOEXEC":8,"EMSCRIPTEN_EVENT_TARGET_DOCUMENT":1,"ENOSPC":28,"EBADF":9,"EBADE":52,"EMSCRIPTEN_EVENT_DBLCLICK":7,"EDOTDOT":73,"_SC_THREAD_ATTR_STACKSIZE":78,"EBADFD":77,"O_ACCMODE":2097155,"EBADR":53,"_SC_2_VERSION":46,"S_IFCHR":8192,"SDL_PATCHLEVEL":0,"ABMON_12":131097,"PTHREAD_KEYS_MAX":128,"EISCONN":106,"EMSCRIPTEN_FETCH_APPEND":8,"EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE":0,"AUDIO_U16MSB":4112,"EMSCRIPTEN_FULLSCREEN_FILTERING_BILINEAR":2,"_SC_2_CHAR_TERM":95,"EMSCRIPTEN_EVENT_TOUCHEND":23,"_SC_AIO_LISTIO_MAX":23,"EMSCRIPTEN_FETCH_PERSIST_FILE":4,"_SC_BC_SCALE_MAX":38,"ENOTBLK":15,"EAI_BADFLAGS":-1,"EOVERFLOW":75,"EM_FUNC_SIG_VI":33554432,"SDL_AUDIO_MASK_SIGNED":32768,"EMSCRIPTEN_FULLSCREEN_FILTERING_NEAREST":1,"ABMON_11":131096,"ABMON_10":131095,"AT_FDCWD":-100,"EM_HTML5_SHORT_STRING_LEN_BYTES":32}}
\ No newline at end of file
diff --git a/tools/cpp/emscripten/emscripten_cache/asmjs/libc-wasm.bc b/tools/cpp/emscripten/emscripten_cache/asmjs/libc-wasm.bc
deleted file mode 100644
index 50f7172..0000000
--- a/tools/cpp/emscripten/emscripten_cache/asmjs/libc-wasm.bc
+++ /dev/null
Binary files differ
diff --git a/tools/cpp/emscripten/emscripten_cache/asmjs/libc.bc b/tools/cpp/emscripten/emscripten_cache/asmjs/libc.bc
deleted file mode 100644
index 7f4adf9..0000000
--- a/tools/cpp/emscripten/emscripten_cache/asmjs/libc.bc
+++ /dev/null
Binary files differ
diff --git a/tools/cpp/emscripten/emscripten_cache/asmjs/libcompiler_rt.a b/tools/cpp/emscripten/emscripten_cache/asmjs/libcompiler_rt.a
deleted file mode 100644
index 9468549..0000000
--- a/tools/cpp/emscripten/emscripten_cache/asmjs/libcompiler_rt.a
+++ /dev/null
Binary files differ
diff --git a/tools/cpp/emscripten/emscripten_cache/asmjs/libdlmalloc.bc b/tools/cpp/emscripten/emscripten_cache/asmjs/libdlmalloc.bc
deleted file mode 100644
index def54c3..0000000
--- a/tools/cpp/emscripten/emscripten_cache/asmjs/libdlmalloc.bc
+++ /dev/null
Binary files differ
diff --git a/tools/cpp/emscripten/emscripten_cache/asmjs/libpthreads_stub.bc b/tools/cpp/emscripten/emscripten_cache/asmjs/libpthreads_stub.bc
deleted file mode 100644
index b5205d0..0000000
--- a/tools/cpp/emscripten/emscripten_cache/asmjs/libpthreads_stub.bc
+++ /dev/null
Binary files differ
diff --git a/tools/cpp/emscripten/foo.o b/tools/cpp/emscripten/foo.o
new file mode 100755
index 0000000..28c06de
--- /dev/null
+++ b/tools/cpp/emscripten/foo.o
Binary files differ
diff --git a/tools/cpp/emscripten/gencache.sh b/tools/cpp/emscripten/gencache.sh
new file mode 100755
index 0000000..d8391d8
--- /dev/null
+++ b/tools/cpp/emscripten/gencache.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+# This script forces generation of all the necessary cache files from emscripten.
+export EMCC_FORCE_STDLIBS=1
+# Run with WEBGL2 enabled and not, as the compiler will only generate one of the
+# webgl libraries at once.
+tools/cpp/emscripten/emcc.sh -o foo.html.tar tools/cpp/emscripten/foo.o -s 'USE_WEBGL2=1' -no-canonical-prefixes
+tools/cpp/emscripten/emcc.sh -o foo.html.tar tools/cpp/emscripten/foo.o -s 'USE_WEBGL2=0' -no-canonical-prefixes
+for OUTPUT in $@
+do
+ if [ ! -f ${OUTPUT} ]; then
+ cp -f tmp/emscripten_cache/asmjs/$(basename ${OUTPUT}) ${OUTPUT}
+ fi
+done