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/go: go build -a rebuilds standard library on linux #12203

Closed
leemcloughlin opened this issue Aug 19, 2015 · 10 comments
Closed

cmd/go: go build -a rebuilds standard library on linux #12203

leemcloughlin opened this issue Aug 19, 2015 · 10 comments

Comments

@leemcloughlin
Copy link

Just trying out the newly released go 1.5 on Linux (Ubuntu 14.04) and found that:

go build -v -a

reports rebuilding everything including every standard library file I use. Pre-1.5 the standard library wasn't mentioned. Note that when I ran the above "go build..." I did not have permission to write to /usr/local/go/

go build -v -a -x

shows standard library being rebuilt:

$ go build -v -a -x
WORK=/tmp/go-build359871788
runtime
mkdir -p $WORK/runtime/_obj/
mkdir -p $WORK/
cd /usr/local/go/src/runtime
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/runtime.a -trimpath $WORK -p runtime -+ -buildid 6d5354bd14cc24df376bca66e501e715c0c9847b -D _/usr/local/go/src/runtime -I $WORK -pack -asmhdr $WORK/runtime/_obj/go_asm.h ./alg.go ./arch1_amd64.go ./arch_amd64.go ./atomic_amd64x.go ./atomic_pointer.go ./cgo.go ./cgocall.go ./cgocallback.go ./chan.go ./compiler.go ./complex.go ./cpuprof.go ./cputicks.go ./debug.go ./defs_linux_amd64.go ./env_posix.go ./error.go ./extern.go ./hash64.go ./hashmap.go ./hashmap_fast.go ./heapdump.go ./iface.go ./lfstack.go ./lfstack_amd64.go ./lock_futex.go ./malloc.go ./mbarrier.go ./mbitmap.go ./mcache.go ./mcentral.go ./mem_linux.go ./mfinal.go ./mfixalloc.go ./mgc.go ./mgcmark.go ./mgcsweep.go ./mgcwork.go ./mheap.go ./mprof.go ./msize.go ./mstats.go ./netpoll.go ./netpoll_epoll.go ./os1_linux.go ./os2_linux.go ./os_linux.go ./panic.go ./panic1.go ./parfor.go ./print1.go ./print1_write.go ./proc.go ./proc1.go ./race0.go ./rdebug.go ./rune.go ./runtime.go ./runtime1.go ./runtime2.go ./select.go ./sema.go ./signal1_unix.go ./signal_amd64x.go ./signal_linux.go ./signal_linux_amd64.go ./signal_unix.go ./sigpanic_unix.go ./sigqueue.go ./slice.go ./softfloat64.go ./sqrt.go ./stack1.go ./stack2.go ./string.go ./string1.go ./stubs.go ./stubs2.go ./symtab.go ./sys_x86.go ./time.go ./trace.go ./traceback.go ./type.go ./typekind.go ./typekind1.go ./unaligned1.go ./vdso_linux_amd64.go ./wbfat.go ./zgoarch_amd64.go ./zgoos_linux.go ./zversion.go
/usr/local/go/pkg/tool/linux_amd64/asm -o $WORK/runtime/_obj/asm.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asm.s
/usr/local/go/pkg/tool/linux_amd64/asm -o $WORK/runtime/_obj/asm_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./asm_amd64.s
/usr/local/go/pkg/tool/linux_amd64/asm -o $WORK/runtime/_obj/duff_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./duff_amd64.s
/usr/local/go/pkg/tool/linux_amd64/asm -o $WORK/runtime/_obj/memclr_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./memclr_amd64.s
/usr/local/go/pkg/tool/linux_amd64/asm -o $WORK/runtime/_obj/memmove_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./memmove_amd64.s
/usr/local/go/pkg/tool/linux_amd64/asm -o $WORK/runtime/_obj/rt0_linux_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./rt0_linux_amd64.s
/usr/local/go/pkg/tool/linux_amd64/asm -o $WORK/runtime/_obj/sys_linux_amd64.o -trimpath $WORK -I $WORK/runtime/_obj/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./sys_linux_amd64.s
pack r $WORK/runtime.a $WORK/runtime/_obj/asm.o $WORK/runtime/_obj/asm_amd64.o $WORK/runtime/_obj/duff_amd64.o $WORK/runtime/_obj/memclr_amd64.o $WORK/runtime/_obj/memmove_amd64.o $WORK/runtime/_obj/rt0_linux_amd64.o $WORK/runtime/_obj/sys_linux_amd64.o # internal
...

$ go version
go version go1.5 linux/amd64

@ianlancetaylor ianlancetaylor added this to the Go1.5Maybe milestone Aug 19, 2015
@ianlancetaylor
Copy link
Contributor

In Go 1.5 "go build -a" will rebuild the standard library if the set of source files have changed. It should not rebuild if the time is out of date but the source files have not changed. How did you install the release?

CC @rsc

@leemcloughlin
Copy link
Author

Hi

I'm working in a VMWare Fusion guest running Ubuntu 14.04. The under Ubuntu seems OK but I ran ntpdate manually to be sure but it didn't help.

I extracted the download under a sudo shell in /usr/local with:

tar xvf ~/Downloads/go1.5.linux-amd64.tar.gz

