Skip to content

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

Closed as not planned

Description

@kityun

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

Activity

  1. 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
  2. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Oct 14, 2022
  3. ianlancetaylor commented on Oct 14, 2022

    @ianlancetaylor
    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.

  4. zzrrxx commented on Oct 27, 2022

    @zzrrxx

    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?

  5. ianlancetaylor commented on Oct 27, 2022

    @ianlancetaylor
    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.

  6. locked and limited conversation to collaborators on Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions