moovweb / gvm

Go Version Manager
http://github.com/moovweb/gvm
MIT License
9.91k stars 522 forks source link

Installation not working #340

Open piotrkochan opened 4 years ago

piotrkochan commented 4 years ago

Fresh Ubuntu 18 LTS without any go installed:

gvm install go1.4
Downloading Go source...
Installing go1.4...
 * Compiling...
/home/bamboo/.gvm/scripts/install: line 84: go: command not found
ERROR: Failed to compile. Check the logs at /home/bamboo/.gvm/logs/go-go1.4-compile.log
ERROR: Failed to use installed version
gvm install go1.14 -pb -b
Installing go1.14...
 * Compiling...
/home/bamboo/.gvm/scripts/install: line 84: go: command not found
ERROR: Failed to compile. Check the logs at /home/bamboo/.gvm/logs/go-go1.14-compile.log
ERROR: Failed to use installed version
gvm install go1.14 -pb -B
Installing go1.14 from binary source
ERROR: Failed to extract binary go
piotrkochan commented 4 years ago

Logs:

# Building C bootstrap tool.
cmd/dist

# Building compilers and Go bootstrap tool for host, linux/amd64.
lib9
/home/bamboo/.gvm/gos/go1.4/src/lib9/fmt/fltfmt.c: In function '__efgfmt':
/home/bamboo/.gvm/gos/go1.4/src/lib9/fmt/fltfmt.c:437:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
   if(ndigits > prec) {
     ^
/home/bamboo/.gvm/gos/go1.4/src/lib9/fmt/fltfmt.c:451:2: note: here
  default:
  ^~~~~~~
cc1: all warnings being treated as errors
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m64 -I /home/bamboo/.gvm/gos/go1.4/include -DPLAN9PORT -I /home/bamboo/.gvm/gos/go1.4/src/lib9 -o $WORK/fltfmt.o /home/bamboo/.gvm/gos/go1.4/src/lib9/fmt/fltfmt.c
agiwalpooja20-zz commented 4 years ago

I am seeing same issue

mkumarjha commented 4 years ago

Facing same issue Downloading https://dl.google.com/go/gogo1.14.linux-amd64.tar.gz... failed Error: Get https://dl.google.com/go/gogo1.14.linux-amd64.tar.gz: dial tcp: lookup dl.google.com on [::1]:53: dial udp [::1]:53: socket: permission denied

lucianomda commented 4 years ago

I am trying a new installation on macos 10.15.4, I didn't have golang installed in my system, I went directly for a new installation with gvm. When I run gvm install go1.4 -B it seems to work. If I run gvm list I see

gvm gos (installed)

=> go1.4

But if I run go version I see this error

failed MSpanList_Insert 0x12be000 0x7c94ae0bd811 0x0
fatal error: MSpanList_Insert

runtime stack:
runtime.throw(0x7ffa6b)
    /usr/local/go/src/runtime/panic.go:491 +0xad fp=0x7ffeefbfec70 sp=0x7ffeefbfec40
runtime.MSpanList_Insert(0x82af28, 0x12be000)
    /usr/local/go/src/runtime/mheap.c:692 +0x8f fp=0x7ffeefbfec98 sp=0x7ffeefbfec70
MHeap_FreeSpanLocked(0x827b20, 0x12be000, 0x100)
    /usr/local/go/src/runtime/mheap.c:583 +0x163 fp=0x7ffeefbfecd8 sp=0x7ffeefbfec98
MHeap_Grow(0x827b20, 0x8, 0x0)
    /usr/local/go/src/runtime/mheap.c:420 +0x1a8 fp=0x7ffeefbfed18 sp=0x7ffeefbfecd8
MHeap_AllocSpanLocked(0x827b20, 0x1, 0x1230a00)
    /usr/local/go/src/runtime/mheap.c:298 +0x365 fp=0x7ffeefbfed58 sp=0x7ffeefbfed18
mheap_alloc(0x827b20, 0x1, 0x7f0000000012, 0x7fff6a60e297)
    /usr/local/go/src/runtime/mheap.c:190 +0x121 fp=0x7ffeefbfed80 sp=0x7ffeefbfed58
runtime.MHeap_Alloc(0x827b20, 0x1, 0x10000000012, 0x977a9)
    /usr/local/go/src/runtime/mheap.c:240 +0x66 fp=0x7ffeefbfedb8 sp=0x7ffeefbfed80
MCentral_Grow(0x82f898, 0x122d000)
    /usr/local/go/src/runtime/mcentral.c:197 +0x8b fp=0x7ffeefbfee20 sp=0x7ffeefbfedb8
runtime.MCentral_CacheSpan(0x82f898, 0x7ffeefbfee90)
    /usr/local/go/src/runtime/mcentral.c:85 +0x167 fp=0x7ffeefbfee58 sp=0x7ffeefbfee20
runtime.MCache_Refill(0x12ba000, 0x12, 0x7ffeefbfeeb0)
    /usr/local/go/src/runtime/mcache.c:90 +0xa0 fp=0x7ffeefbfee80 sp=0x7ffeefbfee58
runtime.mcacheRefill_m()
    /usr/local/go/src/runtime/malloc.c:368 +0x57 fp=0x7ffeefbfeea0 sp=0x7ffeefbfee80
runtime.onM(0x6a2870)
    /usr/local/go/src/runtime/asm_amd64.s:273 +0x9a fp=0x7ffeefbfeea8 sp=0x7ffeefbfeea0
runtime.mallocgc(0x120, 0x590240, 0x0, 0x0)
    /usr/local/go/src/runtime/malloc.go:178 +0x85b fp=0x7ffeefbfef58 sp=0x7ffeefbfeea8
runtime.newobject(0x590240, 0x12ba000)
    /usr/local/go/src/runtime/malloc.go:353 +0x49 fp=0x7ffeefbfef80 sp=0x7ffeefbfef58
runtime.newG(0xb17fa)
    /usr/local/go/src/runtime/proc.go:233 +0x2a fp=0x7ffeefbfef98 sp=0x7ffeefbfef80
allocg(0x817ac0)
    /usr/local/go/src/runtime/proc.c:925 +0x1f fp=0x7ffeefbfefa8 sp=0x7ffeefbfef98
runtime.malg(0x8000, 0x817e40)
    /usr/local/go/src/runtime/proc.c:2106 +0x1f fp=0x7ffeefbfefd8 sp=0x7ffeefbfefa8
runtime.mpreinit(0x818680)
    /usr/local/go/src/runtime/os_darwin.c:137 +0x27 fp=0x7ffeefbfeff0 sp=0x7ffeefbfefd8
mcommoninit(0x818680)
    /usr/local/go/src/runtime/proc.c:201 +0xc9 fp=0x7ffeefbff018 sp=0x7ffeefbfeff0
runtime.schedinit()
    /usr/local/go/src/runtime/proc.c:138 +0x6e fp=0x7ffeefbff040 sp=0x7ffeefbff018
runtime.rt0_go(0x7ffeefbff078, 0x2, 0x7ffeefbff078, 0x0, 0x0, 0x2, 0x7ffeefbff2b8, 0x7ffeefbff2bb, 0x0, 0x7ffeefbff2c3, ...)
    /usr/local/go/src/runtime/asm_amd64.s:95 +0x116 fp=0x7ffeefbff048 sp=0x7ffeefbff040
johnlhamilton commented 4 years ago

@lucianomda This appears to be an issue with go1.4 on certain versions of macos: https://github.com/golang/go/issues/17182

I was able to get it to work by bootstrapping with go1.7.1 instead of 1.4:

gvm install go1.7.1 -B
gvm use go1.7.1
export GOROOT_BOOTSTRAP=$GOROOT

I can then gvm install later versions of Go.

lucianomda commented 4 years ago

@johnlhamilton thanks for the reply, it works for me too. Now I can finally get rid of my go instalation via homebrew 😃

ghost commented 3 years ago

@johnlhamilton Seems that issue was hijacked. The original problem is that gvm can't install go on Linux instances without Go already installed. I just tried this in Kali as well, and ran into the same issue. Installing the "golang" package with aptitude fixes the problem but that sort of defeats the purpose of having gvm. I'd rather not have a default system installation as a dependency to a tool that is supposed to enable seamless Go development.

I read a little bit of the shell scripts and have a basic understanding of how gvm works, although I'm fuzzy on how Go is compiled from source. The error from @piotrkochan is weird considering that Go is needed to compile Go?

gvm install go1.4
Downloading Go source...
Installing go1.4...
 * Compiling...
/home/bamboo/.gvm/scripts/install: line 84: go: command not found

Here is the problem code:

compile_go() {
    display_message " * Compiling..."
    [ -z "$GOROOT_BOOTSTRAP" ] && export GOROOT_BOOTSTRAP=$(go env GOROOT) 
piotrkochan commented 3 years ago

In my opinion gvm should download local built go and use it rather than require global one.

niedz., 2 sie 2020, 22:41 użytkownik Brian Thompson < notifications@github.com> napisał:

@johnlhamilton https://github.com/johnlhamilton Seems that issue was hijacked. The original problem is that gvm can't install go on Linux instances without Go already installed. I just tried this in Kali as well, and ran into the same issue. Installing the "golang" package with aptitude fixes the problem but that sort of defeats the purpose of having gvm. I'd rather not have a default system installation as a dependency to a tool that is supposed to enable seamless Go development.

I read a little bit of the shell scripts and have a basic understanding of how gvm works, although I'm fuzzy on how Go is compiled from source. The error from @piotrkochan https://github.com/piotrkochan is weird considering that Go is needed to compile Go?

gvm install go1.4 Downloading Go source... Installing go1.4...

  • Compiling... /home/bamboo/.gvm/scripts/install: line 84: go: command not found

Here is the problem code:

compile_go() { display_message " * Compiling..." [ -z "$GOROOT_BOOTSTRAP" ] && export GOROOT_BOOTSTRAP=$(go env GOROOT)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/moovweb/gvm/issues/340#issuecomment-667722247, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK7F6IUREZA2B2MIAHNHVDR6XFQNANCNFSM4LSR5R7Q .

johnlhamilton commented 3 years ago

@enyrgy You're right, the problem reported by @lucianomda is a separate issue from the original. I apologize for the thread hijack.

For the original problem, it looks like @piotrkochan is trying to follow the bootstrapping instructions in the readme here. The third command they tried (with the -B flag) is the correct one, but I don't know what would be causing it to fail with ERROR: Failed to extract binary go.

FWIW, you shouldn't need a non-gvm installation of Go but you do need to install a version of Go from binary (with gvm) to bootstrap future from-source Go builds as described in the README linked above.

ghost commented 3 years ago

@johnlhamilton no worries, just didn't want to lose track of the original issue.

FWIW, you shouldn't need a non-gvm installation of Go but you do need to install a version of Go from binary (with gvm) to bootstrap future from-source Go builds as described in the README linked above.

Ok, that makes sense. Does the documentation need to be updated to include that? First-time Go users would probably find it beneficial.

laoshaw commented 3 years ago

on ubuntu 20.04 with go1.14.2 installed(not via gvm), I just installed gvm and dod 'gvm install go1.14.6' and it worked well.

johnlhamilton commented 3 years ago

@enyrgy the README already covers this in the section A Note on Compiling Go 1.5+. But, it could probably be clarified some. That section makes it sound like you MUST bootstrap with Go 1.4, but any version >= 1.4 should work as long as you install it with the -B option.

biot commented 3 years ago

Note that gvm install go1.4 -B only works if you're on an x86 system. It will happily install an i386 binary on an ARM system, but that's not going to solve any problem.

jcollum commented 2 years ago

@piotrkochan @johnlhamilton added a section to the readme for this