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/internal/dwarf: Can't run executables w/ debug info on FreeBSD 9.1 #20850

Closed
MichaelMonashev opened this issue Jun 29, 2017 · 30 comments
Closed
Labels
Documentation FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-FreeBSD
Milestone

Comments

@MichaelMonashev
Copy link

Please answer these questions before submitting your issue. Thanks!

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

master from https://go.googlesource.com/go
+
go version go1.4-bootstrap-20170531 freebsd/amd64

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

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH=""
GORACE=""
GOROOT="/usr/home/xxx/go1.4"
GOTOOLDIR="/usr/home/xxx/go1.4/pkg/tool/freebsd_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

What did you do?

Try to install go from source.

What did you expect to see?

Successful installation

What did you see instead?

xxx@xxx/home/xxx/go/src>./all.bash

Building Go bootstrap tool.

cmd/dist

Building Go toolchain using /home/xxx/go1.4.

bootstrap/cmd/internal/dwarf
bootstrap/cmd/internal/objabi
bootstrap/cmd/internal/src
bootstrap/cmd/internal/sys
bootstrap/cmd/asm/internal/flags
bootstrap/cmd/internal/bio
bootstrap/math/bits
bootstrap/cmd/internal/gcprog
bootstrap/cmd/compile/internal/syntax
bootstrap/debug/pe
bootstrap/math/big
bootstrap/cmd/internal/obj
bootstrap/cmd/asm/internal/lex
bootstrap/cmd/link/internal/ld
bootstrap/cmd/internal/obj/arm
bootstrap/cmd/internal/obj/arm64
bootstrap/cmd/internal/obj/mips
bootstrap/cmd/internal/obj/ppc64
bootstrap/cmd/internal/obj/s390x
bootstrap/cmd/internal/obj/x86
bootstrap/cmd/compile/internal/types
bootstrap/cmd/asm/internal/arch
bootstrap/cmd/compile/internal/ssa
bootstrap/cmd/asm/internal/asm
bootstrap/cmd/asm
bootstrap/cmd/link/internal/amd64
bootstrap/cmd/link/internal/arm
bootstrap/cmd/link/internal/arm64
bootstrap/cmd/link/internal/mips
bootstrap/cmd/link/internal/mips64
bootstrap/cmd/link/internal/ppc64
bootstrap/cmd/link/internal/s390x
bootstrap/cmd/link/internal/x86
bootstrap/cmd/link
bootstrap/cmd/compile/internal/gc
bootstrap/cmd/compile/internal/amd64
bootstrap/cmd/compile/internal/arm
bootstrap/cmd/compile/internal/arm64
bootstrap/cmd/compile/internal/mips
bootstrap/cmd/compile/internal/mips64
bootstrap/cmd/compile/internal/ppc64
bootstrap/cmd/compile/internal/s390x
bootstrap/cmd/compile/internal/x86
bootstrap/cmd/compile

Building go_bootstrap for host, freebsd/amd64.

runtime/internal/sys
runtime/internal/atomic
runtime
encoding
errors
internal/cpu
internal/race
internal/syscall/windows/sysdll
math/bits
sync/atomic
unicode
unicode/utf16
unicode/utf8
math
sync
internal/singleflight
io
syscall
cmd/go/internal/web
hash
bytes
strings
hash/adler32
bufio
strconv
path
internal/syscall/windows
internal/syscall/windows/registry
time
reflect
encoding/base64
crypto
crypto/sha1
internal/poll
os
os/signal
sort
encoding/binary
fmt
container/heap
regexp/syntax
path/filepath
io/ioutil
context
flag
go/token
log
cmd/go/internal/str
net/url
text/template/parse
compress/flate
encoding/xml
encoding/json
debug/dwarf
os/exec
go/scanner
regexp
cmd/internal/objabi
go/ast
compress/zlib
text/template
debug/macho
debug/elf
go/parser
go/doc
go/build
cmd/go/internal/cfg
cmd/go/internal/base
cmd/go/internal/buildid
cmd/go/internal/cmdflag
cmd/go/internal/doc
cmd/go/internal/help
cmd/go/internal/load
cmd/go/internal/tool
cmd/go/internal/version
cmd/go/internal/fix
cmd/go/internal/fmtcmd
cmd/go/internal/work
cmd/go/internal/clean
cmd/go/internal/envcmd
cmd/go/internal/generate
cmd/go/internal/get
cmd/go/internal/list
cmd/go/internal/run
cmd/go/internal/test
cmd/go/internal/vet
cmd/go/internal/bug
cmd/go

Building packages and commands for freebsd/amd64.

