Skip to content

unexpected token ILLEGAL when compiling <sys/socket.h> with wasi target #3369

Open
@charconstpointer

Description

@charconstpointer

I was playing around with https://github.com/alphahorizonio/unisockets and I've noticed some issues when compiling its code for wasi, narrowed it down to the snippet below and it seems like it's the issue with <sys/socket.h> and underlying wasi implementation

package main

/*
#include <sys/socket.h>
*/
import "C"

const (
	SHUT_RDWR = int32(C.SHUT_RDWR)
)

func main() {
}

Compiled with tinygo build -target wasi main.go
Output tinygo/lib/wasi-libc/sysroot/include/__header_sys_socket.h:12:35: unexpected token ILLEGAL, expected end of expression


Env

  • Tinygo version: 0.26.0
  • go version go1.19.4 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    cgoCGo and libc related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions