maple3142 / maple3142/wasm-jseval

请教个问题

Open
#2 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
241
Forks
10
PR merge metrics
No merged PRs in 30d

Description

大佬你好,请教下大佬有没有编译过使用js_std_eval_binary的c。
mac系统,quickjs写的c里使用了js_std_eval_binary这个函数:

#include <string.h>
#include "./quickjs.h"
void js_std_eval_binary(JSContext *ctx, const uint8_t *buf, size_t buf_len,
                        int flags);
const uint8_t qjsc_hello[62] = {
 0x02, 0x03, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
 0x6c, 0x65, 0x06, 0x6c, 0x6f, 0x67, 0x10, 0x68,
 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x6a, 0x73, 0x0e,
 0x00, 0x06, 0x00, 0xa0, 0x01, 0x00, 0x01, 0x00,
 0x03, 0x00, 0x00, 0x10, 0x01, 0xa2, 0x01, 0x00,
 0x00, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x42,
 0xe1, 0x00, 0x00, 0x00, 0xb7, 0x24, 0x01, 0x00,
 0xce, 0x28, 0xc4, 0x03, 0x01, 0x00,
};
const uint32_t qjsc_hello_size = 62;

const char* eval(const char* str) {
	JSRuntime* runtime = JS_NewRuntime();
	JSContext* ctx = JS_NewContext(runtime);
  js_std_eval_binary(ctx, qjsc_hello, qjsc_hello_size, 0);
	JS_FreeValue(ctx, result);
}

用emcc编译为js:emcc -o eval.html eval.c ./quickjs-libc.c ./quickjs.c ./cutils.c ./libregexp.c ./libbf.c ./libunicode.c -D CONFIG_VERSION="\"1.0.0\"" -lm -s EXPORTED_FUNCTIONS='["_eval"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]'

报错error: use of undeclared identifier 'sighandler_t'

搜了挺多都没找到原因...求指教

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with eval.c and the listed QuickJS sources, then reproduce the failure using the provided emcc command on macOS. Trace where sighandler_t is referenced and compare the project’s expected Emscripten or C build configuration. Done means the example compiles without the undeclared-identifier error and the exported eval entry point is produced.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.