Stream: git-wasmtime

Topic: wasmtime / issue #7877 Error when running the C++ example


view this post on Zulip Wasmtime GitHub notifications bot (Feb 06 2024 at 09:01):

996ccs added the bug label to Issue #7877.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 06 2024 at 09:01):

996ccs added the cranelift label to Issue #7877.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 06 2024 at 09:01):

996ccs opened issue #7877:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

TODO: paste .clif test case here. Ideally, a test case that has been reduced via
the `clif-util bugpoint` command.

Steps to Reproduce

An error occurs when the c++ column in the examples/ directory is run

Expected Results

TODO: What do you expect to happen?
Code compile through

Actual Results

Undefined symbols for architecture arm64:
"_wasm_byte_vec_delete", referenced from:
(anonymous namespace)::compile_wat_module_from_file(wasm_engine_t*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in async-63399a.o
(anonymous namespace)::exit_with_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, wasmtime_error, wasm_trap_t) in async-63399a.o
TODO: What actually happens? Panic? Segfault? Incorrect result?

Versions and Environment

Cranelift version or commit: TODO

Operating system: TODO
mac os 13.4
Architecture: TODO

Extra Info

Anything else you'd like to add?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 06 2024 at 19:40):

alexcrichton commented on issue #7877:

Thanks for the report, but can you fill out some more of the issue template? For example how do we reproduce this? You've pasted a linker-generated error but that could happen from a whole manner of causes. This could be as simple as a missing -lwasmtime on the linker command line and something as complex as the wrong version of the library being used.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 07 2024 at 02:26):

996ccs commented on issue #7877:

Thanks for the report, but can you fill out some more of the issue template? For example how do we reproduce this? You've pasted a linker-generated error but that could happen from a whole manner of causes. This could be as simple as a missing -lwasmtime on the linker command line and something as complex as the wrong version of the library being used.

Thank you for your reply.
I was under the https://github.com/bytecodealliance/wasmtime-cpp warehouse will include directory header file complete and implement a c + + examples/arg, 20 \ cc - STD = c + +
-I ./include \
-I ./include \
-lpthread -ldl -lm \
-o fuel
Then the compiler reported an error, the error message is as follows:
Undefined symbols for architecture arm64:
"_wasm_byte_vec_delete", referenced from:
__ZNK8wasmtime5Error7messageB5cxx11Ev in ccjBPpoF.o
__ZN8wasmtime8wat2wasmESt17basic_string_viewIcSt11char_traitsIcEE in ccjBPpoF.o
__ZNK8wasmtime4Trap7messageB5cxx11Ev in ccjBPpoF.o
"_wasm_config_delete", referenced from:...

view this post on Zulip Wasmtime GitHub notifications bot (Feb 07 2024 at 02:41):

996ccs edited a comment on issue #7877:

Thanks for the report, but can you fill out some more of the issue template? For example how do we reproduce this? You've pasted a linker-generated error but that could happen from a whole manner of causes. This could be as simple as a missing -lwasmtime on the linker command line and something as complex as the wrong version of the library being used.

Thank you for your reply.
I was under the https://github.sheincorp.cn/bytecodealliance/wasmtime-cpp repository will include directory header file complete and implement a c + + examples/arg, 20 \ cc - STD = c + +
-I ./include \
-I ./include \
-lpthread -ldl -lm \
-o fuel
Then the compiler reported an error, the error message is as follows:
Undefined symbols for architecture arm64:
"_wasm_byte_vec_delete", referenced from:
__ZNK8wasmtime5Error7messageB5cxx11Ev in ccjBPpoF.o
__ZN8wasmtime8wat2wasmESt17basic_string_viewIcSt11char_traitsIcEE in ccjBPpoF.o
__ZNK8wasmtime4Trap7messageB5cxx11Ev in ccjBPpoF.o
"_wasm_config_delete", referenced from:...

view this post on Zulip Wasmtime GitHub notifications bot (Feb 07 2024 at 02:43):

996ccs edited a comment on issue #7877:

Thanks for the report, but can you fill out some more of the issue template? For example how do we reproduce this? You've pasted a linker-generated error but that could happen from a whole manner of causes. This could be as simple as a missing -lwasmtime on the linker command line and something as complex as the wrong version of the library being used.

Thank you for your reply.
I was under the https://github.sheincorp.cn/bytecodealliance/wasmtime-cpp repository will include directory header file complete and implement a c++ examples/fuel.cc -std=c++20\
-I ./include \
-lpthread -ldl -lm \
-o fuel
Then the compiler reported an error, the error message is as follows:
Undefined symbols for architecture arm64:
"_wasm_byte_vec_delete", referenced from:
__ZNK8wasmtime5Error7messageB5cxx11Ev in ccjBPpoF.o
__ZN8wasmtime8wat2wasmESt17basic_string_viewIcSt11char_traitsIcEE in ccjBPpoF.o
__ZNK8wasmtime4Trap7messageB5cxx11Ev in ccjBPpoF.o
"_wasm_config_delete", referenced from:...

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2024 at 11:38):

alexcrichton commented on issue #7877:

Your command line there is missing -lwasmtime or something equivalent to link the Wasmtime C API. You can find more documentation in fuel.c.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 17 2024 at 13:54):

996ccs commented on issue #7877:

Your command line there is missing -lwasmtime or something equivalent to link the Wasmtime C API. You can find more documentation in fuel.c.

When I run the above example, I get an error
wasmtime git:(main) cargo build --release -p wasmtime-c-api
cc examples/fuel.c \
-I crates/c-api/include \
-I crates/c-api/wasm-c-api/include \
-lpthread -ldl -lm \
-o fuel
./fuel
Updating crates.io index
error: failed to get witx as a dependency of package wiggle v19.0.0 (/Users/mymac/Desktop/fe/wasmtime/crates/wiggle)

Caused by:
failed to load source for dependency witx

Caused by:
Unable to update /Users/mymac/Desktop/fe/wasmtime/crates/wasi-common/WASI/tools/witx

Caused by:
failed to read /Users/mymac/Desktop/fe/wasmtime/crates/wasi-common/WASI/tools/witx/Cargo.toml

Caused by:
No such file or directory (os error 2)
examples/fuel.c:27:10: fatal error: 'wasm.h' file not found
#include <wasm.h>
^~~~~~~~
1 error generated.
zsh: no such file or directory: ./fuel
➜ wasmtime git:(main) cargo build --release -p wasmtime-c-api
cc examples/fuel.c \
-I crates/c-api/include \
-I crates/c-api/wasm-c-api/include \
target/release/libwasmtime.a \
-lpthread -ldl -lm \
-o fuel
./fuel
Updating crates.io index
error: failed to get witx as a dependency of package wiggle v19.0.0 (/Users/mymac/Desktop/fe/wasmtime/crates/wiggle)

Caused by:
failed to load source for dependency witx

Caused by:
Unable to update /Users/mymac/Desktop/fe/wasmtime/crates/wasi-common/WASI/tools/witx

Caused by:
failed to read /Users/mymac/Desktop/fe/wasmtime/crates/wasi-common/WASI/tools/witx/Cargo.toml

Caused by:
No such file or directory (os error 2)
clang: error: no such file or directory: 'target/release/libwasmtime.a'
zsh: no such file or directory: ./fuel

view this post on Zulip Wasmtime GitHub notifications bot (Feb 20 2024 at 07:39):

996ccs closed issue #7877:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

TODO: paste .clif test case here. Ideally, a test case that has been reduced via
the `clif-util bugpoint` command.

Steps to Reproduce

An error occurs when the c++ column in the examples/ directory is run

Expected Results

TODO: What do you expect to happen?
Code compile through

Actual Results

Undefined symbols for architecture arm64:
"_wasm_byte_vec_delete", referenced from:
(anonymous namespace)::compile_wat_module_from_file(wasm_engine_t*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in async-63399a.o
(anonymous namespace)::exit_with_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, wasmtime_error, wasm_trap_t) in async-63399a.o
TODO: What actually happens? Panic? Segfault? Incorrect result?

Versions and Environment

Cranelift version or commit: TODO

Operating system: TODO
mac os 13.4
Architecture: TODO

Extra Info

Anything else you'd like to add?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 20 2024 at 07:39):

996ccs commented on issue #7877:

The problem has been solved.


Last updated: Nov 22 2024 at 16:03 UTC