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/fix: doesn't build into pkg/tool/<arch>/fix #3049

Closed
patrickmn opened this issue Feb 17, 2012 · 10 comments
Closed

cmd/fix: doesn't build into pkg/tool/<arch>/fix #3049

patrickmn opened this issue Feb 17, 2012 · 10 comments

Comments

@patrickmn
Copy link

What steps will reproduce the problem?
1. Try to run 'go fix'

What is the expected output?
None/fixes

What do you see instead?
exec: "/home/patrick/apps/go/pkg/tool/linux_amd64/fix": stat
/home/patrick/apps/go/pkg/tool/linux_amd64/fix: no such file or directory

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Linux

Which revision are you using?  (hg identify)
b984f2b4aa91 tip

Please provide any additional information below.
fix is in bin/

Only GOPATH is set.
@dsymonds
Copy link
Contributor

Comment 1:

I can't reproduce this locally. Can you detail your exact build steps? Do you not have
any of GOOS/GOARCH/GOROOT set?

Status changed to WaitingForReply.

@patrickmn
Copy link
Author

Comment 2:

Only GOPATH is set. No GOOS/GOARCH/GOROOT.
I noticed this after I cleaned out the go dir, pulled tip, and built from scratch. It's
possible that fix is built correctly when upgrading, or maybe you actually have an older
binary? I wouldn't have noticed if I hadn't cleaned out.
Just did it again:
# echo $GOOS
# echo $GOARCH
# echo $GOROOT
# export | grep GO
declare -x GOPATH="/home/patrick/apps/go:/home/patrick/projects/go"
# cd ~/apps
# rm -rf go
# hg clone -u tip https://go.googlecode.com/hg/ go
requesting all changes
adding changesets
adding manifests
adding file changes
added 12103 changesets with 46366 changes to 6321 files (+4 heads)
updating to branch default
3275 files updated, 0 files merged, 0 files removed, 0 files unresolved
# cd go/src
# ./all.bash
# Building C bootstrap tool.
cmd/dist
# Building compilers and Go bootstrap tool for host, linux/amd64.
lib9
libbio
libmach
misc/pprof
cmd/cov
cmd/nm
cmd/pack
cmd/prof
cmd/cc
cmd/gc
cmd/6l
cmd/6a
cmd/6c
cmd/6g
pkg/runtime
pkg/errors
pkg/sync/atomic
pkg/sync
pkg/io
pkg/unicode
pkg/unicode/utf8
pkg/unicode/utf16
pkg/bytes
pkg/math
pkg/strings
pkg/strconv
pkg/bufio
pkg/sort
pkg/container/heap
pkg/encoding/base64
pkg/syscall
pkg/time
pkg/os
pkg/reflect
pkg/fmt
pkg/encoding/json
pkg/flag
pkg/path/filepath
pkg/path
pkg/io/ioutil
pkg/log
pkg/regexp/syntax
pkg/regexp
pkg/go/token
pkg/go/scanner
pkg/go/ast
pkg/go/parser
pkg/go/build
pkg/os/exec
pkg/net/url
pkg/text/template/parse
pkg/text/template
pkg/go/doc
cmd/go
# Building packages and commands for linux/amd64.
runtime
errors
sync/atomic
unicode
math
crypto/subtle
sync
container/list
container/ring
image/color
io
syscall
hash
crypto
crypto/md5
hash/crc32
unicode/utf8
unicode/utf16
bytes
strings
path
bufio
text/tabwriter
crypto/cipher
crypto/hmac
time
crypto/sha1
hash/adler32
crypto/sha256
crypto/sha512
exp/norm
exp/terminal
exp/utf8string
os
hash/crc64
hash/fnv
html
old/regexp
strconv
sort
math/rand
math/cmplx
path/filepath
container/heap
compress/bzip2
os/signal
io/ioutil
reflect
regexp/syntax
net/url
os/exec
encoding/base64
regexp
crypto/aes
crypto/rc4
encoding/pem
archive/tar
encoding/ascii85
encoding/base32
image
fmt
encoding/binary
image/draw
image/jpeg
debug/dwarf
crypto/des
index/suffixarray
go/token
flag
log
go/scanner
text/template/parse
debug/elf
go/ast
text/template
debug/macho
debug/pe
encoding/json
go/parser
go/doc
go/build
go/printer
compress/flate
math/big
cmd/api
cmd/cgo
cmd/fix
compress/gzip
mime
crypto/rand
crypto/elliptic
crypto/rsa
crypto/dsa
encoding/asn1
runtime/debug
archive/zip
crypto/x509/pkix
crypto/x509
encoding/gob
encoding/xml
runtime/cgo
runtime/pprof
text/scanner
cmd/gofmt
cmd/vet
cmd/yacc
net
compress/lzw
compress/zlib
crypto/ecdsa
database/sql/driver
debug/gosym
encoding/csv
database/sql
encoding/hex
exp/ebnf
exp/types
exp/html
exp/ebnflint
exp/gotype
exp/inotify
html/template
image/gif
image/png
old/template
os/user
testing
testing/iotest
crypto/tls
net/textproto
exp/proxy
mime/multipart
log/syslog
net/mail
old/netchan
testing/quick
net/http
net/smtp
cmd/go
expvar
net/http/pprof
net/http/cgi
net/http/httptest
cmd/godoc
net/http/fcgi
net/http/httputil
net/rpc
net/rpc/jsonrpc
# Testing packages.
ok      cmd/api 0.009s
?       cmd/cgo [no test files]
ok      cmd/fix 1.321s
?       cmd/go  [no test files]
?       cmd/godoc   [no test files]
ok      cmd/gofmt   0.049s
?       cmd/vet [no test files]
?       cmd/yacc    [no test files]
ok      archive/tar 0.005s
ok      archive/zip 0.041s
ok      bufio   0.055s
ok      bytes   0.031s
ok      compress/bzip2  0.054s
ok      compress/flate  2.335s
ok      compress/gzip   0.007s
ok      compress/lzw    0.030s
ok      compress/zlib   0.102s
ok      container/heap  0.005s
ok      container/list  0.005s
ok      container/ring  0.015s
?       crypto  [no test files]
ok      crypto/aes  0.035s
ok      crypto/cipher   0.006s
ok      crypto/des  0.026s
ok      crypto/dsa  0.010s
ok      crypto/ecdsa    0.041s
ok      crypto/elliptic 0.011s
ok      crypto/hmac 0.007s
ok      crypto/md5  0.005s
ok      crypto/rand 0.034s
ok      crypto/rc4  0.005s
ok      crypto/rsa  0.106s
ok      crypto/sha1 0.005s
ok      crypto/sha256   0.005s
ok      crypto/sha512   0.006s
ok      crypto/subtle   0.009s
ok      crypto/tls  0.147s
ok      crypto/x509 0.404s
?       crypto/x509/pkix    [no test files]
ok      database/sql    0.009s
ok      database/sql/driver 0.005s
ok      debug/dwarf 0.007s
ok      debug/elf   0.009s
ok      debug/gosym 0.125s
ok      debug/macho 0.005s
ok      debug/pe    0.006s
ok      encoding/ascii85    0.006s
ok      encoding/asn1   0.007s
ok      encoding/base32 0.005s
ok      encoding/base64 0.005s
ok      encoding/binary 0.006s
ok      encoding/csv    0.005s
ok      encoding/gob    0.038s
ok      encoding/hex    0.005s
ok      encoding/json   0.078s
ok      encoding/pem    0.008s
ok      encoding/xml    0.014s
ok      errors  0.005s
ok      exp/ebnf    0.005s
ok      exp/ebnflint    0.007s
ok      exp/gotype  0.161s
ok      exp/html    0.023s
ok      exp/inotify 1.282s
ok      exp/norm    0.905s
ok      exp/proxy   0.006s
ok      exp/terminal    0.003s
ok      exp/types   0.135s
ok      exp/utf8string  0.005s
ok      expvar  0.015s
ok      flag    0.004s
ok      fmt 0.017s
ok      go/ast  0.005s
ok      go/build    0.007s
ok      go/doc  0.069s
ok      go/parser   0.040s
ok      go/printer  0.283s
ok      go/scanner  0.006s
ok      go/token    0.050s
?       hash    [no test files]
ok      hash/adler32    0.004s
ok      hash/crc32  0.005s
ok      hash/crc64  0.005s
ok      hash/fnv    0.005s
ok      html    0.008s
ok      html/template   0.052s
ok      image   0.534s
ok      image/color 0.013s
ok      image/draw  0.033s
?       image/gif   [no test files]
ok      image/jpeg  0.083s
ok      image/png   0.052s
ok      index/suffixarray   0.016s
ok      io  0.019s
ok      io/ioutil   0.027s
ok      log 0.006s
ok      log/syslog  0.208s
ok      math    0.006s
ok      math/big    0.609s
ok      math/cmplx  0.005s
ok      math/rand   0.445s
ok      mime    0.005s
ok      mime/multipart  0.174s
ok      net 0.832s
ok      net/http    2.093s
ok      net/http/cgi    0.234s
ok      net/http/fcgi   0.009s
ok      net/http/httptest   0.009s
ok      net/http/httputil   0.013s
?       net/http/pprof  [no test files]
ok      net/mail    0.005s
ok      net/rpc 0.041s
ok      net/rpc/jsonrpc 0.012s
ok      net/smtp    0.005s
ok      net/textproto   0.006s
ok      net/url 0.006s
ok      old/netchan 1.282s
ok      old/regexp  0.016s
ok      old/template    0.020s
ok      os  0.013s
ok      os/exec 0.099s
ok      os/signal   0.004s
ok      os/user 0.006s
ok      path    0.005s
ok      path/filepath   0.008s
ok      reflect 0.007s
ok      regexp  0.081s
ok      regexp/syntax   0.735s
ok      runtime 0.310s
?       runtime/cgo [no test files]
ok      runtime/debug   0.022s
ok      runtime/pprof   0.336s
ok      sort    0.068s
ok      strconv 0.067s
ok      strings 0.011s
ok      sync    0.058s
ok      sync/atomic 0.121s
?       syscall [no test files]
?       testing [no test files]
?       testing/iotest  [no test files]
ok      testing/quick   0.030s
ok      text/scanner    0.007s
ok      text/tabwriter  0.007s
ok      text/template   0.016s
ok      text/template/parse 0.008s
ok      time    1.209s
ok      unicode 0.008s
ok      unicode/utf16   0.004s
ok      unicode/utf8    0.012s
?       unsafe  [no test files]
real    0m22.129s
user    1m3.200s
sys 0m9.545s
# runtime -cpu=1,2,4
ok      runtime 0.600s
# sync -cpu=10
ok      sync    0.909s
--- cd ../test
0 known bugs; 0 unexpected bugs
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/patrick/apps/go
Installed commands in /home/patrick/apps/go/bin
# cd ~/projects/go/src/github.com/pmylund/go-cache/
# go fix
exec: "/home/patrick/apps/go/pkg/tool/linux_amd64/fix": stat
/home/patrick/apps/go/pkg/tool/linux_amd64/fix: no such file or directory
# ls -la ~/apps/go/bin
total 28M
drwxrwxr-x  2 patrick patrick 4.0K 2012-02-18 05:45 ./
drwxrwxr-x 11 patrick patrick 4.0K 2012-02-18 05:45 ../
-rwxrwxr-x  1 patrick patrick 3.3M 2012-02-18 05:45 api*
-rwxrwxr-x  1 patrick patrick 3.0M 2012-02-18 05:45 cgo*
-rwxrwxr-x  1 patrick patrick 3.0M 2012-02-18 05:45 fix*
-rwxrwxr-x  1 patrick patrick 5.6M 2012-02-18 05:45 go*
-rwxrwxr-x  1 patrick patrick 6.5M 2012-02-18 05:45 godoc*
-rwxrwxr-x  1 patrick patrick 2.4M 2012-02-18 05:45 gofmt*
-rwxrwxr-x  1 patrick patrick 2.2M 2012-02-18 05:45 vet*
-rwxrwxr-x  1 patrick patrick 1.6M 2012-02-18 05:45 yacc*
# ls -la ~/apps/go/pkg/tool/linux_amd64/
total 9.5M
drwxrwxr-x 2 patrick patrick 4.0K 2012-02-18 05:45 ./
drwxrwxr-x 3 patrick patrick 4.0K 2012-02-18 05:45 ../
-rwxrwxr-x 1 patrick patrick 274K 2012-02-18 05:45 6a*
-rwxrwxr-x 1 patrick patrick 852K 2012-02-18 05:45 6c*
-rwxrwxr-x 1 patrick patrick 1.5M 2012-02-18 05:45 6g*
-rwxrwxr-x 1 patrick patrick 781K 2012-02-18 05:45 6l*
-rwxrwxr-x 1 patrick patrick 525K 2012-02-18 05:45 cov*
-rwxrwxr-x 1 patrick patrick 141K 2012-02-18 05:45 dist*
-rwxrwxr-x 1 patrick patrick 1.6M 2012-02-18 05:45 ebnflint*
-rwxrwxr-x 1 patrick patrick 2.5M 2012-02-18 05:45 gotype*
-rwxrwxr-x 1 patrick patrick 345K 2012-02-18 05:45 nm*
-rwxrwxr-x 1 patrick patrick 306K 2012-02-18 05:45 pack*
-rw-rw-r-- 1 patrick patrick 153K 2012-02-18 05:45 pprof
-rwxrwxr-x 1 patrick patrick 522K 2012-02-18 05:45 prof*

