Install gccgo for testing Protocol Buffers 3

Hi guys,

Back to coding and tech in general after a few years … I’m trying to learn the ropes of Golang and Protocol Buffers. After a few readings, I figured out that I needed to install gccgo

This repo: github.com/golang/protobuf looked like the most relevant and summarized source of information to accomplish this. Below is the description of the steps I’ve followed. Thank you in advance for your help :slight_smile:

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)

$ 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 :confused:

Of course, install the Go compiler and tools from xxxxx See
xxxxx/doc/install for details or, if you are using gccgo, follow the instructions at xxxxx/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 … so why is there a special branch on the repos and where it is?

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
gcc.gnu.org/pub/gcc/infrastructure/.  See also
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 which leads me to install lzipbefore 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. So, if gcc is 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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.