runtime/internal/sys
runtime/internal/atomic
runtime
errors
internal/cpu
internal/race
unicode
sync/atomic
unicode/utf8
container/list
math/bits
container/ring
crypto/subtle
math
crypto/internal/cipherhw
internal/nettrace
sync
vendor/golang_org/x/crypto/poly1305
vendor/golang_org/x/crypto/curve25519
encoding
unicode/utf16
image/color
internal/syscall/windows
internal/syscall/windows/registry
internal/syscall/windows/sysdll
plugin
runtime/race
vendor/golang_org/x/text/secure
vendor/golang_org/x/text/unicode
cmd/compile/internal/test
cmd/vet/internal/whitelist
image/color/palette
io
syscall
internal/singleflight
bytes
strings
hash
crypto/cipher
runtime/trace
hash/adler32
hash/crc32
crypto/hmac
strconv
math/rand
hash/crc64
hash/fnv
math/cmplx
path
html
bufio
text/tabwriter
vendor/golang_org/x/text/transform
reflect
cmd/internal/src
encoding/base64
crypto/rc4
crypto
crypto/aes
encoding/ascii85
encoding/base32
crypto/sha512
crypto/md5
crypto/sha1
crypto/sha256
image
time
image/internal/imageutil
image/draw
image/jpeg
internal/poll
os
sort
encoding/binary
regexp/syntax
compress/bzip2
encoding/pem
container/heap
fmt
path/filepath
vendor/golang_org/x/net/route
os/signal
runtime/debug
cmd/internal/sys
crypto/des
vendor/golang_org/x/crypto/chacha20poly1305/internal/chacha20
io/ioutil
vendor/golang_org/x/crypto/chacha20poly1305
regexp
flag
log
debug/dwarf
compress/flate
debug/gosym
debug/plan9obj
cmd/vendor/golang.org/x/arch/arm/armasm
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm
cmd/vendor/golang.org/x/arch/x86/x86asm
archive/tar
cmd/internal/objabi
cmd/internal/goobj
compress/lzw
compress/zlib
archive/zip
compress/gzip
context
math/big
encoding/hex
go/token
encoding/csv
os/exec
go/scanner
database/sql/driver
encoding/gob
debug/elf
debug/macho
debug/pe
go/ast
database/sql
encoding/json
encoding/xml
vendor/golang_org/x/net/http2/hpack
cmd/internal/objfile
go/parser
crypto/dsa
crypto/elliptic
encoding/asn1
crypto/rand
go/printer
crypto/rsa
vendor/golang_org/x/text/unicode/bidi
cmd/addr2line
vendor/golang_org/x/text/unicode/norm
crypto/ecdsa
crypto/x509/pkix
net/url
mime
mime/quotedprintable
net/http/internal
text/template/parse
vendor/golang_org/x/text/secure/bidirule
go/constant
text/scanner
image/gif
image/png
index/suffixarray
cmd/cgo
go/format
testing
go/types
internal/trace
runtime/pprof
text/template
vendor/golang_org/x/net/idna
net/internal/socktest
runtime/pprof/internal/profile
testing/internal/testdeps
testing/iotest
testing/quick
internal/testenv
cmd/internal/dwarf
cmd/asm/internal/flags
cmd/internal/bio
cmd/asm/internal/lex
cmd/internal/obj
cmd/compile/internal/syntax
cmd/internal/gcprog
cmd/internal/browser
cmd/dist
cmd/fix
go/doc
html/template
cmd/internal/obj/arm
go/build
cmd/internal/obj/arm64
cmd/internal/obj/mips
cmd/internal/obj/ppc64
cmd/internal/obj/s390x
cmd/internal/obj/x86
cmd/compile/internal/types
runtime/cgo
go/internal/gccgoimporter
go/internal/gcimporter
go/internal/srcimporter
cmd/api
cmd/cover
cmd/doc
cmd/go/internal/cfg
cmd/go/internal/str
go/importer
cmd/go/internal/base
cmd/go/internal/buildid
cmd/gofmt
cmd/go/internal/doc
cmd/go/internal/load
cmd/go/internal/help
cmd/go/internal/cmdflag
cmd/go/internal/tool
cmd/go/internal/version
cmd/link/internal/ld
cmd/asm/internal/arch
cmd/asm/internal/asm
cmd/compile/internal/ssa
cmd/go/internal/work
net
os/user
cmd/go/internal/fix
cmd/go/internal/fmtcmd
cmd/nm
cmd/objdump
cmd/asm
cmd/pack
cmd/vendor/github.com/google/pprof/internal/elfexec
cmd/vendor/github.com/google/pprof/profile
cmd/vendor/github.com/ianlancetaylor/demangle
cmd/vendor/github.com/google/pprof/third_party/svg
cmd/vendor/github.com/google/pprof/internal/proftest
cmd/vet/internal/cfg
cmd/vet
cmd/go/internal/envcmd
cmd/go/internal/clean
cmd/go/internal/generate
cmd/go/internal/list
cmd/go/internal/run
cmd/go/internal/test
cmd/go/internal/vet
cmd/vendor/github.com/google/pprof/internal/plugin
cmd/vendor/github.com/google/pprof/internal/measurement
cmd/vendor/github.com/google/pprof/internal/symbolz
cmd/vendor/github.com/google/pprof/internal/graph
cmd/vendor/github.com/google/pprof/internal/binutils
cmd/vendor/github.com/google/pprof/internal/report
vendor/golang_org/x/net/lex/httplex
vendor/golang_org/x/net/proxy
crypto/x509
net/textproto
log/syslog
vendor/golang_org/x/net/nettest
mime/multipart
net/mail
crypto/tls
cmd/link/internal/amd64
cmd/link/internal/arm
cmd/link/internal/arm64
cmd/link/internal/mips
cmd/link/internal/mips64
cmd/link/internal/ppc64
cmd/link/internal/s390x
cmd/link/internal/x86
cmd/link
net/http/httptrace
net/smtp
net/http
net/http/cgi
net/http/cookiejar
expvar
net/http/httptest
net/http/httputil
net/http/pprof
net/rpc
cmd/go/internal/web
cmd/vendor/github.com/google/pprof/internal/symbolizer
cmd/trace
net/rpc/jsonrpc
net/http/fcgi
cmd/go/internal/bug
cmd/go/internal/get
cmd/vendor/github.com/google/pprof/internal/driver
cmd/go
cmd/vendor/github.com/google/pprof/driver
cmd/pprof
cmd/compile/internal/gc
cmd/compile/internal/arm
cmd/compile/internal/mips
cmd/compile/internal/arm64
cmd/compile/internal/amd64
cmd/compile/internal/mips64
cmd/compile/internal/ppc64
cmd/compile/internal/s390x
cmd/compile/internal/x86
cmd/compile

