Skip to content

import/path: gcc_linux_amd64.c: In function '_cgo_sys_thread_start' #68478

Closed
@zhuzaiye

Description

@zhuzaiye

Go version

go version go1.22.2 windows/amd64

Output of go env in your module/workspace:

$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\hzzhu2\AppData\Local\go-build
set GOENV=C:\Users\hzzhu2\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Golang\goproject\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Golang\goproject
set GOPRIVATE=
set GOPROXY=
set GOROOT=C:/Golang/go1.22
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Golang\go1.22\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\awsomeworks\awsomework_golang\sinewave_go\elst-api\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\hzzhu2\AppData\Local\Temp\go-build1743840678=/tmp/go-build -gno-record-gcc-switches

What did you do?

When I build go linux script on Windows env, the build bat script is the following:

@echo off
set GOARCH=amd64
set GOOS=linux
go build -v -o rebuild_resource_title ../controllers/tools/rebuild_resource_title.go
pause

Because I build go program to Android sdk using GoMobile, so i change the go env args CGO_ENABLED=0 to CGO_ENABLED=1.

What did you see happen?

When I run the build bat, the error is the flowwing:

runtime/cgo
# runtime/cgo
gcc_linux_amd64.c: In function '_cgo_sys_thread_start':
gcc_linux_amd64.c:57:2: error: unknown type name 'sigset_t'; did you mean '_sigset_t'?
   57 |  sigset_t ign, oset;
      |  ^~~~~~~~
      |  _sigset_t
gcc_linux_amd64.c:62:2: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
   62 |  sigfillset(&ign);
      |  ^~~~~~~~~~
gcc_linux_amd64.c:57:16: error: unused variable 'oset' [-Werror=unused-variable]
   57 |  sigset_t ign, oset;
      |                ^~~~
cc1.exe: all warnings being treated as errors

When I change CGO_ENABLED=1 to CGO_ENABLED=0, compiling successfully.

What did you expect to see?

  1. Why? Changing CGO_ENABLED=1 to CGO_ENABLED=0, Compilling successfully
  2. Is the first step the only method, changing the value of CGO_ENABLED to switch between different compilation requirements, is very troublesome!!
  3. Will this part be optimized in future releases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions