I try to build Go code on Windows with CGO_ENABLED=1
. I have a .bat file with
set GOOS=linux
set GOARCH=amd64
set CGO_CFLAGS=-g -O2 -w
set CGO_ENABLED=1
go build main.go constants.go functions.go
But I get error:
gcc_linux_amd64.c: In function '_cgo_sys_thread_start':
gcc_linux_amd64.c:62:2: error: unknown type name 'sigset_t'
sigset_t ign, oset;
^
What should I do? I could't find such error anywhere.
P.S. If I haven't got "-w" flag in "CGO_CFLAGS" I will get this:
# runtime/cgo
_cgo_export.c:1:0: error: -fPIC ignored for target (all code is position
independent) [-Werror]
/* Created by cgo - DO NOT EDIT. */
^
cc1.exe: all warnings being treated as errors