You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: gcc_linux_amd64.c:63:2: error: unknown type name 'sigset_t' #56225
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\xxxx\AppData\Local\go-build
set GOENV=C:\Users\xxxx\AppData\Roaming\go\env
set GOEXE=
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\xxxxx\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=linux
set GOPATH=D:\cxxxxx;C:\Go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=x86_64-w64-mingw32-gcc
set CXX=x86_64-w64-mingw32-g++
set CGO_ENABLED=1
set GOMOD=
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\xxxx\AppData\Local\Temp\go-build4031921043=/tmp/go-build -gno-record-gcc-switches
What did you do?
go build main.go
What did you expect to see?
linux Runnable file
What did you see instead?
runtime/cgo
gcc_linux_amd64.c: In function '_cgo_sys_thread_start':
gcc_linux_amd64.c:63:2: error: unknown type name 'sigset_t'; did you mean '_sigset_t'?
sigset_t ign, oset;
^~~~~~~~
_sigset_t
gcc_linux_amd64.c:68:2: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
sigfillset(&ign);
^~~~~~~~~~
gcc_linux_amd64.c:63:16: error: unused variable 'oset' [-Werror=unused-variable]
sigset_t ign, oset;
^~~~
cc1.exe: all warnings being treated as errors
changed the title [-]affected/package: gcc_linux_amd64.c:63:2: error: unknown type name 'sigset_t'[/-][+]cmd/compile: gcc_linux_amd64.c:63:2: error: unknown type name 'sigset_t'[/+]on Oct 14, 2022
Activity
[-]affected/package: gcc_linux_amd64.c:63:2: error: unknown type name 'sigset_t'[/-][+]cmd/compile: gcc_linux_amd64.c:63:2: error: unknown type name 'sigset_t'[/+]ianlancetaylor commentedon Oct 14, 2022
You have
CCset to a Windows cross-compiler, butGOOSislinux. That can't work. TheCCneeds to generate files that run on theGOOS.zzrrxx commentedon Oct 27, 2022
Does that means if I want to use CGo, I have to build the source code on a Linux machine, cross-compile won't work?
ianlancetaylor commentedon Oct 27, 2022
You have to either build the code on a Linux machine, or you have to set
CCto a C cross-compiler that generates code that runs on Linux.