Indeed, setting EMCC_NATIVE_OPTIMIZER=0 seems to fix the problem. Thanks a lot for that tip :)
Though I am surprised that this could be linked to the native compiler, as I have both VS2010 and VS2015 installed. If that is the problem, many people must have encountered it before me ? Surely I am not the first one to use release compilation with emscripten on Windows ? Le mercredi 6 avril 2016 19:52:31 UTC+2, Alon Zakai a écrit : > > Looks like it's failing to build the native optimizer. Based on the log, > it seems it can't even find a local compiler to run (but I'm not sure how > that works on windows). A more common error is if the local compiler might > not have sufficient c++11 support (but then I'd expect a clearer error, > however, maybe on windows it's different?). You can disable the native > optimizer with EMCC_NATIVE_OPTIMIZER=0 in the env, but then things will > compile more slowly. To investigate more, you might want to look inside > that js_optimizer.py file. > > On Wed, Apr 6, 2016 at 10:36 AM, Nicolas Bourdis <[email protected] > <javascript:>> wrote: > > I am trying to compile some basic test code with emcc -O2, and for a > reason that I do not understand, the compilation fails at some point: > > D:\Projects\jsport>call emcc "../src/lib.cpp" -o emscripten_test-min.js > -O2 -s EXPORTED_FUNCTIONS="['_testFct']" -s RESERVED_FUNCTION_POINTERS=1 > WARNING:root:generating system asset: optimizer.exe... > Traceback (most recent call last): > File "D:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line > 1602, in <module> > flush_js_optimizer_queue() > File "D:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line > 1505, in flush_js_optimizer_queue > run_passes(chunks[0], title, just_split=False, just_concat=False) > File "D:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line > 1478, in run_passes > final = shared.Building.js_optimizer(final, passes, debug_level >= > 4, js_optimizer_extra_info, just_split=just_split, just_concat=just_concat > ) > File "D:\Program Files\Emscripten\emscripten\1.35.0\tools\shared.py" > , line 1634, in js_optimizer > ret = js_optimizer.run(filename, passes, NODE_JS, debug, > extra_info, just_split, just_concat) > File "D:\Program > Files\Emscripten\emscripten\1.35.0\tools\js_optimizer.py", line 538, in > run > return temp_files.run_and_clean(lambda: run_on_js(filename, passes > , js_engine, source_map, extra_info, just_split, just_concat)) > File "D:\Program > Files\Emscripten\emscripten\1.35.0\tools\tempfiles.py", line 64, in > run_and_clean > return func() > File "D:\Program > Files\Emscripten\emscripten\1.35.0\tools\js_optimizer.py", line 538, in > <lambda> > return temp_files.run_and_clean(lambda: run_on_js(filename, passes > , js_engine, source_map, extra_info, just_split, just_concat)) > File "D:\Program > Files\Emscripten\emscripten\1.35.0\tools\js_optimizer.py", line 428, in > run_on_js > if not use_native(passes, source_map) or not get_native_optimizer > (): > File "D:\Program > Files\Emscripten\emscripten\1.35.0\tools\js_optimizer.py", line 182, in > get_native_optimizer > return get_optimizer('optimizer.exe', [], ignore_build_errors) > File "D:\Program > Files\Emscripten\emscripten\1.35.0\tools\js_optimizer.py", line 166, in > get_optimizer > return shared.Cache.get(name, create_optimizer_cmake, extension= > 'exe') > File "D:\Program Files\Emscripten\emscripten\1.35.0\tools\cache.py", > line 41, in get > temp = creator() > File "D:\Program > Files\Emscripten\emscripten\1.35.0\tools\js_optimizer.py", line 117, in > create_optimizer_cmake > proc = subprocess.Popen(['cmake', '-G', cmake_generator, > '-DCMAKE_BUILD_TYPE='+cmake_build_type, shared.path_from_root('tools', > 'optimizer')], cwd=build_path, stdin=log_output, stdout=log_output, stderr > =log_output) > File "D:\Program > Files\Emscripten\python\2.7.5.3_64bit\lib\subprocess.py", line 711, in > __init__ > errread, errwrite) > File "D:\Program > Files\Emscripten\python\2.7.5.3_64bit\lib\subprocess.py", line 948, in > _execute_child > startupinfo) > > If I remove the O2 option, the exact same code compiles fine and can be > called from Javascript. > > Any idea how to fix this ? > > I am on Windows 7 and using Emscripten 1.35.0 installed from > emsdk-1.35.0-full-64bit.exe. > > > ---------------------------------------------------------------------------------- > > The code I am trying to compile: > > *Lib.h:* > > #ifndef LIB_H > #define LIB_H > > extern "C" { > > typedef void (*invoke_oncomplete_callback_t)(int, const char*, const > char*); > > void testFct(const void *arr_data_rgba, int arr_width, int arr_height, > int job_id, invoke_oncomplete_callback_t callback); > > } > > #endif //LIB_H > > *Lib.cpp:* > > #include <sstream> > #include "lib.h" > > // Internal C++ library functions > namespace impl { > > void testFct(const void *arr_data, int arr_width, int arr_height, int > job_id, invoke_oncomplete_callback_t callback) > { > // Call the callback with the result > std::stringstream ss; > ss << "Inversion done in " << 0 << "s"; > callback(job_id, "", ss.str().c_str()); > } > > } // namespace impl > > // Exposed C library function > void testFct(const void *arr_data, int arr_width, int arr_height, int > job_id, invoke_oncomplete_callback_t callback) > { > impl::testFct(arr_data, arr_width, arr_height, job_id, callback); > } > > > ---------------------------------------------------------------------------------- > > The output with EMCC_DEBUG=1: > > D:\Projects\jsport>set EMCC_DEBUG=1 > D:\Projects\jsport>call emcc "../src/lib.cpp" -o emscripten_test-min.js > -O2 -s EXPORTED_FUNCTIONS="['_testFct']" -s RESERVED_FUNCTION_POINTERS=1 > DEBUG:root:PYTHON not defined in C:\Users\MyUserName/.emscripten, > using "D:\Program Files\Emscripten\python\2.7.5.3_64bit\python.exe" > WARNING:root:invocation: D:\Program Files\Emscripten\emscripten\1.35.0 > \\emcc ../src/lib.cpp -o emscripten_test-min.js -O2 -s EXPORTED_FUNCTIONS > =['_testFct'] -s RESERVED_FUNCTION_POINTERS=1 (in D:\Projects\jsport) > INFO:root:(Emscripten: Running sanity checks) > DEBUG:root:compiling to bitcode > DEBUG:root:emcc step "parse arguments and setup" took 0.00 seconds > DEBUG:root:compiling source file: ../src/lib.cpp > DEBUG:root:running: D:\Program Files\Emscripten\clang\e1.35.0_64bit\ > clang++ -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 - > D__EMSCRIPTEN_minor__=35 -D__EMSCRIPTEN_tiny__=0 -Werror=implicit-function > -declaration -nostdinc -Xclang -nobuiltininc -Xclang -nostdsysteminc - > Xclang -isystemD:\Program > Files\Emscripten\emscripten\1.35.0\system\local\include > -Xclang -isystemD:\Program Files\Emscripten\emscripten\1.35.0\system\ > include\compat -Xclang -isystemD:\Program Files\Emscripten\emscripten\1.35 > .0\system\include -Xclang -isystemD:\Program Files\Emscripten\emscripten\ > 1.35.0\system\include\emscripten -Xclang -isystemD:\Program Files\ > Emscripten\emscripten\1.35.0\system\include\libc -Xclang -isystemD:\ > Program > Files\Emscripten\emscripten\1.35.0\system\lib\libc\musl\arch\emscripten > -Xclang -isystemD:\Program Files\Emscripten\emscripten\1.35.0\system\ > include\libcxx -O2 -mllvm -disable-llvm-optzns -std=c++03 ../src/lib.cpp > > ... -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
