Go (gc) packages for Ubuntu

665 views
Skip to first unread message

Gustavo Niemeyer

unread,
Feb 3, 2011, 4:05:02 PM2/3/11
to golang-nuts
The first iteration of pre-built Go (gc) packages for Ubuntu should be
usable. There's a good amount of work to be done to make them
good, such as proper handling of module packages, and support for
$HOME-installed modules with goinstall, but this is the beginning.
They are also available only for Maverick for now (10.10) as well,
but on both 32 and 64 bit versions.

To make use of them:

sudo add-apt-repository ppa:niemeyer/ppa
sudo apt-get update
sudo apt-get install golang
export GOROOT=/usr/lib/go

Current release available is 2011-02-01.1. They will be maintained
up-to-date, so apt-get upgrade on new releases.

Please let me know if you find problems while using the packages.

--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter

Brian Ketelsen

unread,
Feb 3, 2011, 5:39:34 PM2/3/11
to Gustavo Niemeyer, golang-nuts


On Thu, Feb 3, 2011 at 4:05 PM, Gustavo Niemeyer <gus...@niemeyer.net> wrote:

sudo apt-get install golang



Gustavo, this is great news!  I've installed it on my Maverick vm and the installation went very smoothly. I can compile and link perfectly, but I am unable to install any packages, because the GOROOT environment variable isn't set for root. 

Apparently I can set environment variables for the sudo command on the command line itself:

sudo GOROOT=/usr/lib/go goinstall github.com/hoisie/web.go

but that still doesn't work.

brian@brian-Parallels-Virtual-Platform:~/web.go$ sudo GOROOT=/usr/lib/go goinstall github.com/hoisie/web.go
goinstall: === cd /usr/lib/go/src/pkg/runtime; gomake install
quietgcc -o mkversion -I "/usr/lib/go/include" mkversion.c "/usr/lib/go/lib/lib9.a"
gcc: /usr/lib/go/lib/lib9.a: No such file or directory
mkversion.c:1: fatal error: u.h: No such file or directory

I tried the same as root (with a sudo su session) and got the same response.

It's possible that I'm just not competent enough in Ubuntu to understand what I'm doing wrong.  There is no /usr/lib/go/lib directory, though.

Should I be trying something else?

Gustavo Niemeyer

unread,
Feb 3, 2011, 6:03:31 PM2/3/11
to Brian Ketelsen, golang-nuts
Hi Brian,

> Gustavo, this is great news!  I've installed it on my Maverick vm and the
> installation went very smoothly. I can compile and link perfectly, but I am
> unable to install any packages, because the GOROOT environment variable
> isn't set for root.

Yeah, as I explained, there's some work to be done in goinstall to support
that kind of packaging. It will have to be tweaked to support installing
packages in $HOME, and to not attempt to compile package it has no
write-access to on every iteration, among other things.

There's still debate to be had about how to do this properly. This is just
the first step.

Thanks for testing the packaging. Please keep me informed about any
other issues you find.

Brian Ketelsen

unread,
Feb 3, 2011, 6:42:50 PM2/3/11
to Gustavo Niemeyer, golang-nuts

On Feb 3, 2011, at 6:03 PM, Gustavo Niemeyer wrote:

Yeah, as I explained, there's some work to be done in goinstall to support
that kind of packaging.  It will have to be tweaked to support installing
packages in $HOME, and to not attempt to compile package it has no
write-access to on every iteration, among other things.

I apologize, I misunderstood the extent of the goinstall limitations.  Either way, it's very exciting to see packaged Go support making into Ubuntu.  Thank you for your work.

Brian

Andrew Gerrand

unread,
Feb 4, 2011, 1:20:34 AM2/4/11
to Gustavo Niemeyer, Brian Ketelsen, golang-nuts
On 4 February 2011 10:03, Gustavo Niemeyer <gus...@niemeyer.net> wrote:
> Hi Brian,
>
>> Gustavo, this is great news!  I've installed it on my Maverick vm and the
>> installation went very smoothly. I can compile and link perfectly, but I am
>> unable to install any packages, because the GOROOT environment variable
>> isn't set for root.
>
> Yeah, as I explained, there's some work to be done in goinstall to support
> that kind of packaging.  It will have to be tweaked to support installing
> packages in $HOME, and to not attempt to compile package it has no
> write-access to on every iteration, among other things.
>
> There's still debate to be had about how to do this properly.  This is just
> the first step.

