Answer the question
In order to leave comments, you need to log in
How to compile Go code on Windows under Linux?
I am trying to build a project on Windows 10 under Linux with CGO_ENABLED=1
I have a .bat file with the following content:
set GOOS=linux
set GOARCH=amd64
set CGO_CFLAGS=-g -O2 -w
set CGO_ENABLED=1
go build main.go constants.go functions.go
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;
^
CGO_CFLAGS
, then I 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
Answer the question
In order to leave comments, you need to log in
CGO_ENABLED=1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question