moovweb / gvm

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

gvm install go1.16 requires go to already be installed #369

Open darkn3rd opened 3 years ago

darkn3rd commented 3 years ago

Description

Installing go requires that go is already installed.

Steps to Reproduce

  1. Using Ubuntu 20.04
    cat <<-EOF > Vagrantfile
    Vagrant.configure("2") do |config|
      config.vm.box = "generic/ubuntu2004"
    end
    EOF
    vagrant up
    vagrant ssh
  2. Install gvm
    sudo apt-get install -y binutils bison gcc make
    bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
    source ~/.gvm/scripts/gvm
    gvm install go1.16

Expected Results

go1.16 would be installed

Actual Results

I get this error:

Downloading Go source...
Installing go1.16...
 * Compiling...
/home/vagrant/.gvm/scripts/install: line 84: go: command not found
ERROR: Failed to compile. Check the logs at /home/vagrant/.gvm/logs/go-go1.16-compile.log
ERROR: Failed to use installed version

And looking at the compile log:

cat $HOME/.gvm/logs/go-go1.16-compile.log
ERROR: Cannot find /home/vagrant/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
mh-cbon commented 3 years ago

https://github.com/moovweb/gvm#a-note-on-compiling-go-15

roadev commented 3 years ago

https://github.com/moovweb/gvm#a-note-on-compiling-go-15

I get this error when trying to follow those steps:

gvm install go1.4 -B
Installing go1.4 from binary source
ERROR: Binary Go unavailable for this platform

I'm using MacOS Big Sur

mh-cbon commented 3 years ago

https://github.com/moovweb/gvm#installing-go

There is a list of switches, you might want to read the documentation carefully.

bishgupp commented 3 years ago

I am late to the party, but ...

Building C bootstrap tool.

cmd/dist

Building compilers and Go bootstrap tool for host, darwin/amd64.

lib9 libbio liblink cmd/cc cmd/gc cmd/6l /Users/pebishop/.gvm/gos/go1.4/src/cmd/6l/../ld/dwarf.c:1472:15: error: implicit conversion from 'int' to 'char' changes value from 156 to -100 [-Werror,-Wconstant-conversion] /Users/pebishop/.gvm/gos/go1.4/src/cmd/6l/../ld/dwarf.c:1756:21: error: implicit conversion from 'int' to 'char' changes value from 144 to -112 [-Werror,-Wconstant-conversion] /Users/pebishop/.gvm/gos/go1.4/src/cmd/6l/../ld/lib.h:168:13: note: expanded from macro 'cput' go tool dist: FAILED: clang -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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -mmacosx-version-min=10.6 -c -m64 -I /Users/pebishop/.gvm/gos/go1.4/include -I /Users/pebishop/.gvm/gos/go1.4/src/cmd/6l -o /Users/pebishop/.gvm/gos/go1.4/pkg/obj/cmd/6l/dwarf.o /Users/pebishop/.gvm/gos/go1.4/src/cmd/6l/../ld/dwarf.c ...

getting the same error. I see this: https://github.com/moovweb/gvm/issues/369#issuecomment-826634454 was it helpful - cause I don't have a clear understanding of how the switches should work.

ttacon commented 3 years ago

For others encountering this issue, as per the README, you need a preexisting go installation for gvm to function. However, unlikely the README, you can't use gvm to install go1.4 as the packages no longer are available. A quick solution that is less than optimal, but functional, is to do:

brew install go
gvm install go1.16
gvm use go1.16
brew uninstall go

After that, you should be good to go (assuming you have both brew and gvm installed and configured).