Yes. And on this score the ball is very much in my court. I hope to
have this sorted out in the next few weeks.

Andrew

Gustavo Niemeyer

unread,
Feb 4, 2011, 2:42:47 AM2/4/11
to Andrew Gerrand, Brian Ketelsen, golang-nuts
> Yes. And on this score the ball is very much in my court. I hope to
> have this sorted out in the next few weeks.

That's great to hear, thanks Andrew. I'll be happy to collaborate
with you to help getting things going on this front.

Carl

unread,
Feb 4, 2011, 4:05:07 AM2/4/11
to golang-nuts
Thanks for making this possible, I feel Ubuntu is one of the more
widely used distributions and it would be really great to have an easy
(fully automatic) installation and update process for it. The last
long term support version was Lucid (10.4 till 2013/2015) by the
way... I say that because I am not going to do every upcoming Ubuntu
release upgrade as there are going to be too many major changes
happening down the road amongst other things to the UI, it will be
better to wait for the dust to settle before migrating there imo.

Graham Anderson

unread,
Feb 4, 2011, 7:46:49 AM2/4/11
to golan...@googlegroups.com, Gustavo Niemeyer
On Thursday 03 February 2011 22:05:02 Gustavo Niemeyer wrote:
>The first iteration of pre-built Go (gc) packages for Ubuntu should be
>usable.

We have some packages available[1] as well on the openSUSE Build Service[1].

openSUSE 11.1-3 Installation
----------------------------

zypper ar <repo url[3]> Golang
zypper ref
zypper in go

$GOROOT/$GOBIN etc will bet set for you but will only take effect on a new
login session as the env is set in /etc/profile.d/go.sh


While the name may indicate that this is openSUSE specific, the OBS was
actually designed to target multiple distros (and currently supports all major
distros), so we have enabled build targets and publishing for SLES[4] and
Mandriva[5] as well.

We already package a few third party libs and over the coming days and weeks
we'll package up some of the more popular and interesting packages listed on
the dashboard[6].

If you have a particular preference for having something packaged, feel free
to get in touch. Alternatively, you might consider using OBS as a platform to
publish your own library or app as .rpm or .deb formats. If this is something
you are interested in, the wiki development portal[7] has some guidelines and
instructions.

>There's a good amount of work to be done to make them
>good, such as proper handling of module packages, and support for
>$HOME-installed modules with goinstall, but this is the beginning.
>They are also available only for Maverick for now (10.10) as well,
>but on both 32 and 64 bit versions.

Likewise, our packages are very much work in progress and goinstall presents
some additional challenges for Linux packagers. Having third party libs
installable to $HOME while $GOROOT is somewhere else (/usr/lib64/go) could be
very handy.

Additionally, is it entirely necessary for the standard library imports to be
compiled and installed every time goinstall is invoked for a third party lib?
(Presumably multiple times if goinstall -a is used).


Cheers the noo,
Graham


[1] https://build.opensuse.org/project/show?project=devel:languages:go
[2] https://build.opensuse.org/
[3]
http://download.opensuse.org/repositories/devel:/languages:/go/openSUSE_11.1/
[3]
http://download.opensuse.org/repositories/devel:/languages:/go/openSUSE_11.2/
[3]
http://download.opensuse.org/repositories/devel:/languages:/go/openSUSE_11.3/
[3]
http://download.opensuse.org/repositories/devel:/languages:/go/openSUSE_11.3/
[4] http://download.opensuse.org/repositories/devel:/languages:/go/SLE_11_SP1/
[5]
http://download.opensuse.org/repositories/devel:/languages:/go/Mandriva_2010.1/
[6] http://godashboard.appspot.com/package
[7] http://en.opensuse.org/Portal:Development
--
“What can be asserted without proof can be dismissed without proof.”
- Christopher Hitchens

