gccgo failed to complile under MAC OSX

522 views
Skip to first unread message

Constantine Vasil

unread,
Jan 25, 2013, 6:37:40 PM1/25/13
to golan...@googlegroups.com
I am following instructions for Setting up and using gccgo:

svn checkout svn://gcc.gnu.org/svn/gcc/branches/gccgo gccgo
mkdir objdir
cd objdir
../gccgo/configure --prefix=/opt/gccgo --enable-languages=c,c++,go
make
make install

it ran for 2 hours but stopped with this error:
/usr/include/ucontext.h:43:2: error: #error The deprecated ucontext routines require _XOPEN_SOURCE to be defined
 #error The deprecated ucontext routines require _XOPEN_SOURCE to be defined
  ^
make[4]: *** [go-main.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libgo] Error 2
make: *** [all] Error 2

what is wrong?

minux

unread,
Jan 25, 2013, 6:38:52 PM1/25/13
to Constantine Vasil, golan...@googlegroups.com
gccgo doesn't support Mac OS X yet.

Constantine Vasil

unread,
Jan 25, 2013, 6:56:51 PM1/25/13
to golan...@googlegroups.com, Constantine Vasil
Thank you.

I am using MAC OSX for Golang development and the upload
to Ubuntu server. 

For my development I am using C++ libraries+SWIG and that is 
why I need to use gccgo in order to test my Golang app.

What do you recommend in this case.

As a side note, I installed GCC 4.7.2  to Ubuntu 12.04 LTS 64-bit.
The default GCC for Ubuntu 12.04 is 4.6.3. How to make the newly
installed  GCC 4.7.2 the default one.

I did executed the command:
sudo apt-get install gccgo

How to make gcc command to use the gcc 4.7.2 by default?

Ian Lance Taylor

unread,
Jan 25, 2013, 8:14:20 PM1/25/13
to Constantine Vasil, golan...@googlegroups.com
On Fri, Jan 25, 2013 at 3:56 PM, Constantine Vasil <ths...@gmail.com> wrote:
>
> I am using MAC OSX for Golang development and the upload
> to Ubuntu server.
>
> For my development I am using C++ libraries+SWIG and that is
> why I need to use gccgo in order to test my Golang app.

SWIG does work with the gc compiler (though I'm not sure how well SWIG
works on Mac OS X).

> As a side note, I installed GCC 4.7.2 to Ubuntu 12.04 LTS 64-bit.
> The default GCC for Ubuntu 12.04 is 4.6.3. How to make the newly
> installed GCC 4.7.2 the default one.
>
> I did executed the command:
> sudo apt-get install gccgo
>
> How to make gcc command to use the gcc 4.7.2 by default?

To get 4.7.2, you may have to build gccgo yourself. I don't know if
anybody has made a package for it.

Ian

minux

unread,
Jan 25, 2013, 8:28:52 PM1/25/13
to Ian Lance Taylor, Constantine Vasil, golan...@googlegroups.com
On Sat, Jan 26, 2013 at 9:14 AM, Ian Lance Taylor <ia...@google.com> wrote:
On Fri, Jan 25, 2013 at 3:56 PM, Constantine Vasil <ths...@gmail.com> wrote:
>
> I am using MAC OSX for Golang development and the upload
> to Ubuntu server.
>
> For my development I am using C++ libraries+SWIG and that is
> why I need to use gccgo in order to test my Golang app.

SWIG does work with the gc compiler (though I'm not sure how well SWIG
works on Mac OS X).
Works for Mac OS X 10.6 and 10.7 at least,
there is one issue with 10.8 though:

Constantine Vasil

unread,
Jan 25, 2013, 9:33:48 PM1/25/13
to golan...@googlegroups.com, Ian Lance Taylor, Constantine Vasil
My Mac is under OSX 10.8.2. There error message I reported 
is from it. 

Constantine Vasil

unread,
Jan 25, 2013, 9:36:47 PM1/25/13
to golan...@googlegroups.com, Constantine Vasil
I got the gccgo 4.7.2
executing following command:
sudo apt-get install gccgo 

I also updated the gcc to 4.7.2
the issue is with gcc showing ver 4.3 when executed 
as default one. I already have 4.7.2 but cannot make it default.

speter

unread,
Jan 25, 2013, 9:58:03 PM1/25/13
to Constantine Vasil, golang-nuts
man update-alternatives


--
 
 

speter

unread,
Jan 25, 2013, 10:01:24 PM1/25/13
to Constantine Vasil, golang-nuts
Scratch that, gcc is not managed by update-alternatives.
Sorry for the noise.

Peter

minux

unread,
Jan 26, 2013, 8:45:32 AM1/26/13
to Constantine Vasil, speter, golang-nuts
On Sat, Jan 26, 2013 at 11:01 AM, speter <spete...@gmail.com> wrote:
Scratch that, gcc is not managed by update-alternatives.
According to /usr/share/doc/gcc/README.Debian, this choice is deliberate.
And Debian doesn't provide an automatic way to switch the symbol for
/usr/bin/gcc, /usr/bin/g++, and others.

If you really really want to make a non-default gcc as your default gcc on
debian, you can update the symbols /usr/bin/{gcc,g++,cpp,gccgo} etc by
yourself with:
ln -sf gcc-4.7 /usr/bin/gcc

thstart

unread,
Jan 26, 2013, 4:01:00 PM1/26/13
to golan...@googlegroups.com, Constantine Vasil, speter
This seems to do it.

How would be the right way to install GCC 4.7.2?

Ingo Oeser

unread,
Jan 27, 2013, 3:14:51 PM1/27/13
to golan...@googlegroups.com, Constantine Vasil

Workaround which works for me is an executable script called "gccgo" in my $PATH with the following content:
#!/bin/sh
exec /usr/bin/gccgo-4.7 -static-libgcc -B/usr/bin/ld.gold $@

Then e.g. "go get -compiler gccgo launchpad.net/goamz/ec2" should fetch and compile you the ec2 library.

Constantine Vasil

unread,
Jan 27, 2013, 3:34:20 PM1/27/13
to golan...@googlegroups.com, Constantine Vasil
Hi Ingo,

Which issue you solved? To build it on Mac OSX?

Best,
--Constantine
Reply all
Reply to author
Forward
0 new messages