run.bash: line 8: /home/xxx/go/bin/go: cannot execute binary file: Exec format error
run.bash: line 47: /home/xxx/go/bin/go: cannot execute binary file: Exec format error
run.bash: line 47: /home/xxx/go/bin/go: No error: 0
xxx@xxx/home/xxx/go/src>

@bradfitz bradfitz changed the title Can`t install Go from source on FreeBSD 9.1 freebsd: Can't install Go from source on FreeBSD 9.1 Jun 29, 2017
@bradfitz bradfitz added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-FreeBSD labels Jun 29, 2017
@bradfitz
Copy link
Contributor

Per https://github.com/golang/go/wiki/MinimumRequirements#freebsd this should work, but we only test FreeBSD 10.1 and 11.0.

Maybe 9.1 support rotted. I forget.

@bradfitz bradfitz added this to the Go1.9Maybe milestone Jun 29, 2017
@MichaelMonashev
Copy link
Author

MichaelMonashev commented Jun 29, 2017

I tried to change gcc version:
CC=/usr/local/bin/gcc48
CXX=/usr/local/bin/g++48

But problem still exist.

@MichaelMonashev
Copy link
Author

MichaelMonashev commented Jun 29, 2017

I tried to build older version of Go. This is maximum version, that builds:
go version go1.4.3 freebsd/amd64

All later Go versions have installation problem.

@bradfitz
Copy link
Contributor

Do you have COMPAT_FREEBSD32 set? IIRC, that might be required.

@MichaelMonashev
Copy link
Author

I have this kernel option:

>sysctl kern.conftxt | grep COMPAT_FREEBSD32
options COMPAT_FREEBSD32

@MichaelMonashev
Copy link
Author

>uname -a
FreeBSD xxx 9.1-RELEASE-p22 FreeBSD 9.1-RELEASE-p22 #0: Mon Nov  3 18:22:10 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

@mikioh mikioh changed the title freebsd: Can't install Go from source on FreeBSD 9.1 runtime, syscall: Can't install Go from source on FreeBSD 9.1 Jun 29, 2017
@mikioh
Copy link
Contributor

mikioh commented Jun 29, 2017

Probably #6372.

FreeBSD 9.1 doesn't have the fix for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=182161, and the latest go source tree dropped the workaround 555da73

@MichaelMonashev
Copy link
Author

MichaelMonashev commented Jun 29, 2017

I added this line

#define SYSCALL MOVQ R10, CX; INT $0x80

into the src/runtime/sys_freebsd_amd64.s and tried to compile go again, but problem still exist.

@bradfitz
Copy link
Contributor

@mikioh, I really doubt it. That would be a problem at run time. The error he's getting is:

/home/xxx/go/bin/go: cannot execute binary file: Exec format error

... which sounds like the FreeBSD kernel doesn't even like our produced binaries.

@MichaelMonashev
Copy link
Author

MichaelMonashev commented Jun 29, 2017

which sounds like the FreeBSD kernel doesn't even like our produced binaries.

You're right. This is the reason, while I build Go from the source.

@MichaelMonashev
Copy link
Author

>fetch https://storage.googleapis.com/golang/go1.8.3.freebsd-amd64.tar.gz
>sudo tar -C /usr/local -xzf go1.8.3.freebsd-amd64.tar.gz
>/usr/local/go/bin/go version
/usr/local/go/bin/go: Exec format error. Binary file not executable.
>file /usr/local/go/bin/go
/usr/local/go/bin/go: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), not stripped
>ldd /usr/local/go/bin/go
/usr/local/go/bin/go:
ldd: /usr/local/go/bin/go: Exec format error
/usr/local/go/bin/go: exit status 1
>ldd ~/go1.4/bin/go
/home/michael/go1.4/bin/go:
        libthr.so.3 => /lib/libthr.so.3 (0x800c88000)
        libc.so.7 => /lib/libc.so.7 (0x800eaa000)
>ldd ~/go1.4.bootsrap/bin/go
/home/michael/go1.4.bootsrap/bin/go:
        libthr.so.3 => /lib/libthr.so.3 (0x800c88000)
        libc.so.7 => /lib/libc.so.7 (0x800eaa000)

@bradfitz
Copy link
Contributor

From @rsc on golang-dev:

Before it was hijacked for the more general question, #19002 was about FreeBSD 9 support. Based on the full discussion there, especially #19002 (comment), it sounds like we should announce in the Go 1.9 notes that this is the last release supporting FreeBSD 9. That's assuming we can get FreeBSD 9 working at all.

@bradfitz
Copy link
Contributor

@MichaelMonashev, build.golang.org shows that we're still passing all the tests on FreeBSD 9.3.

I guess we require FreeBSD 9.3, but I don't remember why.

@bradfitz
Copy link
Contributor

@gopherbot
Copy link

CL https://golang.org/cl/47252 mentions this issue.

@MichaelMonashev
Copy link
Author

Brad, does Go 1.8.3. work on FreeBSD 9.3 ?

@bradfitz
Copy link
Contributor

Yes.

@cherrymui
Copy link
Member

/usr/local/go/bin/go version
/usr/local/go/bin/go: Exec format error. Binary file not executable.

@MichaelMonashev
I just wonder, does /usr/local/go/bin/gofmt run?

@MichaelMonashev
Copy link
Author

MichaelMonashev commented Jun 29, 2017

gofmt from https://storage.googleapis.com/golang/go1.8.3.freebsd-amd64.tar.gz works fine:

>/usr/local/go/bin/gofmt -h
usage: gofmt [flags] [path ...]
  -cpuprofile string
        write cpu profile to this file
  -d    display diffs instead of rewriting files
  -e    report all errors (not just the first 10 on different lines)
  -l    list files whose formatting differs from gofmt's
  -r string
        rewrite rule (e.g., 'a[b:len(a)] -> a[b:]')
  -s    simplify code
  -w    write result to (source) file instead of stdout

this is very strange.

@cherrymui
Copy link
Member

Interesting. gofmt is a static binary generated by the Go linker, whereas go binary is dynamic and generated by external linker (gcc). I guess CGO_ENABLED=0 ./all.bash also works?

Probably there are some flags we need to set for gcc on FreeBSD 9.1?

@stevenh
Copy link
Contributor

stevenh commented Jun 29, 2017

Try running the problem go through ktrace and see if that sheds any light

ktrace /home/xxx/go/bin/go
kdump

@MichaelMonashev
Copy link
Author

Sorry, I upgraded OS to FreeBSD 9.3.

gopherbot pushed a commit that referenced this issue Jun 29, 2017
FreeBSD 9.3.
Add Linux arm64. (required second line)
Clarify glibc requirement now that we have second line in notes.
OS X to macOS

Updates #20850

Change-Id: I684d464ed32a072081726b7c805a346c22c42f97
Reviewed-on: https://go-review.googlesource.com/47252
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@MichaelMonashev
Copy link
Author

go1.8.3 works fine on FreeBDS 9.3

@MichaelMonashev
Copy link
Author

MichaelMonashev commented Jun 30, 2017

I found one more FreeBSD 9.1 installation.

>fetch https://storage.googleapis.com/golang/go1.8.3.freebsd-amd64.tar.gz
>sudo tar -C /usr/local -xzf go1.8.3.freebsd-amd64.tar.gz
>/usr/local/go/bin/go
/usr/local/go/bin/go: Exec format error. Binary file not executable.
>ktrace /usr/local/go/bin/go
/usr/local/go/bin/go: 1: Syntax error: ")" unexpected
>kdump
 35203 ktrace   RET   ktrace 0
 35203 ktrace   CALL  execve(0x7fffffffdd57,0x7fffffffdb10,0x7fffffffdb20)
 35203 ktrace   NAMI  "/usr/local/go/bin/go"
 35203 ktrace   RET   execve -1 errno 8 Exec format error
 35203 ktrace   CALL  execve(0x80091d4e2,0x7fffffffd4c0,0x7fffffffdb20)
 35203 ktrace   NAMI  "/bin/sh"
 35203 ktrace   NAMI  "/libexec/ld-elf.so.1"
 35203 sh       RET   execve 0
 35203 sh       CALL  mmap(0,0x8000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 35203 sh       RET   mmap 34366263296/0x800639000
 35203 sh       CALL  issetugid
 35203 sh       RET   issetugid 0
 35203 sh       CALL  lstat(0x80063d000,0x7fffffffc520)
 35203 sh       NAMI  "/etc"
 35203 sh       STRU  struct stat {dev=112, ino=32769, mode=drwxr-xr-x , nlink=22, uid=0, gid=0, rdev=133432, atime=1327428268, stime=1496841390, ctime=1496841390, birthtime=1326189662, size=2560, blksize=16384, blocks=8, flags=0x0 }
 35203 sh       RET   lstat 0
 35203 sh       CALL  lstat(0x80063d000,0x7fffffffc520)
 35203 sh       NAMI  "/etc/libmap.conf"
 35203 sh       RET   lstat -1 errno 2 No such file or directory
 35203 sh       CALL  open(0x8006332e5,0<O_RDONLY>,<unused>0x2f)
 35203 sh       NAMI  "/var/run/ld-elf.so.hints"
 35203 sh       RET   open 3
 35203 sh       CALL  read(0x3,0x7fffffffcf20,0x80)
 35203 sh       GIO   fd 3 read 128 bytes
       0x0000 4568 6e74 0100 0000 8000 0000 7200 0000 0000 0000 7100 0000 0000 0000 0000 0000 0000 0000 0000  |Ehnt........r.......q.................|
       0x0026 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  |......................................|
       0x004c 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  |......................................|
       0x0072 0000 0000 0000 0000 0000 0000 0000                                                              |..............|

 35203 sh       RET   read 128/0x80
 35203 sh       CALL  lseek(0x3,0x80,SEEK_SET)
 35203 sh       RET   lseek 128/0x80
 35203 sh       CALL  read(0x3,0x80063e000,0x72)
 35203 sh       GIO   fd 3 read 114 bytes
       "/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat/pkg:/usr/local/lib/compat:/usr/local/lib/mysql\0"
 35203 sh       RET   read 114/0x72
 35203 sh       CALL  close(0x3)
 35203 sh       RET   close 0
 35203 sh       CALL  access(0x80063d000,0<F_OK>)
 35203 sh       NAMI  "/lib/libedit.so.7"
 35203 sh       RET   access 0
 35203 sh       CALL  open(0x80063a080,0<O_RDONLY>,<unused>0x839ac0)
 35203 sh       NAMI  "/lib/libedit.so.7"
 35203 sh       RET   open 3
 35203 sh       CALL  fstat(0x3,0x7fffffffd1b0)
 35203 sh       STRU  struct stat {dev=112, ino=17307, mode=-r--r--r-- , nlink=1, uid=0, gid=0, rdev=77560, atime=1493294069, stime=1383649101, ctime=1383649101, birthtime=1383649101, size=151088, blksize=16384, blocks=296, flags=0x0 }
 35203 sh       RET   fstat 0
 35203 sh       CALL  mmap(0,0x1000,0x1<PROT_READ>,0x40002<MAP_PRIVATE>,0x3,0)
 35203 sh       RET   mmap 34366296064/0x800641000
 35203 sh       CALL  mmap(0,0x228000,0<PROT_NONE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)
 35203 sh       RET   mmap 34368364544/0x80083a000
 35203 sh       CALL  mmap(0x80083a000,0x22000,0x5<PROT_READ|PROT_EXEC>,0x60012<MAP_PRIVATE|MAP_FIXED|MAP_NOCORE>,0x3,0)
 35203 sh       RET   mmap 34368364544/0x80083a000
 35203 sh       CALL  mmap(0x800a5c000,0x2000,0x3<PROT_READ|PROT_WRITE>,0x40012<MAP_PRIVATE|MAP_FIXED>,0x3,0x22000)
 35203 sh       RET   mmap 34370600960/0x800a5c000
 35203 sh       CALL  mmap(0x800a5e000,0x4000,0x3<PROT_READ|PROT_WRITE>,0x1012<MAP_PRIVATE|MAP_FIXED|MAP_ANON>,0xffffffff,0)
 35203 sh       RET   mmap 34370609152/0x800a5e000
 35203 sh       CALL  munmap(0x800641000,0x1000)
 35203 sh       RET   munmap 0
 35203 sh       CALL  close(0x3)
 35203 sh       RET   close 0
 35203 sh       CALL  access(0x80063d000,0<F_OK>)
 35203 sh       NAMI  "/lib/libncurses.so.8"
 35203 sh       RET   access 0
 35203 sh       CALL  open(0x80063a0e0,0<O_RDONLY>,<unused>0x839ac0)
 35203 sh       NAMI  "/lib/libncurses.so.8"
 35203 sh       RET   open 3
 35203 sh       CALL  fstat(0x3,0x7fffffffd1b0)
 35203 sh       STRU  struct stat {dev=112, ino=17321, mode=-r--r--r-- , nlink=1, uid=0, gid=0, rdev=77792, atime=1493294069, stime=1383649102, ctime=1383649102, birthtime=1383649102, size=325136, blksize=16384, blocks=672, flags=0x0 }
 35203 sh       RET   fstat 0
 35203 sh       CALL  mmap(0,0x1000,0x1<PROT_READ>,0x40002<MAP_PRIVATE>,0x3,0)
 35203 sh       RET   mmap 34366296064/0x800641000
 35203 sh       CALL  mmap(0,0x24e000,0<PROT_NONE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)
 35203 sh       RET   mmap 34370625536/0x800a62000
 35203 sh       CALL  mmap(0x800a62000,0x49000,0x5<PROT_READ|PROT_EXEC>,0x60012<MAP_PRIVATE|MAP_FIXED|MAP_NOCORE>,0x3,0)
 35203 sh       RET   mmap 34370625536/0x800a62000
 35203 sh       CALL  mmap(0x800cab000,0x5000,0x3<PROT_READ|PROT_WRITE>,0x40012<MAP_PRIVATE|MAP_FIXED>,0x3,0x49000)
 35203 sh       RET   mmap 34373021696/0x800cab000
 35203 sh       CALL  munmap(0x800641000,0x1000)
 35203 sh       RET   munmap 0
 35203 sh       CALL  close(0x3)
 35203 sh       RET   close 0
 35203 sh       CALL  access(0x80063d000,0<F_OK>)
 35203 sh       NAMI  "/lib/libc.so.7"
 35203 sh       RET   access 0
 35203 sh       CALL  open(0x80063a120,0<O_RDONLY>,<unused>0x839ac0)
 35203 sh       NAMI  "/lib/libc.so.7"
 35203 sh       RET   open 3
 35203 sh       CALL  fstat(0x3,0x7fffffffd1b0)
 35203 sh       STRU  struct stat {dev=112, ino=16465, mode=-r--r--r-- , nlink=1, uid=0, gid=0, rdev=74632, atime=1493294069, stime=1383649099, ctime=1383649100, birthtime=1383649099, size=1369840, blksize=16384, blocks=2720, flags=0x0 }
 35203 sh       RET   fstat 0
 35203 sh       CALL  mmap(0,0x1000,0x1<PROT_READ>,0x40002<MAP_PRIVATE>,0x3,0)
 35203 sh       RET   mmap 34366296064/0x800641000
 35203 sh       CALL  mmap(0,0x353000,0<PROT_NONE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)
 35203 sh       RET   mmap 34373042176/0x800cb0000
 35203 sh       CALL  mmap(0x800cb0000,0x12e000,0x5<PROT_READ|PROT_EXEC>,0x60012<MAP_PRIVATE|MAP_FIXED|MAP_NOCORE>,0x3,0)
 35203 sh       RET   mmap 34373042176/0x800cb0000
 35203 sh       CALL  mmap(0x800fdd000,0xb000,0x3<PROT_READ|PROT_WRITE>,0x40012<MAP_PRIVATE|MAP_FIXED>,0x3,0x12d000)
 35203 sh       RET   mmap 34376372224/0x800fdd000
 35203 sh       CALL  mmap(0x800fe8000,0x1b000,0x3<PROT_READ|PROT_WRITE>,0x1012<MAP_PRIVATE|MAP_FIXED|MAP_ANON>,0xffffffff,0)
 35203 sh       RET   mmap 34376417280/0x800fe8000
 35203 sh       CALL  munmap(0x800641000,0x1000)
 35203 sh       RET   munmap 0
 35203 sh       CALL  close(0x3)
 35203 sh       RET   close 0
 35203 sh       CALL  munmap(0x800640000,0x1000)
 35203 sh       RET   munmap 0
 35203 sh       CALL  mmap(0,0xa000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 35203 sh       RET   mmap 34366291968/0x800640000
 35203 sh       CALL  munmap(0x800646000,0x4000)
 35203 sh       RET   munmap 0
 35203 sh       CALL  mmap(0,0x19000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 35203 sh       RET   mmap 34366316544/0x800646000
 35203 sh       CALL  sysarch(0x81,0x7fffffffd290)
 35203 sh       RET   sysarch 0
 35203 sh       CALL  sigprocmask(SIG_BLOCK,0x8008399a0,0x7fffffffd250)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_SETMASK,0x8008399b0,0)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_BLOCK,0x8008399a0,0x7fffffffd210)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_SETMASK,0x8008399b0,0)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_BLOCK,0x8008399a0,0x7fffffffd210)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_SETMASK,0x8008399b0,0)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_BLOCK,0x8008399a0,0x7fffffffd210)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_SETMASK,0x8008399b0,0)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_BLOCK,0x8008399a0,0x7fffffffd210)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  sigprocmask(SIG_SETMASK,0x8008399b0,0)
 35203 sh       RET   sigprocmask 0
 35203 sh       CALL  getpid
 35203 sh       RET   getpid 35203/0x8983
 35203 sh       CALL  geteuid
 35203 sh       RET   geteuid 1002/0x3ea
 35203 sh       CALL  getppid
 35203 sh       RET   getppid 33667/0x8383
 35203 sh       CALL  readlink(0x800db7799,0x7fffffffd430,0x400)
 35203 sh       NAMI  "/etc/malloc.conf"
 35203 sh       RET   readlink -1 errno 2 No such file or directory
 35203 sh       CALL  issetugid
 35203 sh       RET   issetugid 0
 35203 sh       CALL  break(0x800000)
 35203 sh       RET   break 0
 35203 sh       CALL  mmap(0,0x400000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 35203 sh       RET   mmap 34376527872/0x801003000
 35203 sh       CALL  mmap(0x801403000,0x3fd000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 35203 sh       RET   mmap 34380722176/0x801403000
 35203 sh       CALL  munmap(0x801003000,0x3fd000)
 35203 sh       RET   munmap 0
 35203 sh       CALL  getuid
 35203 sh       RET   getuid 1002/0x3ea
 35203 sh       CALL  geteuid
 35203 sh       RET   geteuid 1002/0x3ea
 35203 sh       CALL  getgid
 35203 sh       RET   getgid 1002/0x3ea
 35203 sh       CALL  getegid
 35203 sh       RET   getegid 1002/0x3ea
 35203 sh       CALL  open(0x7fffffffdd5b,0<O_RDONLY>,<unused>0xffffffffffffdb18)
 35203 sh       NAMI  "/usr/local/go/bin/go"
 35203 sh       RET   open 3
 35203 sh       CALL  fcntl(0x3,F_DUPFD,0xa)
 35203 sh       RET   fcntl 10/0xa
 35203 sh       CALL  close(0x3)
 35203 sh       RET   close 0
 35203 sh       CALL  fcntl(0xa,F_SETFD,FD_CLOEXEC)
 35203 sh       RET   fcntl 0
 35203 sh       CALL  sigaction(SIGINT,0,0x7fffffffd9d0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  sigaction(SIGINT,0x7fffffffd9f0,0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  sigaction(SIGQUIT,0,0x7fffffffd9d0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  sigaction(SIGQUIT,0x7fffffffd9f0,0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  sigaction(SIGTERM,0,0x7fffffffd9d0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  sigaction(SIGTERM,0x7fffffffd9f0,0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  sigaction(SIGWINCH,0,0x7fffffffd9d0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  sigaction(SIGWINCH,0x7fffffffd9f0,0)
 35203 sh       RET   sigaction 0
 35203 sh       CALL  stat(0x41b1a0,0x7fffffffd9c0)
 35203 sh       NAMI  "."
 35203 sh       STRU  struct stat {dev=100, ino=6547457, mode=drwxr-xr-x , nlink=28, uid=1002, gid=1002, rdev=26152848, atime=1212250308, stime=1498806921, ctime=1498806921, birthtime=1212215580, size=6656, blksize=16384, blocks=16, flags=0x0 }
 35203 sh       RET   stat 0
 35203 sh       CALL  stat(0x7fffffffdefe,0x7fffffffd940)
 35203 sh       NAMI  "/home/michael"
 35203 sh       STRU  struct stat {dev=100, ino=6547457, mode=drwxr-xr-x , nlink=28, uid=1002, gid=1002, rdev=26152848, atime=1212250308, stime=1498806921, ctime=1498806921, birthtime=1212215580, size=6656, blksize=16384, blocks=16, flags=0x0 }
 35203 sh       RET   stat 0
 35203 sh       CALL  read(0xa,0x623880,0x3ff)
 35203 sh       GIO   fd 10 read 1023 bytes
       0x0000 7f45 4c46 0201 0109 0000 0000 0000 0000 0200 3e00 0100 0000 f05a 4500 0000 0000 4000 0000 0000  |.ELF..............>......ZE.....@.....|
       0x0026 0000 0002 0000 0000 0000 0000 0000 4000 3800 0800 4000 2400 0900 0600 0000 0400 0000 4000 0000  |..............@.8...@.$...........@...|
       0x004c 0000 0000 4000 4000 0000 0000 4000 4000 0000 0000 c001 0000 0000 0000 c001 0000 0000 0000 0010  |....@.@.....@.@.......................|
       0x0072 0000 0000 0000 0300 0000 0400 0000 eb0f 0000 0000 0000 eb0f 4000 0000 0000 eb0f 4000 0000 0000  |........................@.......@.....|
       0x0098 1500 0000 0000 0000 1500 0000 0000 0000 0100 0000 0000 0000 0400 0000 0400 0000 b00f 0000 0000  |......................................|
       0x00be 0000 b00f 4000 0000 0000 b00f 4000 0000 0000 3800 0000 0000 0000 3800 0000 0000 0000 0400 0000  |....@.......@.....8.......8...........|
       0x00e4 0000 0000 0100 0000 0500 0000 0000 0000 0000 0000 0000 4000 0000 0000 0000 4000 0000 0000 40e9  |......................@.......@.....@.|
       0x010a 3b00 0000 0000 40e9 3b00 0000 0000 0010 0000 0000 0000 0100 0000 0400 0000 00f0 3b00 0000 0000  |;.....@.;.......................;.....|
       0x0130 00f0 7b00 0000 0000 00f0 7b00 0000 0000 cab7 2900 0000 0000 cab7 2900 0000 0000 0010 0000 0000  |..{.......{.......).......)...........|
       0x0156 0000 0100 0000 0600 0000 00b0 6500 0000 0000 00b0 a500 0000 0000 00b0 a500 0000 0000 e08d 0300  |............e.........................|
       0x017c 0000 0000 80c0 0500 0000 0000 0010 0000 0000 0000 0200 0000 0600 0000 e0b0 6500 0000 0000 e0b0  |..............................e.......|
       0x01a2 a500 0000 0000 e0b0 a500 0000 0000 3001 0000 0000 0000 3001 0000 0000 0000 0800 0000 0000 0000  |..............0.......0...............|
       0x01c8 0700 0000 0400 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  |......................................|
       0x01ee 0000 0800 0000 0000 0000 0800 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  |......................................|
       0x0214 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  |......................................|
       0x023a 0000 0000 0000 0100 0000 0100 0000 0600 0000 0000 0000 0010 4000 0000 0000 0010 0000 0000 0000  |........................@.............|
       0x0260 c0d7 3b00 0000 0000 0000 0000 0000 0000 1000 0000 0000 0000 0000 0000 0000 0000 4c01 0000 0100  |..;.............................L.....|
       0x0286 0000 0600 0000 0000 0000 c0e7 7b00 0000 0000 c0e7 3b00 0000 0000 8001 0000 0000 0000 0000 0000  |............{.......;.................|
       0x02ac 0000 0000 1000 0000 0000 0000 1000 0000 0000 0000 4700 0000 0100 0000 0200 0000 0000 0000 00f0  |....................G.................|
       0x02d2 7b00 0000 0000 00f0 3b00 0000 0000 d04f 1200 0000 0000 0000 0000 0000 0000 2000 0000 0000 0000  |{.......;......O.............. .......|
       0x02f8 0000 0000 0000 0000 3c01 0000 0400 0000 0200 0000 0000 0000 d03f 8e00 0000 0000 d03f 4e00 0000  |........<................?.......?N...|
       0x031e 0000 1800 0000 0000 0000 0b00 0000 0000 0000 0800 0000 0000 0000 1800 0000 0000 0000 4201 0000  |..................................B...|
       0x0344 0400 0000 0200 0000 0000 0000 e83f 8e00 0000 0000 e83f 4e00 0000 0000 2802 0000 0000 0000 0b00  |.............?.......?N.....(.........|
       0x036a 0000 0200 0000 0800 0000 0000 0000 1800 0000 0000 0000 5101 0000 ffff ff6f 0200 0000 0000 0000  |......................Q......o........|
       0x0390 2042 8e00 0000 0000 2042 4e00 0000 0000 3c00 0000 0000 0000 0b00 0000 0000 0000 0200 0000 0000  | B...... BN.....<.....................|
       0x03b6 0000 0200 0000 0000 0000 5e01 0000 feff ff6f 0200 0000 0000 0000 6042 8e00 0000 0000 6042 4e00  |..........^......o........`B......`BN.|
       0x03dc 0000 0000 4000 0000 0000 0000 0a00 0000 0200 0000 0800 0000 0000 0000 0000 0000 0000 00         |....@..............................|

 35203 sh       RET   read 1023/0x3ff
 35203 sh       CALL  madvise(0x801411000,0x1000,MADV_FREE)
 35203 sh       RET   madvise 0
 35203 sh       CALL  madvise(0x801411000,0x1000,MADV_FREE)
 35203 sh       RET   madvise 0
 35203 sh       CALL  write(0x2,0x801421100,0x36)
 35203 sh       GIO   fd 2 wrote 54 bytes
       "/usr/local/go/bin/go: 1: Syntax error: ")" unexpected
       "
 35203 sh       RET   write 54/0x36
 35203 sh       CALL  exit(0x2)

@MichaelMonashev
Copy link
Author

@cherrymui , you're right. Go build fine with CGO_ENABLED=0 .

@mikioh mikioh changed the title runtime, syscall: Can't install Go from source on FreeBSD 9.1 runtime/cgo: Can't install Go from source on FreeBSD 9.1 Jun 30, 2017
@mikioh
Copy link
Contributor

mikioh commented Jun 30, 2017

@MichaelMonashev,

I guess that 1) the output of readelf on the executable image and 2) kernel loader warnings in /var/log/messages can tell us a bit more what's going on.

@MichaelMonashev
Copy link
Author

>tar -C 111 -xzf go1.8.3.freebsd-amd64.tar.gz
>readelf --all ./111/go/bin/go

readelf output here: https://gist.githubusercontent.com/MichaelMonashev/32e4246462eefece1803be123091697c/raw/55a95b126997471dd5cf8c756a9a5314d4771038/readelf.out

@MichaelMonashev
Copy link
Author

/var/log/messages and /var/log/all have not related massages

@mikioh mikioh changed the title runtime/cgo: Can't install Go from source on FreeBSD 9.1 cmd/internal/dwarf: Can't run executables w/ debug info on FreeBSD 9.1 Jul 6, 2017
@mikioh
Copy link
Contributor

mikioh commented Jul 6, 2017

@MichaelMonashev,

Thanks for the information. Looks like FreeBSD has changed the format of debug information within executable images in between FreeBSD 9.1 and some point, FreeBSD 9.[23] or 10.0? Searching Dwarf Error: wrong version in compilation unit header (is 4, should be 2) may display you more hints and details.

I guess that there's nothing to do with this issue except writing some caveat to Go 1.9 release notes.

@bradfitz
Copy link
Contributor

bradfitz commented Jul 6, 2017

I've already updated https://tip.golang.org/doc/install in 25de52e so that's probably sufficient.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-FreeBSD
Projects
None yet
Development

No branches or pull requests

6 participants