Closed sgammon closed 1 year ago
after switching to the PR tagged in this issue, and removing only the --closed-world
flag, the WASM sample built for me. adding the flag back fails the build again. maybe i need some additional flag to cover these publics? thank you J2CL team for considering this issue.
another bug building the WASM sample, but this time building the JS app:
external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:85: ERROR - could not determine the type of this expression
'ConsoleLogger.log': (level, message) => console[level](message),
^
ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of:
@com_google_j2cl//jre/java:j2wasm_js
Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file.
ERROR: /Users/sam/Workspace/elide/runtime/elide/runtime/wasm/BUILD.bazel:82:17: Compiling 3 JavaScript files to elide/runtime/wasm/jsapp.js failed: (Exit 1): ClosureWorker failed: error executing command bazel-out/host/bin/external/io_bazel_rules_closure/java/io/bazel/rules/closure/ClosureWorker @@bazel-out/darwin_arm64-fastbuild/bin/elide/runtime/wasm/jsapp.js-0.params external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:85: ERROR - could not determine the type of this expression 'ConsoleLogger.log': (level, message) => console[level](message), ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:85: ERROR - could not determine the type of this expression 'ConsoleLogger.log': (level, message) => console[level](message), ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:85: ERROR - could not determine the type of this expression 'ConsoleLogger.log': (level, message) => console[level](message), ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:118: ERROR - could not determine the type of this expression 'createBuffer': size => new Array(size), ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:119: ERROR - could not determine the type of this expression 'setBufferAt': (buffer, index, value) => buffer[index] = value, ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:119: ERROR - could not determine the type of this expression 'setBufferAt': (buffer, index, value) => buffer[index] = value, ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:119: ERROR - could not determine the type of this expression 'setBufferAt': (buffer, index, value) => buffer[index] = value, ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:120: ERROR - could not determine the type of this expression 'getBufferAt': (buffer, index) => buffer[index], ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:120: ERROR - could not determine the type of this expression 'getBufferAt': (buffer, index) => buffer[index], ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:121: ERROR - could not determine the type of this expression 'getLength': s => s.length, ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. external/com_google_j2cl/jre/java/super-wasm/j2wasm.js:121: ERROR - could not determine the type of this expression 'getLength': s => s.length, ^ ProTip: "JSC_UNKNOWN_EXPR_TYPE" or "missingSourcesWarnings" or "reportUnknownTypes" can be added to the `suppress` attribute of: @com_google_j2cl//jre/java:j2wasm_js Alternatively /** @suppress {reportUnknownTypes} */ can be added to the source file. 11 error(s), 0 warning(s), 96.0% typed INFO: Elapsed time: 49.506s, Critical Path: 29.58s INFO: 401 processes: 47 internal, 245 darwin-sandbox, 53 local, 56 worker. FAILED: Build did NOT complete successfully
console
is defined in the externs for the closure compiler. It might be a configuration or version issue, not sure. But our wasm backend is in flux and sometimes it needs very specific versions of Chrome and binaryen.
It is a bit rough on the edges and we haven't focused yet on making the opensource version seamless.
oh, i should have noticed this was console related @rluble, i am building with --env=CUSTOM
for a pure-JS environment. passing a blanket suppression got me working for now. it would help if the j2wasm_*
rules allowed kwargs
which they pass to the underlying closure calls; i've made such a change on my branch and can offer it as a PR if the team is interested.
thank you for getting back to me
also, maybe it would be helpful if i wrote some rules that install the right Binaryen bins? any interest there too, if i set that up? thanks again
(i should also say, make sure to expand the error in the bug, the JS one above may be console related, but I'm not sure the main one is)
It looks like you hit some in between versions, pls for now use an earlier version of binaryen. (I will keep this issue open though to ensure the problem will be fixed in open source as well).
j2wasm_application rule, the way imports work etc. will through some overhaul. We can discuss again in couple of months and looks for potential improvements there.
also, maybe it would be helpful if i wrote some rules that install the right Binaryen bins
Yes, that would be cool (though it may require some active maintenance if you would like to bite bullet)
@gkdn if memory serves i had to use a latest version of binaryen to support --closed-world
, but adding the ability to pass parameters and dropping the invalid ones lets me use the latest release. we're thinking of using J2CL and J2WASM again for a new project and if we do, we'd be happy to write some quick binaryen rules.
I think all the closed-world
issues are fixed. Closing this for now, let me know if not.
@gkdn thank you again!
Describe the bug When trying to build the WASM samples on macOS, the new
--closed-world
flag is causing some issues. At first, I needed to buildbinaryen
from trunk to get access to the--closed-world
flag at all. Then, after building from trunk, I get the errors listed below.Expand to see error
To Reproduce No snippet needed, just building the WASM sample
Bazel version Please include version of Bazel that you are running J2CL with:
$ bazel version
Expected behavior I expected it to build