It's probably easier to read the code in the other parts of the test suite. See test_dynamic_link in tests/test_browser.py for example. It just creates a pre.js file, then runs two emcc commands, one to build the side module, one for the main.
On Mon, Jul 27, 2015 at 11:44 AM, laurent <[email protected]> wrote: > Hi Alon, > OK I see. > I will try to do more python debug on my side. > Thanks, > Laurent > PS: if you have a working example in the shell using dlfcn that would be > great. > > > > Le 27/07/2015 19:53, Alon Zakai a écrit : > > At the end of the diff, it shows that > > FS.createLazyFile('/', 'liblib.so', 'liblib.so', true, false); > > is missing. In test_core.py, it looks like that is added by the > post_build operation, so I think that isn't running when you build it > manually in the shell. > > > On Sat, Jul 25, 2015 at 12:23 AM, Laurent Lemaitre < > [email protected]> wrote: > >> Hi Alon, >> Attached are the two files. >> The diff gives many differences. >> Laurent >> >> >> 2015-07-24 19:49 GMT+02:00 Alon Zakai <[email protected]>: >> >>> When you run the test suite with EMCC_DEBUG=1, you should see the >>> command (in yellow, starting with "invocation:") and replicating it should >>> produce the same results. Is that what you are trying? For that test, there >>> are at least two commands that run, to build the main and side modules, so >>> make sure to build both. >>> >>> If that doesn't help, diffing the two outputs might show something >>> interesting. (On latest emscripten incoming builds should now be >>> deterministic which makes such diffs easier to read.) >>> >>> >>> On Fri, Jul 24, 2015 at 7:44 AM, Laurent Lemaitre < >>> [email protected]> wrote: >>> >>>> Hello, >>>> I am trying to run the followingexample using emcc: >>>> python runner.py test_dlfcn_funcs >>>> >>>> I saved all the files created by "python runner.py test_dlfcn_funcs" >>>> using export EM_SAVE_DIR=1. >>>> I set export EMCC_DEBUG=2 as well. >>>> >>>> In folder /tmp/emscripten_temp I tried to recreate src.c.o.js using the >>>> following invocation command: >>>> emcc \ >>>> src.c.o \ >>>> -g \ >>>> -o src.c.o.js \ >>>> -s GL_DEBUG=0 \ >>>> -s EXCEPTION_CATCHING_WHITELIST="[]" \ >>>> -s INCLUDE_FULL_LIBRARY=0 \ >>>> -s FINALIZE_ASM_JS=1 \ >>>> -s RUNTIME_LINKED_LIBS="[]" \ >>>> -s LIBRARY_DEBUG=0 \ >>>> -s ASSERTIONS=1 \ >>>> -s USE_SDL_IMAGE=1 \ >>>> -s INLINING_LIMIT=0 \ >>>> -s MODULARIZE=0 \ >>>> -s NO_FILESYSTEM=0 \ >>>> -s SOCKET_WEBRTC=0 \ >>>> -s USE_PTHREADS=0 \ >>>> -s EXPORT_NAME="'Module'" \ >>>> -s AGGRESSIVE_VARIABLE_ELIMINATION=0 \ >>>> -s SIMPLIFY_IFS=1 \ >>>> -s ALIASING_FUNCTION_POINTERS=0 \ >>>> -s EMULATED_FUNCTION_POINTERS=0 \ >>>> -s EMSCRIPTEN_VERSION="''" \ >>>> -s OPENAL_DEBUG=0 \ >>>> -s NO_EXIT_RUNTIME=0 \ >>>> -s RELOCATABLE=0 \ >>>> -s PRECISE_F32=0 \ >>>> -s DEBUG_TAGS_SHOWING="[]" \ >>>> -s SAFE_HEAP_LOG=0 \ >>>> -s PROXY_TO_WORKER_FILENAME="''" \ >>>> -s NODE_STDOUT_FLUSH_WORKAROUND=1 \ >>>> -s QUANTUM_SIZE=4 \ >>>> -s PRECISE_I64_MATH=1 \ >>>> -s GLOBAL_BASE=-1 \ >>>> -s ASM_JS=2 \ >>>> -s WARN_UNALIGNED=0 \ >>>> -s EMULATE_FUNCTION_POINTER_CASTS=0 \ >>>> -s TOTAL_STACK=5242880 \ >>>> -s EXPORTED_GLOBALS="[]" \ >>>> -s RESERVED_FUNCTION_POINTERS=0 \ >>>> -s EXCEPTION_DEBUG=0 \ >>>> -s FUNCTION_POINTER_ALIGNMENT=2 \ >>>> -s SHELL_FILE=0 \ >>>> -s CLOSURE_COMPILER=0 \ >>>> -s GL_ASSERTIONS=0 \ >>>> -s BOOTSTRAPPING_STRUCT_INFO=0 \ >>>> -s MEM_INIT_METHOD=0 \ >>>> -s GL_TESTING=0 \ >>>> -s DETERMINISTIC=0 \ >>>> -s SAFE_HEAP=0 \ >>>> -s DEAD_FUNCTIONS="[]" \ >>>> -s GL_FFP_ONLY=0 \ >>>> -s EMSCRIPTEN_TRACING=0 \ >>>> -s OPT_LEVEL=0 \ >>>> -s MEMFS_APPEND_TO_TYPED_ARRAYS=0 \ >>>> -s NO_DYNAMIC_EXECUTION=0 \ >>>> -s BUILD_AS_WORKER=0 \ >>>> -s EXPORT_ALL=0 \ >>>> -s EMTERPRETIFY_ADVISE=0 \ >>>> -s VERBOSE=0 \ >>>> -s DISABLE_EXCEPTION_CATCHING=0 \ >>>> -s LIBRARY_DEPS_TO_AUTOEXPORT="['memcpy']" \ >>>> -s EMTERPRETIFY_WHITELIST="[]" \ >>>> -s SKIP_STACK_IN_SMALL=1 \ >>>> -s EMTERPRETIFY_ASYNC=0 \ >>>> -s FULL_ES2=0 \ >>>> -s FULL_ES3=0 \ >>>> -s USE_WEBGL2=0 \ >>>> -s PROXY_TO_WORKER=0 \ >>>> -s UNALIGNED_MEMORY=0 \ >>>> -s SWAPPABLE_ASM_MODULE=0 \ >>>> -s ASYNCIFY=0 \ >>>> -s TOTAL_MEMORY=16777216 \ >>>> -s USE_LIBPNG=0 \ >>>> -s SOCKET_DEBUG=0 \ >>>> -s EXPLICIT_ZEXT=0 \ >>>> -s FORCE_ALIGNED_MEMORY=0 \ >>>> -s HEADLESS=0 \ >>>> -s USE_SDL=1 \ >>>> -s MAIN_MODULE=1 \ >>>> -s ASYNCIFY_WHITELIST="['qsort', 'trinkle', '__toread', '__uflow', >>>> '__fwritex', 'MUSL_vfprintf']" \ >>>> -s WEBSOCKET_URL="'ws:#'" \ >>>> -s EMTERPRETIFY=0 \ >>>> -s DEBUG_LEVEL=0 \ >>>> -s SMALL_XHR_CHUNKS=0 \ >>>> -s USE_GLFW=2 \ >>>> -s WARN_ON_UNDEFINED_SYMBOLS=1 \ >>>> -s ORIGINAL_EXPORTED_FUNCTIONS="[]" \ >>>> -s DEMANGLE_SUPPORT=0 \ >>>> -s RUNNING_JS_OPTS=0 \ >>>> -s WEBSOCKET_SUBPROTOCOL="'binary'" \ >>>> -s INVOKE_RUN=1 \ >>>> -s PTHREAD_HINT_NUM_CORES=4 \ >>>> -s PTHREAD_POOL_SIZE=0 \ >>>> -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE="['memcpy', 'memset', 'malloc', >>>> 'free', 'strlen', '$Browser']" \ >>>> -s EXPORT_FUNCTION_TABLES=0 \ >>>> -s SIDE_MODULE=0 \ >>>> -s GL_MAX_TEMP_BUFFER_SIZE=2097152 \ >>>> -s FS_LOG=0 \ >>>> -s STB_IMAGE=0 \ >>>> -s EXPORT_BINDINGS=0 \ >>>> -s PGO=0 \ >>>> -s IN_TEST_HARNESS=0 \ >>>> -s ASYNCIFY_FUNCTIONS="['emscripten_sleep', 'emscripten_wget', >>>> 'emscripten_yield']" \ >>>> -s EMTERPRETIFY_BLACKLIST="[]" \ >>>> -s DOUBLE_MODE=1 \ >>>> -s LEGACY_GL_EMULATION=0 \ >>>> -s RETAIN_COMPILER_SETTINGS=0 \ >>>> -s EXPORTED_FUNCTIONS="['_main', '_malloc']" \ >>>> -s USE_TYPED_ARRAYS=2 \ >>>> -s SIMD=0 \ >>>> -s ALLOW_MEMORY_GROWTH=0 \ >>>> -s CASE_INSENSITIVE_FS=0 \ >>>> -s NO_BROWSER=0 \ >>>> -s USE_ZLIB=0 \ >>>> -s GL_UNSAFE_OPTS=1 \ >>>> -s BENCHMARK=0 \ >>>> -s LINKABLE=0 \ >>>> -s BUILD_AS_SHARED_LIB=0 \ >>>> -s ERROR_ON_UNDEFINED_SYMBOLS=0 \ >>>> -s OUTLINING_LIMIT=0 \ >>>> -s ASM_JS=2 \ >>>> --js-transform "/usr/bin/python /tmp/emscripten_temp/transform.py" >>>> >>>> >>>> As a result file src.c.o.js (file A) created by "python runner.py >>>> test_dlfcn_funcs" and the file src.c.o.js (file B) created by the above >>>> invocation command are different. >>>> >>>> >>>> If I run nodejs src.c.o.js everything is working fine when using file A. >>>> >>>> However file B produce errors: >>>> $ nodejs src.c.o.js >>>> go xxxxxxxxxxxx >>>> ggggggggggggggggggggggggggggggggggggggg / >>>> go >>>> >>>> /tmp/emscripten_temp/src.c.o.js:90 >>>> throw ex; >>>> ^ >>>> Assertion failed: lib_handle != NULL, at: >>>> /tmp/emscripten_temp/src.c,24,main at Error >>>> at jsStackTrace (/tmp/emscripten_temp/src.c.o.js:1235:13) >>>> at stackTrace (/tmp/emscripten_temp/src.c.o.js:1252:22) >>>> at ___assert_fail (/tmp/emscripten_temp/src.c.o.js:1715:210) >>>> at _main (/tmp/emscripten_temp/src.c.o.js:28435:3) >>>> at Object.asm._main (/tmp/emscripten_temp/src.c.o.js:47003:19) >>>> at Object.callMain (/tmp/emscripten_temp/src.c.o.js:49900:30) >>>> at doRun (/tmp/emscripten_temp/src.c.o.js:49958:60) >>>> at run (/tmp/emscripten_temp/src.c.o.js:49972:5) >>>> at Object.<anonymous> (/tmp/emscripten_temp/src.c.o.js:50061:1) >>>> at Module._compile (module.js:456:26) >>>> >>>> >>>> Could somebody explain me how to create src.c.o.js correclty without >>>> running the test suite? >>>> >>>> Thanks, >>>> Laurent >>>> >>>> -- >>>> 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. >>>> >>> >>> -- >>> 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. >>> >> >> -- >> 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. >> > > -- > 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. > > > -- > 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. > -- 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.
