Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: gcc_linux_amd64.c:63:2: error: unknown type name 'sigset_t' #56225

Closed
kityun opened this issue Oct 14, 2022 · 3 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@kityun
Copy link

kityun commented Oct 14, 2022

What version of Go are you using (go version)?

$ go version 
go version go1.19.2 windows/amd64

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

@kityun kityun 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' Oct 14, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Oct 14, 2022
@joedian joedian added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 14, 2022
@ianlancetaylor
Copy link
Contributor

You have CC set to a Windows cross-compiler, but GOOS is linux. That can't work. The CC needs to generate files that run on the GOOS.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2022
@zzrrxx
Copy link

zzrrxx commented Oct 27, 2022

You have CC set to a Windows cross-compiler, but GOOS is linux. That can't work. The CC needs to generate files that run on the GOOS.

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
Copy link
Contributor

You have to either build the code on a Linux machine, or you have to set CC to a C cross-compiler that generates code that runs on Linux.

@golang golang locked and limited conversation to collaborators Oct 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants