pojntfx/unisockets

Doesn't compile for wasm & tinygo

Opened this issue · 4 comments

rjzak commented
$ 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

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)

any luck with this one @rjzak?

rjzak commented

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

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