I'm trying to install gccgo
for testing Protocol Buffers 3 with Golang...I have to confess that I'm back to dev after 8 years off (and I'm not a native speaker) so, thank you for your indulgence. Thank you :)
So, After a few readings, I decided to start from the README of this repo: https://github.com/golang/protobuf
1st bullet point: checked!
The last version os the protocol buffer is installed on my Mac ( protobuf-cpp-3.11.4.tar.gz
from my understanding) https://github.com/protocolbuffers/protobuf/releases/tag/v3.11.4
$ ls $GOBIN
dlv* gocode* godef* gopkgs* protoc-gen-go*
go-outline* gocode-gomod* golint* goreturns*
2nd bullet point: Here I've spent a couple of hours ... without success :/
Of course, install the Go compiler and tools from https://golang.org/ See https://golang.org/doc/install for details or, if you are using gccgo, follow the instructions at https://golang.org/doc/install/gccgo
My understanding is that I need to install gccgo
which is a branch of the gcc compiler. Then I've read that gccgo
is just in fact a custom build of the gcc compiler configured with the --enable-languages=c,c++,go
option ( src https://golang.org/doc/install/gccgo ) ... so why is there a special branch on the repos and where it is? (https://gcc.gnu.org/git.html) I
I just give up to try to download the gccgo branch from the git repository and find a svn repo:
$ svn checkout svn://gcc.gnu.org/svn/gcc/branches/gccgo gccgo`
gccgo$ ./configure --enable-languages=c,c++,go
...
configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
<https://gcc.gnu.org/pub/gcc/infrastructure/>. See also
<http://gcc.gnu.org/install/prerequisites.html> for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
So, I downloaded gmp-6.2.0.tar.lz
from https://gmplib.org/ which leads me to install lzip
before untaring the archive
$ brew install lzip
$ lunzip gmp-6.2.0.tar.lz
$ tar - xvzf gmp-6.2.0.tar
$ cd gmp-6.2.0
gmp-6.2.0$ ./configure
gmp-6.2.0$ make
gmp-6.2.0$ make install
gmp-6.2.0$ make check ( a few warnings but every test have been passed successfully )
Then, installed mpfr-3.1.6.tar.gz
$ tar -xvzf mpfr-3.1.6.tar.gz
$ cd mpfr-3.1.6
mpfr-3.1.6$ ./configure
mpfr-3.1.6$ ./make
mpfr-3.1.6$ ./make install
... and try again
gccgo$ ./configure --enable-languages=c,c++,go
...
The following requested languages could not be built: go
Supported languages are: c,brig,c,c++,d,fortran,lto,objc,obj-c++
Lastly
I'm not sure about the directory they are talking about in the last step...
Build the Go samples in this directory with "make go". This creates the following executable files in the current directory: add_person_go list_people_go
make
works with gcc
to introduces a separate file of "rules", that describes how to go from source code to finished program, interprets this file, figures out what needs to be compiled, and calls gcc
. ( source https://stackoverflow.com/a/768379/1216281 ). So, if gcc it not compiled properly, it can't work.
protocolbuffer$ ls
add_person.go add_person_test.go addressbook.proto list_people_test.go
add_person.go.txt addressbook.pb.go list_people.go
protocolbuffer$ make go
make: *** No rule to make target `go'. Stop.
Extra tech. infos if neeeded :
~$ echo $GOPATH
/Users/me/Dev/Go/golib:/Users/me/Dev/Go/code
$GOBIN is /Users/me/Dev/Go/golib/bin
$ echo $GOBIN
/Users/me/Dev/Go/golib/bin