Skip to content

Conversation

andrjohns
Copy link
Contributor

The addition of js_once calls to js_os_exec is causing compilation errors under emscripten with:

./quickjs/quickjs-libc.c:3038:8: error: unknown type name 'js_once_t'
 3038 | static js_once_t js_os_exec_once = JS_ONCE_INIT;
      |        ^
./quickjs/quickjs-libc.c:3038:36: error: use of undeclared identifier 'JS_ONCE_INIT'
 3038 | static js_once_t js_os_exec_once = JS_ONCE_INIT;
      |                                    ^
./quickjs/quickjs-libc.c:3168:5: error: call to undeclared function 'js_once'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 3168 |     js_once(&js_os_exec_once, js_os_exec_once_init);
      |     ^

This PR just gates the initialisation behind ifdefs so that it falls back to the non-threaded codepath gracefully.

I've also added quickjs-libc to the emscripten CI so that the changes are tested.

Thanks!

@saghul
Copy link
Contributor

saghul commented Dec 27, 2024

Can you use the same guard used in cutils.h ?

@andrjohns
Copy link
Contributor Author

Can you use the same guard used in cutils.h ?

Done!

@saghul saghul merged commit 8d88f32 into quickjs-ng:master Dec 27, 2024
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants