88
88
sys .path .insert (1 , os .path .dirname (os .path .dirname (os .path .abspath (__file__ ))))
89
89
90
90
from tools import shared
91
+ from tools import system_libs
91
92
92
93
QUIET = (__name__ != '__main__' )
93
94
DEBUG = False
@@ -231,15 +232,13 @@ def inspect_headers(headers, cpp_opts):
231
232
232
233
js_file = tempfile .mkstemp ('.js' )
233
234
235
+ shared .check_sanity ()
236
+ system_libs .Library .get_usable_variations ()['libcompiler_rt' ].get_path ()
237
+
234
238
# Close all unneeded FDs.
235
239
os .close (src_file [0 ])
236
240
os .close (js_file [0 ])
237
241
238
- # Remove dangerous env modifications
239
- env = os .environ .copy ()
240
- env ['EMCC_FORCE_STDLIBS' ] = 'libcompiler_rt'
241
- env ['EMCC_ONLY_FORCED_STDLIBS' ] = '1'
242
-
243
242
info = []
244
243
# Compile the program.
245
244
show ('Compiling generated code...' )
@@ -248,6 +247,8 @@ def inspect_headers(headers, cpp_opts):
248
247
'-O0' ,
249
248
'-Werror' ,
250
249
'-Wno-format' ,
250
+ '-nostdlib' ,
251
+ '-lcompiler_rt' ,
251
252
'-I' , shared .path_from_root (),
252
253
'-s' , 'BOOTSTRAPPING_STRUCT_INFO=1' ,
253
254
'-s' , 'WARN_ON_UNDEFINED_SYMBOLS=0' ,
@@ -268,7 +269,7 @@ def inspect_headers(headers, cpp_opts):
268
269
269
270
show (shared .shlex_join (cmd ))
270
271
try :
271
- subprocess .check_call (cmd , env = env )
272
+ subprocess .check_call (cmd )
272
273
except subprocess .CalledProcessError as e :
273
274
sys .stderr .write ('FAIL: Compilation failed!: %s\n ' % e .cmd )
274
275
sys .exit (1 )
0 commit comments