Gustavo Niemeyer

unread,
Feb 4, 2011, 8:37:37 AM2/4/11
to Graham Anderson, golan...@googlegroups.com
Hi Graham,

> We have some packages available[1] as well on the openSUSE Build Service[1].

Nice!

> Likewise, our packages are very much work in progress and goinstall presents
> some additional challenges for Linux packagers. Having third party libs
> installable to $HOME while $GOROOT is somewhere else (/usr/lib64/go) could be
> very handy.

We'll get there. Andrew has already been working on supporting
$GOPATH, and with some additional tweaks this will be feasible.

> Additionally, is it entirely necessary for the standard library imports to be
> compiled and installed every time goinstall is invoked for a third party lib?
> (Presumably multiple times if goinstall -a is used).

The problem is a bit broader than this, in the sense that this is a
problem even if it's not a standard library package. It must enable
the use of third-party packages which it hasn't itself installed, so
that they may be installed by different means (dpkg/rpm/msi/whatever),
and not attempt to rebuild them on every installation it's asked to
make.

Graham Anderson

unread,
Feb 4, 2011, 9:38:12 AM2/4/11
to Gustavo Niemeyer, golan...@googlegroups.com
On Friday 04 February 2011 14:37:37 Gustavo Niemeyer wrote:
>The problem is a bit broader than this, in the sense that this is a
>problem even if it's not a standard library package. It must enable
>the use of third-party packages which it hasn't itself installed, so
>that they may be installed by different means (dpkg/rpm/msi/whatever),
>and not attempt to rebuild them on every installation it's asked to
>make.

Gustavo, yes indeed. Thinking about this though, I wonder if we might be able
to tackle this by leveraging some of the existing package format
specifications.

In the rpm format, I can specify the following field in the .spec file:

Provides: log4go.googlecode.com/hg

A query can be performed against the rpm database:

• ganderson@excession [15:12:10] ../go-log4go
: rpm -q --whatprovides log4go.googlecode.com/hg
go-log4go-2.0.2-0.x86_64

I'm not so familiar with the dpkg format but from what I understand user
defined fields can be specified in the package control file which will then be
exported to the binary/source packages.

e.g.

XBS-Provides: log4go.googlecode.com/hg

would be exported as:

Provides: log4go.googlecode.com/hg

Now here is about where my knowledge of dpkg/deb and it's tools stops, so my
question would be; is there a convenient way to then query for this exported
"provides" field?


Cheers the noo,
Graham

Renich Bon Ciric

unread,
Feb 4, 2011, 3:09:36 PM2/4/11
to golan...@googlegroups.com
On Friday, February 4, 2011 6:46:49 AM UTC-6, Graham Anderson wrote:
On Thursday 03 February 2011 22:05:02 Gustavo Niemeyer wrote:
>The first iteration of pre-built Go (gc) packages for Ubuntu should be
>usable.  

We have some packages available[1] as well on the openSUSE Build Service[1].

  openSUSE 11.1-3 Installation
  ----------------------------

  zypper ar <repo url[3]> Golang
  zypper ref
  zypper in go

  $GOROOT/$GOBIN etc will bet set for you but will only take effect on a new
  login session as the env is set in /etc/profile.d/go.sh

I'm using this trick too... damn, I wish I saw your spec first! ;) 


While the name may indicate that this is openSUSE specific, the OBS was
actually designed to target multiple distros (and currently supports all major
distros), so we have enabled build targets and publishing for SLES[4] and
Mandriva[5] as well.


This is interesting. We've been working on our own spec file:

Glad to see other distros are working on this too ;)
 

We already package a few third party libs and over the coming days and weeks
we'll package up some of the more popular and interesting packages listed on
the dashboard[6].

Nice! 

Likewise, our packages are very much work in progress and goinstall presents
some additional challenges for Linux packagers. Having third party libs
installable to $HOME while $GOROOT is somewhere else (/usr/lib64/go) could be
very handy.

I agree. It would be awesome to have more PATH control in order to do this. 

Sascha Peilicke

unread,
Feb 5, 2011, 12:56:33 PM2/5/11
to golan...@googlegroups.com
On Friday 04 February 2011 21:09:36 Renich Bon Ciric wrote:
> On Friday, February 4, 2011 6:46:49 AM UTC-6, Graham Anderson wrote:
> > On Thursday 03 February 2011 22:05:02 Gustavo Niemeyer wrote:
> > >The first iteration of pre-built Go (gc) packages for Ubuntu should be
> > >usable.
> >
> > We have some packages available[1] as well on the openSUSE Build
> > Service[1].
> >
> > openSUSE 11.1-3 Installation
> > ----------------------------
> >
> > zypper ar <repo url[3]> Golang
> > zypper ref
> > zypper in go
> >
> > $GOROOT/$GOBIN etc will bet set for you but will only take effect on a
> >
> > new
> >
> > login session as the env is set in /etc/profile.d/go.sh
>
> I'm using this trick too... damn, I wish I saw your spec first! ;)

Packaging Go initially was quite a challenge, it took me quite some time to do
it right.

> > While the name may indicate that this is openSUSE specific, the OBS was
> > actually designed to target multiple distros (and currently supports all
> > major
> > distros), so we have enabled build targets and publishing for SLES[4] and
> > Mandriva[5] as well.
>
> This is interesting. We've been working on our own spec file:
> https://bugzilla.redhat.com/show_bug.cgi?id=652987
>
> Glad to see other distros are working on this too ;)

I've just enabled Fedora package building in the devel:languages:go OBS
project and they build just fine. Feel free to give them a try.
--
Mit freundlichen Grüßen,
Sascha Peilicke
http://saschpe.wordpress.com

signature.asc

Sascha Peilicke

unread,
Feb 6, 2011, 4:54:30 AM2/6/11
to Renich Bon Ciric, golan...@googlegroups.com
On Saturday 05 February 2011 21:55:26 you wrote:

> On Sat, Feb 5, 2011 at 11:56 AM, Sascha Peilicke <sas...@gmx.de> wrote:
> > I've just enabled Fedora package building in the devel:languages:go OBS
> > project and they build just fine. Feel free to give them a try.
>
> Oh, thank you, my kind friend! ;)
You're welcome :-)

> Any idea of why, out of the box, it doesn't build?
What do you mean by 'it' ? Go itself or some module?

signature.asc

Graham Anderson

unread,
Feb 11, 2011, 10:32:04 PM2/11/11
to Gustavo Niemeyer, golan...@googlegroups.com
On Friday 04 February 2011 14:37:37 Gustavo Niemeyer wrote:
>We'll get there. Andrew has already been working on supporting
>$GOPATH, and with some additional tweaks this will be feasible.

Is there an hg or git branch I can follow for this?

Andrew

unread,
Feb 11, 2011, 11:28:40 PM2/11/11
to golang-nuts
Sascha Peilicke wrote:
> On Friday 04 February 2011 21:09:36 Renich Bon Ciric wrote:
....
> > Glad to see other distros are working on this too ;)
>
> I've just enabled Fedora package building in the devel:languages:go OBS
> project and they build just fine. Feel free to give them a try.

Sascha,
I guess i'm missing smth this late @ night, but it appears that there
are no "go" files in this repo:
http://download.opensuse.org/repositories/devel:/languages:/go/RedHat_RHEL-5/repodata/
[code]
[root@localhost yum.repos.d]# yum list gcc* --disablerepo=* --
enablerepo=devel_languages_go
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
gcc.i386
4.1.2-48.el5 installed
gcc-c++.i386
4.1.2-48.el5 installed
gcc-gfortran.i386
4.1.2-48.el5 installed
[root@localhost yum.repos.d]#
[/code]

Can you please guide me in the right direction - i just want to get
the rpm for "go" for centos5.
Thank You.
Andrew
Reply all
Reply to author
Forward
0 new messages