Moddable-OpenSource / moddable

Tools for developers to create truly open IoT products using standard JavaScript on low cost microcontrollers.
http://www.moddable.com
1.35k stars 238 forks source link

Error: ‘fx_SuppressedError’ undeclared here (two locations, during build of SDK) #1407

Closed JoshuaPK closed 2 months ago

JoshuaPK commented 2 months ago

Build environment: Linux, AlmaLinux 9.4, gcc 11.4.1, cmake 3.26.5, esp-idf 5.3 Moddable SDK version: 5.0.0 Target device: ESP32

Description I followed directions in the Getting Started documentation. I first installed esp-idf 5.3 using the method described in the Getting Started documentation (ESP32 Install), then installed the Moddable SDK. While attempting to do a 'make' on the SDK, I got the following compile errors:

/home/josh/dev/ide/moddable/build/tmp/lin/release/xsbug/mc.xs.c:19176:140: error: ‘fx_SuppressedError’ undeclared here (not in a function); did you mean ‘xsID_SuppressedError’?
19176 | 0x8b, .kind = XS_CALLBACK_X_KIND}, .value = { .callback = { fx_SuppressedError, NULL } }},
      |                                                             ^~~~~~~~~~~~~~~~~~
      |                                                             xsID_SuppressedError
make[1]: *** [/home/josh/dev/ide/moddable/build/tmp/lin/release/xsbug/makefile:362: /home/josh/dev/ide/moddable/build/tmp/lin/release/xsbug/mc.xs.c.o] Error 1

/home/josh/dev/ide/moddable/build/tmp/lin/release/xsbug/mc.xs.c:19176:140: error: ‘fx_SuppressedError’ undeclared here (not in a function); did you mean ‘xsID_SuppressedError’?
19176 | 0x8b, .kind = XS_CALLBACK_X_KIND}, .value = { .callback = { fx_SuppressedError, NULL } }},
      |                                                             ^~~~~~~~~~~~~~~~~~
      |                                                             xsID_SuppressedError
make[1]: *** [/home/josh/dev/ide/moddable/build/tmp/lin/release/xsbug/makefile:362: /home/josh/dev/ide/moddable/build/tmp/lin/release/xsbug/mc.xs.c.o] Error 1

I modified the affected files to change the reference of fs_SuppressedError to fx_Error and it built without problem after that.

Steps to Reproduce

  1. Install the esp-idf toolkit as described here
  2. Attempt to install the Moddable SDK
  3. Observe compiler error.

Expected behavior A successful SDK build.

phoddie commented 2 months ago

Thanks for the report. I'm not seeing that here on macOS, but will check on Linux.

FWIW – The error is happening when building xsbug. The SupressedError support is only built as part of the experimental Explicit Resource Management proposal support. That is disabled by default. The Moddable SDK only builds it for xst, the XS test tool used for conformance and fuzz testing, by setting mxExplicitResourceManagement=1 in the make file. Somehow your build of xsbug seems to have SupressedError partially enabled, which causing the link error.

mkellner commented 2 months ago

Hello @JoshuaPK, is it possible that there are changes made to files in your Moddable SDK?

I've checked my mc.xs.c file that was created when I built the tools, searching for Suppressed, but I did not find it.

phoddie commented 2 months ago

Any update here? Without some additional information to investigate, we'll close this out in the coming days. Thanks.

JoshuaPK commented 2 months ago

This appears to be a one-off occurrence. I retried cloning and building the Moddable repository and this problem did not re-occur.

phoddie commented 2 months ago

That's great to hear. Thanks for letting us know.