Whenever I change the code on the website the following error shows up:
TypeError: Module.UTF8ToString is not a function"
I have recently updated the website, but the commit does not touch the libjsonnet.js.
@sparkprime Do you have any ideas for what it might be, or how to fix it? Should I revert (but then the stdlib docs will be really out of date).
The interactive editor still doesn't work.
FYI, it can be fixed with the following bookmarklet:
javascript:void(Module.UTF8ToString=UTF8ToString)
Usable as an interim solution for playing around with the examples till the website is fixed.
So this emscripten library function is nolonger accessed through Module (or never was, and luckily worked until some new version)?
This commit looks like the cause: https://github.com/google/jsonnet/commit/c323f5ce5b8aa663585d23dc0fb94d4b166c6f16#diff-f1185dfe3c71b3025eaf7ba31336a40bL39
When I revert it to Pointer_stringify it works as expected.
Weird. Pointer_stringify was deprecated in favor of UTF8ToString.
UTF8ToString is in preamble, so I guess it should be called directly.
I tried to rebuild it locally, but got this!
Error: abort(Assertion failed: you need to wait for the runtime to be ready (e.g. wait for main() to be called)) at Error
at jsStackTrace (http://localhost:8200/js/libjsonnet.js:47:16244)
at stackTrace (http://localhost:8200/js/libjsonnet.js:47:16412)
at abort (http://localhost:8200/js/libjsonnet.js:47:13259)
at assert (http://localhost:8200/js/libjsonnet.js:47:1647)
at Module._jsonnet_make (http://localhost:8200/js/libjsonnet.js:47:97850)
at ccall (http://localhost:8200/js/libjsonnet.js:47:2575)
at http://localhost:8200/js/libjsonnet.js:47:2737
at jsonnet_evaluate_snippet_wrapped (http://localhost:8200/js/demo.js:60:12)
at http://localhost:8200/js/demo.js:382:20
at http://localhost:8200/js/demo.js:287:9
That seemed to be caused by another error "mb is not defined"
However... If I build without -Os the problem goes away. I'm going to push the site with this new js file.
I still get these but assuming they are benign
wasm2js: warning: global scope may be colliding with other scope: bool_20std____2__operator___char_2c_20std____2__char_traits_char__2c_20std____2__allocator_char__20__28std____2__basic_string_char_2c_20std____2__char_traits_char__2c_20std____2__allocator_char__20__20const__2c_20char_20const__29
wasm2js: warning: global scope may be colliding with other scope: bool_20std____2__operator___char_2c_20std____2__char_traits_char__20__28std____2__istreambuf_iterator_char_2c_20std____2__char_traits_char__20__20const__2c_20std____2__istreambuf_iterator_char_2c_20std____2__char_traits_char__20__20const__29
wasm2js: warning: global scope may be colliding with other scope: bool_20std____2__operator___wchar_t_2c_20std____2__char_traits_wchar_t__20__28std____2__istreambuf_iterator_wchar_t_2c_20std____2__char_traits_wchar_t__20__20const__2c_20std____2__istreambuf_iterator_wchar_t_2c_20std____2__char_traits_wchar_t__20__20const__29
warning: Output contains some very large functions (5497 lines in $28anonymous_20namespace_29__Interpreter__evaluate_28AST_20const__2c_20unsigned_20int_29), consider building source files with -Os or -Oz)
Well it works again for me. Reopen the bug if there's still issues. Thanks for the reports and workarounds in the meantime!
For the record:
dcunnin@dcunnin:~$ em++ --version
emcc (Emscripten gcc/clang-like replacement) 1.39.8 (commit 1458145cf4f3db0fb548343e6acab267eef8e4ef)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Fix verified on Chrome, Debian. Thanks!
Most helpful comment
FYI, it can be fixed with the following bookmarklet:
Usable as an interim solution for playing around with the examples till the website is fixed.