LoginSignup
5
5

More than 5 years have passed since last update.

Go 1.5 on Solaris 11 x86

Last updated at Posted at 2015-12-18

Go!!
クマなのかネズミなのか分からないけれど、
手元の Solaris 環境でもコンパイルできたら良いのに。
・・ならやってみましょう。ものは試し。

Go 1.5 Bootstrap Plan によると、
go1.5 では C ソースを撤廃し go1.4 を利用した toolchain ビルドで生成できるとのことです。

さっそく official からソースを入手。

今回試したコンパイル環境は以下の通り。

  • SunOS 5.11 11.2 i86pc i386 i86pc
  • gcc version 4.5.2 (GCC)
  • GNU Make 3.82 Built for i386-pc-solaris2.11

Compile Go 1.4

$ tar xzf go1.4.3.src.tar.gz 
$ mv go go1.4.3
$ cd gol1.4.3/src
$ ./make.bash
(Snip)
---
Installed Go for solaris/amd64 in /opt/local/src/golang/go1.4.3
Installed commands in /opt/local/src/golang/go1.4.3/bin

Compile Go 1.5

$ export GOROOT_BOOTSTRAP=/opt/local/src/golang/go1.4.3
$ tar xzf go1.5.2.src.tar.gz
$ mv go go1.5.2
$ cd go1.5.2/src
$ ./make.bash
(snip)
---
Installed Go for solaris/amd64 in /opt/local/src/golang/go1.5.2
Installed commands in /opt/local/src/golang/go1.5.2/bin

あっさり、できてしまった。

Cross-compile environment

GOROOT_BOOTSTRAP は /opt/local/src/golang/go1.4.3 のまま。

ちなみに勇んで GOROOT_BOOTSTRAP を 1.5.2 のパスに切り替えると、
compile コマンドが見つからない、というエラーが出る。
https://github.com/golang/go/issues/12214

$ env  | grep GOROOT
GOROOT_BOOTSTRAP=/opt/local/src/golang/go1.4.3
$ GOOS=linux GOARCH=amd64 ./make.bash 
(snip)
---
Installed Go for linux/amd64 in /opt/local/src/golang/go1.5.2
Installed commands in /opt/local/src/golang/go1.5.2/bin

できあがり。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5