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

x/net: please implement recvmsg and sendmsg under gccgo #52512

Open
jech opened this issue Apr 23, 2022 · 4 comments
Open

x/net: please implement recvmsg and sendmsg under gccgo #52512

jech opened this issue Apr 23, 2022 · 4 comments
Labels
NeedsInvestigation
Milestone

Comments

@jech
Copy link

@jech jech commented Apr 23, 2022

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

$ go-11 version
go version go1.16.5 gccgo (Debian 11.2.0-20) 11.2.0 linux/amd64

Does this issue reproduce with the latest release?

Yes (gccgo 12-20220319-1, as shipped by Debian).

What operating system and processor architecture are you using (go env)?

go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jch/.cache/go-build"
GOENV="/home/jch/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jch/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jch/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/gcc/x86_64-linux-gnu/11"
GOVCS=""
GOVERSION="go1.16.5 gccgo (Debian 11.2.0-20) 11.2.0"
GCCGO="/usr/bin/x86_64-linux-gnu-gccgo-11"
AR="ar"
CC="x86_64-linux-gnu-gcc-11"
CXX="x86_64-linux-gnu-g++-11"
CGO_ENABLED="1"
GOMOD="/home/jch/go/src/github.com/jech/galene/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/goild383537842=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

git clone https://github.com/jech/galene
cd galene
go-11 build

What did you expect to see?

Build success.

What did you see instead?

$ go-11 build
# github.com/jech/galene
/usr/bin/ld: /home/jch/.cache/go-build/52/5228351bb25e08cdacb62b029a4fedd8aab4843fc74cbe78b772d49220892d5c-d(_go_.o): in function `golang_0org_1x_1net_1internal_1socket.Conn.recvMsg..func1':
/home/jch/go/pkg/mod/golang.org/x/net@v0.0.0-20220421235706-1d1ef9303861/internal/socket/sys_unix.go:38: undefined reference to `syscall.recvmsg'
/usr/bin/ld: /home/jch/.cache/go-build/52/5228351bb25e08cdacb62b029a4fedd8aab4843fc74cbe78b772d49220892d5c-d(_go_.o): in function `golang_0org_1x_1net_1internal_1socket.Conn.sendMsg..func1':
/home/jch/go/pkg/mod/golang.org/x/net@v0.0.0-20220421235706-1d1ef9303861/internal/socket/sys_unix.go:42: undefined reference to `syscall.sendmsg'
collect2: error: ld returned 1 exit status
@gopherbot gopherbot added this to the Unreleased milestone Apr 23, 2022
@gopherbot gopherbot removed this from the Unreleased milestone Apr 23, 2022
@gopherbot gopherbot added this to the Gccgo milestone Apr 23, 2022
@cagedmantis cagedmantis added the NeedsInvestigation label Apr 28, 2022
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Apr 28, 2022

/cc @ianlancetaylor

@eat-swap
Copy link

@eat-swap eat-swap commented May 9, 2022

It seems that various of system calls were not implemented. Same and some similar errors can be reproduced using the most recent gccgo (12.1 release).

When trying to build Caddy with gccgo, the mentioned error could be reproduced:

$ go build -o ~/build/bin/caddy

# github.com/yuin/goldmark/util
/root/go/pkg/mod/github.com/yuin/goldmark@v1.4.8/util/html5entities.go: In function ‘github_0com_1yuin_1goldmark_1util..import’:
/root/go/pkg/mod/github.com/yuin/goldmark@v1.4.8/util/html5entities.go:1:1: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
    1 | package util
      | ^
# github.com/caddyserver/caddy/v2/cmd/caddy
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.RawSyscallNoError':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:48: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.SyscallNoError':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:21: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.Syscall':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:28: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.Syscall6':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:35: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.Syscall9':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:42: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.RawSyscall':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:53: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.RawSyscall6':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:58: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.SyscallNoError':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:21: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:21: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.RawSyscall6':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:58: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:58: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:58: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.RawSyscallNoError':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:48: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:48: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:48: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:48: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:48: undefined reference to `golang_0org_1x_1sys_1unix.realSyscallNoError'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o):/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:48: more undefined references to `golang_0org_1x_1sys_1unix.realSyscallNoError' follow
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o): in function `golang_0org_1x_1sys_1unix.Syscall6':
/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:35: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:35: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:35: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:35: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:35: undefined reference to `golang_0org_1x_1sys_1unix.realSyscall'
/usr/bin/ld: /root/.cache/go-build/40/40e4efeceabe8caf9296c8402f19f610df3f3d8aa148d34f3ad9ab11b0ddbf4f-d(_go_.o):/root/go/pkg/mod/golang.org/x/sys@v0.0.0-20220209214540-3681064d5158/unix/gccgo.go:35: more undefined references to `golang_0org_1x_1sys_1unix.realSyscall' follow
/usr/bin/ld: /root/.cache/go-build/ec/ec7e9a7fec808c24bc4c1ebe49858204ccba78ad8fe93d1b68dbccfef69b19c1-d(_go_.o): in function `golang_0org_1x_1net_1internal_1socket.Conn.recvMsg..func1':
/root/go/pkg/mod/golang.org/x/net@v0.0.0-20220127200216-cd36cc0744dd/internal/socket/sys_unix.go:38: undefined reference to `syscall.recvmsg'
/usr/bin/ld: /root/.cache/go-build/ec/ec7e9a7fec808c24bc4c1ebe49858204ccba78ad8fe93d1b68dbccfef69b19c1-d(_go_.o): in function `golang_0org_1x_1net_1internal_1socket.Conn.sendMsg..func1':
/root/go/pkg/mod/golang.org/x/net@v0.0.0-20220127200216-cd36cc0744dd/internal/socket/sys_unix.go:42: undefined reference to `syscall.sendmsg'
collect2: error: ld returned 1 exit status

For your information, go and gccgo versions are:

$ go version
go version unknown linux/amd64
$ gccgo --version
gccgo (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks for your effort in investigating into this problem.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented May 13, 2022

I can't recreate the problems with golang.org/x/sys/unix.

The problems with golang.org/x/net will require some updates to that package. It is using go:linkame in a way that works with the gc compiler but not with gccgo.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented May 13, 2022

I wrote proposal #52885 as a step toward cleaning this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

5 participants