emscripten-core / emscripten-core/emscripten

Failed to generate WASI socket API in standalone Wasm

Đang mở
#19,167 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
27.6k
Fork
3.6k
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
109

Mô tả

Please include the following in your bug report:

**Description**
Hi, I try to compile a simple server written by C(only contains `socket()`, `recvfrom()` and `sendto()`) to a standalone Wasm using Emscripten.
However, I find in the compiled Wasm file, the import functions related to socket API are not from the WASI interface but from custom `env`, thus it cannot be executed in a standalone Wasm runtime.
Should I add some options of Emscripten when I compile it?
Thank you!

**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.24 (68a9f990429e0bcfb63b1cde68bad792554350a5)
clang version 16.0.0 (https://github.com/llvm/llvm-project 277c382760bf9575cfa2eac73d5ad1db91466d3f)
Target: wasm32-unknown-emscripten
Thread model: posix

**Failing command line in full:**
Both command lines failed to generate WASI socket API.
```
emcc -sENVIRONMENT=shell -O2 -sSTANDALONE_WASM -sERROR_ON_UNDEFINED_SYMBOLS=0 server.c -o server.wasm
emcc -sENVIRONMENT=shell -O2 -sSTANDALONE_WASM -sERROR_ON_UNDEFINED_SYMBOLS=0 -lwebsocket.js -sPROXY_POSIX_SOCKETS server.c -o server.wasm

```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.