Skip to content

Couldn't set wasmer.entrypoint.name #466

@liudonghua123

Description

@liudonghua123

Hi, I tried to run wasm-ld, but it failed with lld is a generic driver. Invoke ld.lld (Unix), ld64.lld (macOS), lld-link (Windows), wasm-ld (WebAssembly) instead, the binary name of wasm is wasm-ld already, and I tested with wasmer cli, and it's works. But it doesn't work in @wasmer/sdk, the wasmldPkg.entrypoint.name setter is not working as expected.

This cli works.

dir . -- --name wasm-ld -m wasm32 -L/sysroot/lib -L/sysroot/lib/wasm32-wasi /sysroot/lib/wasm32-wasi/crt1-command.o --sh
ared-memory --max-memory=4294967296 --import-memory --export-dynamic --export=__heap_base --export=__stack_pointer --exp
ort=__data_end --export=__wasm_init_tls --export=__wasm_signal --export=__tls_size --export=__tls_align --export=__tls_b
ase -lpthread --shared-memory -lc /lib/clang/16/lib/wasi/libclang_rt.builtins-wasm32.a test.o -lc -lcob -lgmp -lwasi-emu
lated-signal -lwasi-emulated-getpid -lwasi-emulated-mman -lsetjmp -ldl -o test.wasm```

This @wasmer/sdk code is not working.

```js

        // 3. Run Wasm-ld
        term.write("Running wasm-ld...\r\n");
        const wasmldPkg = await Wasmer.fromFile(pkg.wasmld);
        wasmldPkg.entrypoint.name = "wasm-ld"; // not working, wasmldPkg.entrypoint.name is still named entrypoint
        const wasmldInstance = await wasmldPkg.entrypoint.run({
            args: [
                 "-m", "wasm32", 
                 "-L/sysroot/lib", "-L/sysroot/lib/wasm32-wasi", "/sysroot/lib/wasm32-wasi/crt1-command.o",
                 "--export-dynamic", "--export=__heap_base", "--export=__stack_pointer", "--export=__data_end",
                 "-lpthread", "-lc", "/lib/clang/16/lib/wasi/libclang_rt.builtins-wasm32.a",
                 "/test.o",
                 "-lc", "-lcob", "-lgmp", "-lm", 
                 "-o", "/test.wasm"
            ],
            mount: {
                "/": rootDir,
                "/sysroot": sysrootDir,
                "/lib": libDir
            },
            cwd: '/',
        });

        const ldResult = await wasmldInstance.wait();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions