Skip to content

Commit

Permalink
Fix WASM=0 warning in gen_struct_info (#8497)
Browse files Browse the repository at this point in the history
Also, try to give more meaning errors when embuilder fails.
  • Loading branch information
sbc100 authored Apr 27, 2019
1 parent be5f2b7 commit 8385227
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions embuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import print_function
import logging
import os
import subprocess
import sys

from tools import shared
Expand Down Expand Up @@ -147,11 +148,10 @@ def build(src, result_libs, args=[]):
cpp = os.path.join(temp_dir, 'src.cpp')
open(cpp, 'w').write(src)
temp_js = os.path.join(temp_dir, 'out.js')
shared.Building.emcc(cpp, args, output_filename=temp_js)

# verify
if not os.path.exists(temp_js):
shared.exit_with_error('failed to build file')
try:
shared.Building.emcc(cpp, args, output_filename=temp_js)
except subprocess.CalledProcessError as e:
shared.exit_with_error("embuilder: emcc command failed with %d: '%s'", e.returncode, ' '.join(e.cmd))

for lib in result_libs:
if not os.path.exists(shared.Cache.get_path(lib)):
Expand Down
4 changes: 3 additions & 1 deletion tools/gen_struct_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ def inspect_code(headers, cpp_opts, structs, defines):
# Compile the program.
show('Compiling generated code...')
# -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', '-s', 'WASM=0', '-Wno-format']
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']
if not shared.Settings.WASM_BACKEND:
cmd += ['-s', 'WASM=0']
if shared.Settings.WASM_OBJECT_FILES:
cmd += ['-s', 'WASM_OBJECT_FILES=1']

Expand Down

0 comments on commit 8385227

Please sign in to comment.