@patrickmn
Copy link
Author

Comment 3:

Oh, it works if GOPATH doesn't include the path to go. Then api, fix, vet and yacc
correctly appear in pkg/tool/linux_amd64 and not bin/.
I added the go dir to GOPATH to avoid cluttering my projects folder.
PEBKAC?

@patrickmn
Copy link
Author

Comment 4:

Correction: api, cgo, fix, vet, yacc appear in go/bin when GOPATH includes /path/to/go.
When it does not, they appear in pkg/tool/<arch>.

@dsymonds
Copy link
Contributor

Comment 5:

I believe GOROOT is meant to point to the Go tree proper, at least when building Go; if
that's the case it should not matter whether GOPATH includes GOROOT too. So perhaps this
is just user error, though this whole setup is underdocumented. If this situation is
invalid, it should at least be diagnosed in make.bash

Labels changed: added go1-must, documentation, toolbug, removed priority-triage.

Owner changed to @rsc.

Status changed to Accepted.

@patrickmn
Copy link
Author

Comment 6:

Good point. http://tip.golang.org/install/ does mention that if the location of Go is
custom, GOROOT should be set. However, http://golang.org/doc/install.html says that it
is not mandatory--so surely others will run into this.
It seems like it would be easy to set GOROOT automatically in e.g. all.bash?
I just tested again with:
# export | grep GO
declare -x GOPATH="/home/patrick/apps/go:/home/patrick/projects/go"
declare -x GOROOT="/home/patrick/apps/go"
# cd ~/apps/go/src
# ./all.bash
...
# ls -la ~/apps/go/bin
total 28M
drwxrwxr-x  2 patrick patrick 4.0K 2012-02-18 06:28 ./
drwxrwxr-x 11 patrick patrick 4.0K 2012-02-18 06:28 ../
-rwxrwxr-x  1 patrick patrick 3.3M 2012-02-18 06:28 api*
-rwxrwxr-x  1 patrick patrick 3.0M 2012-02-18 06:28 cgo*
-rwxrwxr-x  1 patrick patrick 3.0M 2012-02-18 06:28 fix*
-rwxrwxr-x  1 patrick patrick 5.6M 2012-02-18 06:28 go*
-rwxrwxr-x  1 patrick patrick 6.5M 2012-02-18 06:28 godoc*
-rwxrwxr-x  1 patrick patrick 2.4M 2012-02-18 06:28 gofmt*
-rwxrwxr-x  1 patrick patrick 2.2M 2012-02-18 06:28 vet*
-rwxrwxr-x  1 patrick patrick 1.6M 2012-02-18 06:28 yacc*
# ls -la ~/apps/go/pkg/tool/linux_amd64/
total 9.5M
drwxrwxr-x 2 patrick patrick 4.0K 2012-02-18 06:28 ./
drwxrwxr-x 3 patrick patrick 4.0K 2012-02-18 06:28 ../
-rwxrwxr-x 1 patrick patrick 274K 2012-02-18 06:28 6a*
-rwxrwxr-x 1 patrick patrick 852K 2012-02-18 06:28 6c*
-rwxrwxr-x 1 patrick patrick 1.5M 2012-02-18 06:28 6g*
-rwxrwxr-x 1 patrick patrick 781K 2012-02-18 06:28 6l*
-rwxrwxr-x 1 patrick patrick 525K 2012-02-18 06:28 cov*
-rwxrwxr-x 1 patrick patrick 141K 2012-02-18 06:28 dist*
-rwxrwxr-x 1 patrick patrick 1.6M 2012-02-18 06:28 ebnflint*
-rwxrwxr-x 1 patrick patrick 2.5M 2012-02-18 06:28 gotype*
-rwxrwxr-x 1 patrick patrick 345K 2012-02-18 06:28 nm*
-rwxrwxr-x 1 patrick patrick 306K 2012-02-18 06:28 pack*
-rw-rw-r-- 1 patrick patrick 153K 2012-02-18 06:28 pprof
-rwxrwxr-x 1 patrick patrick 522K 2012-02-18 06:28 prof*
api, cgo, fix, vet and yacc still incorrectly appear in go/bin when the go dir is in
GOPATH.

@rsc
Copy link
Contributor

rsc commented Feb 20, 2012

Comment 7:

Labels changed: added priority-go1.

@robpike
Copy link
Contributor

robpike commented Feb 26, 2012

Comment 8:

Issue #3128 has been merged into this issue.

@rsc
Copy link
Contributor

rsc commented Mar 1, 2012

Comment 9:

Fixed as of a461bcce05f6

Status changed to Fixed.

@gopherbot
Copy link

Comment 10 by christianchristensen:

Documenting my installation on Ubuntu (in case this might help someone else...):
(the takeaway for me was `export GOROOT="/usr/lib/go"` as the install directory for go
from `apt-get install golang`)
```sh
$ export GOROOT="/usr/lib/go"
$ export GOPATH="$HOME/gocode"
$ export PATH="$GOPATH/bin:$PATH"
$ go env
GOROOT="/usr/lib/go"
GOBIN=""
GOARCH="amd64"
GOCHAR="6"
GOOS="linux"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CGO_ENABLED="1"
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.2 LTS
Release:        12.04
Codename:       precise
```

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants