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/sys/unix: openbsd/arm does not build #21254

Closed
hacdias opened this issue Aug 1, 2017 · 9 comments
Closed

x/sys/unix: openbsd/arm does not build #21254

hacdias opened this issue Aug 1, 2017 · 9 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-OpenBSD
Milestone

Comments

@hacdias
Copy link

hacdias commented Aug 1, 2017

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

1.8.3

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

Linux amd64

What did you do?

It's also broken on openbsd/arm6:

GOOS=openbsd GOARCH=arm GOARM=6 go build -ldflags='-s -w -X main.version=1.0.4 -X main.commit=1dcb5944c3de638dfa22f8c19728820f33118496 -X main.date=2017-07-31T09:47:18Z' -o dist/openbsd-arm-filemanager/filemanager cmd/filemanager/main.go

What did you expect to see?

No errors.

What did you see instead?

travis@d282747cb28c:~/gopath/src/github.com/hacdias/filemanager$ GOOS=openbsd GOARCH=arm GOARM=6 go build -ldflags='-s -w -X main.version=1.0.4 -X main.commit=1dcb5944c3de638dfa22f8c19728820f33118496 -X main.date=2017-07-31T09:47:18Z' -o dist/openbsd-arm-filemanager/filemanager cmd/filemanager/main.go
# golang.org/x/sys/unix
../../../golang.org/x/sys/unix/flock.go:16: undefined: Flock_t
../../../golang.org/x/sys/unix/sockcmsg_unix.go:37: undefined: Cmsghdr
../../../golang.org/x/sys/unix/sockcmsg_unix.go:43: undefined: Cmsghdr

It works without the ldflags. It doesn't

@ALTree ALTree changed the title Build with ldflags broken on OpenBSD/arm cmd/go: build with ldflags broken on OpenBSD/arm Aug 1, 2017
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 1, 2017
@ALTree
Copy link
Member

ALTree commented Aug 1, 2017

Can you reproduce this with go1.9rc1?

@hacdias
Copy link
Author

hacdias commented Aug 1, 2017

I'll check it out.

@hacdias
Copy link
Author

hacdias commented Aug 1, 2017

go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/travis/gopath"
GORACE=""
GOROOT="/home/travis/.gimme/versions/go1.9rc1.linux.amd64"
GOTOOLDIR="/home/travis/.gimme/versions/go1.9rc1.linux.amd64/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build056863544=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

A bigger trace on 1.9rc1:

travis@c9f042511ef7:~/gopath/src/github.com/hacdias/filemanager$ GOOS=openbsd GOARCH=arm GOARM=6 go build -ldflags='-s -w -X main.version=1.0.4 -X main.commit=1dcb5944c3de638dfa22f8c19728820f33118496 -X main.date=2017-07-31T09:47:18Z' -o dist/openbsd-arm-filemanager/filemanager cmd/filemanager/main.go
# golang.org/x/sys/unix
../../../golang.org/x/sys/unix/flock.go:16:42: undefined: Flock_t
../../../golang.org/x/sys/unix/sockcmsg_unix.go:37:18: undefined: Cmsghdr
../../../golang.org/x/sys/unix/sockcmsg_unix.go:43:9: undefined: Cmsghdr
../../../golang.org/x/sys/unix/syscall_openbsd.go:32:6: missing function body for "Syscall9"
../../../golang.org/x/sys/unix/syscall_unix_gc.go:12:6: missing function body for "Syscall"
../../../golang.org/x/sys/unix/syscall_unix_gc.go:13:6: missing function body for "Syscall6"
../../../golang.org/x/sys/unix/syscall_unix_gc.go:14:6: missing function body for "RawSyscall"
../../../golang.org/x/sys/unix/syscall_unix_gc.go:15:6: missing function body for "RawSyscall6"

@ianlancetaylor
Copy link
Contributor

What happens with 1.9rc1 if you don't use -ldflags?

I don't understand how -ldflags could have anything to do with this. These errors are being reported by the compiler, before the linker has even been invoked.

I get exactly the same errors by running

GOOS=openbsd GOARCH=arm go build golang.org/x/sys/unix

I think this is just a problem with x/sys/unix, and I'm going to adjust it accordingly.

@ianlancetaylor ianlancetaylor changed the title cmd/go: build with ldflags broken on OpenBSD/arm x/sys/unix: openbsd/arm does not build Aug 1, 2017
@gopherbot gopherbot added this to the Unreleased milestone Aug 1, 2017
@ianlancetaylor
Copy link
Contributor

Looks like there is no support for openbsd/arm in golang.org/x/sys/unix at all.

CC @4a6f656c

@hacdias
Copy link
Author

hacdias commented Aug 1, 2017

@ianlancetaylor, yes, it doesn't build without ldflags too. I just tested it again with both 1.8.3 and 1.9rc1. I must have seen wrong.

@mikioh
Copy link
Contributor

mikioh commented Aug 2, 2017

Ah-ha, this is a duplicate issue of #10826.

@mikioh mikioh closed this as completed Aug 2, 2017
@cyberwave
Copy link

@hacdias
" Part of the problem at least is that we
filter out non ".go" files while building the package."

please click this link https://lists.hyperledger.org/pipermail/hyperledger-fabric/2017-June/001254.html
and see this version diff:

 ;;-----------------------------------------------------------------
 (defn- golang-src? [path]
   (when (-> (fs/extension path)
-            #{".go" ".c" ".h"})
+            #{".go" ".c" ".h" ".s"})
     true))
 
 ;;-----------------------------------------------------------------

@riptl
Copy link

riptl commented Feb 2, 2019

Happens with Go modules in go v11.1.4 for a different package:

$ go build
# golang.org/x/sys/unix
../../../../pkg/mod/golang.org/x/sys@v0.0.0-20181205085412-a5c9d58dba9a/unix/fcntl.go:26:42: undefined: Flock_t
../../../../pkg/mod/golang.org/x/sys@v0.0.0-20181205085412-a5c9d58dba9a/unix/ioctl.go:14:47: undefined: Winsize
../../../../pkg/mod/golang.org/x/sys@v0.0.0-20181205085412-a5c9d58dba9a/unix/ioctl.go:25:47: undefined: Termios
../../../../pkg/mod/golang.org/x/sys@v0.0.0-20181205085412-a5c9d58dba9a/unix/sockcmsg_unix.go:37:18: undefined: Cmsghdr
../../../../pkg/mod/golang.org/x/sys@v0.0.0-20181205085412-a5c9d58dba9a/unix/sockcmsg_unix.go:43:9: undefined: Cmsghdr

@golang golang locked and limited conversation to collaborators Feb 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-OpenBSD
Projects
None yet
Development

No branches or pull requests

7 participants