I just tried against but this time with:

tar xpvf ~/Downloads/go1.5.linux-amd64.tar.gz

but the issue remains.

When I rebuild my gofarmhash package it tries to rebuild runtime. The files in pkg/linux_amd64/runtime are all newer than the files in src/runtime:

pkg/linux_amd64/runtime:
total 664
-rw-r--r-- 1 root root 48284 Aug 19 07:16 cgo.a
-rw-r--r-- 1 root root 58378 Aug 19 07:16 debug.a
-rw-r--r-- 1 root root 229382 Aug 19 07:16 pprof.a
-rw-r--r-- 1 root root 330828 Aug 19 07:16 race.a
-rw-r--r-- 1 root root 3802 Aug 19 07:16 trace.a

src/runtime/:
total 3168
-rw-r--r-- 1 root root 8567 Aug 19 07:05 alg.go
-rw-r--r-- 1 root root 4461 Aug 19 07:05 append_test.go
-rw-r--r-- 1 root root 399 Aug 19 07:05 arch1_386.go
-rw-r--r-- 1 root root 339 Aug 19 07:05 arch1_amd64.go
-rw-r--r-- 1 root root 371 Aug 19 07:05 arch1_amd64p32.go
-rw-r--r-- 1 root root 334 Aug 19 07:05 arch1_arm64.go
... (all the files here have the same timestamp)

but still they are rebuilt.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.5.1, Go1.5Maybe Aug 19, 2015
@ianlancetaylor
Copy link
Contributor

Do you have GOROOT set in the environment?

If not, what do you see in the directory printed by "go env GOROOT"?

@leemcloughlin
Copy link
Author

Hi

I dont have GOROOT set in my environment

$ go env GOROOT
/usr/local/go
$ ls -l $(go env GOROOT)
total 128
drwxr-xr-x 2 root root 4096 Aug 19 07:05 api
-rw-r--r-- 1 root root 21139 Aug 19 07:05 AUTHORS
drwxr-xr-x 2 root root 4096 Aug 19 07:16 bin
drwxr-xr-x 4 root root 4096 Aug 19 07:16 blog
-rw-r--r-- 1 root root 1107 Aug 19 07:05 CONTRIBUTING.md
-rw-r--r-- 1 root root 28953 Aug 19 07:05 CONTRIBUTORS
drwxr-xr-x 8 root root 4096 Aug 19 07:05 doc
-rw-r--r-- 1 root root 1150 Aug 19 07:05 favicon.ico
drwxr-xr-x 3 root root 4096 Aug 19 07:05 lib
-rw-r--r-- 1 root root 1479 Aug 19 07:05 LICENSE
drwxr-xr-x 13 root root 4096 Aug 19 07:16 misc
-rw-r--r-- 1 root root 1303 Aug 19 07:05 PATENTS
drwxr-xr-x 7 root root 4096 Aug 19 07:16 pkg
-rw-r--r-- 1 root root 1519 Aug 19 07:05 README.md
-rw-r--r-- 1 root root 26 Aug 19 07:05 robots.txt
drwxr-xr-x 43 root root 4096 Aug 19 07:05 src
drwxr-xr-x 16 root root 12288 Aug 19 07:15 test

@leemcloughlin
Copy link
Author

I just deleted /usr/local/go, reinstalled go 1.4.2 and "go build -v -a" does not build the system libraries. So it is unlikely to be an issue with my system causing the problem with go 1.5

@leemcloughlin
Copy link
Author

I believe its actually now the expected behaviour after reading:

https://go-review.googlesource.com/#/c/10761/ cmd/go: make -a apply to the standard library, like in Go 1.3

So consider this issue closed

@mikioh mikioh changed the title go 1.5 build -a rebuilds standard library on linux cmd/go: go build -a rebuilds standard library on linux Aug 20, 2015
@ianlancetaylor ianlancetaylor self-assigned this Aug 21, 2015
@gopherbot
Copy link

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

@mikioh mikioh reopened this Aug 22, 2015
@bradfitz
Copy link
Contributor

@mikioh, why are you re-opening this? The new behavior is intentional. @ianlancetaylor is just fixing a documentation bug.

@mikioh
Copy link
Contributor

mikioh commented Aug 22, 2015

I see, CL 13799 is just an update.

@mikioh mikioh closed this as completed Aug 22, 2015
ianlancetaylor added a commit that referenced this issue Aug 27, 2015
This changed in https://golang.org/cl/10761.

Update #12203.

Change-Id: Ia37ebb7ecba689ad3cb2559213d675f21cf03a95
Reviewed-on: https://go-review.googlesource.com/13799
Reviewed-by: Russ Cox <rsc@golang.org>
@gopherbot
Copy link

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

ianlancetaylor added a commit that referenced this issue Sep 8, 2015
This changed in https://golang.org/cl/10761.

Update #12203.

Change-Id: Ia37ebb7ecba689ad3cb2559213d675f21cf03a95
Reviewed-on: https://go-review.googlesource.com/13799
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-on: https://go-review.googlesource.com/14226
Reviewed-by: Minux Ma <minux@golang.org>
@golang golang locked and limited conversation to collaborators Sep 4, 2016
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