pojntfx / unisockets

A universal Berkeley sockets implementation for both WebAssembly (based on WebRTC) and native platforms with bindings for C, Go and TinyGo.
https://alphahorizonio.github.io/unisockets/
GNU Affero General Public License v3.0
34 stars 6 forks source link

Doesn't compile for wasm & tinygo #10

Open rjzak opened 2 years ago

rjzak commented 2 years ago
$ tinygo build -wasm-abi=generic -target=wasi -o main.wasm main.go
# github.com/alphahorizonio/unisockets/pkg/unisockets
../../../../../../../usr/local/lib/tinygo/lib/wasi-libc/sysroot/include/__header_sys_socket.h:12:35: unexpected token ILLEGAL, expected end of expression

Using go1.17.7, tinygo 0.22.0

Specifically, trying to compile an application which uses your TinyNet from a project I created, TinyWWW. Works fine when compiling an ELF on Ubuntu 20.04, but Wasm seems to not be happy.

rjzak commented 2 years ago

Also has the same error when compiling examples in TinyNet: https://github.com/alphahorizonio/tinynet/tree/main/cmd/tcp_echo_server, and when compiling the go echo server example in this project.

$ tinygo build -wasm-abi=generic -target=wasi -o main.wasm main.go
# github.com/alphahorizonio/unisockets/pkg/unisockets
../../../../../../../../../usr/local/lib/tinygo/lib/wasi-libc/sysroot/include/__header_sys_socket.h:12:35: unexpected token ILLEGAL, expected end of expression
$ pwd
/home/rjzak/go/src/github.com/alphahorizonio/unisockets/cmd/go_echo_server

_header_sys_socket.h:12 -> #define SHUT_RDWR (SHUT_RD | SHUT_WR)

charconstpointer commented 1 year ago

any luck with this one @rjzak?

rjzak commented 1 year ago

Not when I last tried a few months ago, should probably try again.

charconstpointer commented 1 year ago

Ok, I'm getting the same issue as well, altough I'm confused, because I inspected __header_sys_socket.h:12:35 and it's valid C code so maybe there's some issue with tinygo compiler