nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.27k stars 324 forks source link

Unable to compile an nginx unit Golang application under Windows #1008

Open ritterzk opened 7 months ago

ritterzk commented 7 months ago

Is: When I try to compile a Golang application for nginx unit under Windows I get the following error:

$ CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o myapp cmd/main.go;
# runtime/cgo
linux_syscall.c: In function ‘_cgo_libc_setresgid’:
linux_syscall.c:67:20: error: implicit declaration of function ‘setresgid’; did you mean ‘setregid’? [-Werror=implicit-function-declaration]
   67 |         SET_RETVAL(setresgid((gid_t) x->args[0], (gid_t) x->args[1],
      |                    ^~~~~~~~~
linux_syscall.c:34:31: note: in definition of macro ‘SET_RETVAL’
   34 |   uintptr_t ret = (uintptr_t) fn ; \
      |                               ^~
linux_syscall.c: In function ‘_cgo_libc_setresuid’:
linux_syscall.c:73:20: error: implicit declaration of function ‘setresuid’; did you mean ‘setreuid’? [-Werror=implicit-function-declaration]
   73 |         SET_RETVAL(setresuid((uid_t) x->args[0], (uid_t) x->args[1],
      |                    ^~~~~~~~~
linux_syscall.c:34:31: note: in definition of macro ‘SET_RETVAL’
   34 |   uintptr_t ret = (uintptr_t) fn ; \
      |                               ^~
cc1: all warnings being treated as errors

I found out that the package unit-dev/unit-devel is required for compilation, which is not available for Windows (not even for mingw).

Question: Is there a possibility or is it planned to be able to compile nginx unit Golang projects under Windows without WSL? We have an environment under which WSL is not available.

tippexs commented 7 months ago

Good morning! Thanks for reaching out! Windows is not a supported platform to run Unit but this is an interesting question. The dev packages for Unit contains all the important requirements to build such applications. It will need some investigation on how to do it property on windows. I would recommend using a dev container as WSL is not an option for you.