Skip to content

Commit

Permalink
[Go] update build instructions in Examples/go/index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlancetaylor committed Aug 5, 2015
1 parent 5e88857 commit 95a08b3
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions Examples/go/index.html
Expand Up @@ -36,31 +36,39 @@ <h2>Compilation Issues</h2>
</blockquote>

<li>On Unix the compilation of examples is done using the
file <tt>Example/Makefile</tt>. This makefile performs a manual
module compilation which is platform specific. When using
the <tt>6g</tt> or <tt>8g</tt> compiler, the steps look like this
file <tt>Example/Makefile</tt>. Normally builds are done simply
using <tt>go build</tt>. For testing purposes this makefile performs
a manual module compilation that is platform specific. When using
the <tt>gc</tt> compiler, the steps look approximately like this
(GNU/Linux):

<blockquote>
<pre>
% swig -go interface.i
% gcc -fpic -c interface_wrap.c
% gcc -shared interface_wrap.o $(OBJS) -o interfacemodule.so
% 6g interface.go
% 6c interface_gc.c
% gopack grc interface.a interface.6 interface_gc.6
% 6l program.6
% swig -go -cgo interface.i
% mkdir -p gopath/src/interface
% cp interface_wrap.c interface_wrap.h interface.go gopath/src/interface
% GOPATH=`pwd`/gopath
% export GOPATH
% cd gopath/src/interface
% go build
% go tool compile $(SRCDIR)/runme.go
% go tool link -o runme runme.o
</pre>
</blockquote>

<li>When using the <tt>gccgo</tt> compiler, the steps look like this:

<blockquote>
<pre>
% swig -go interface.i
% gcc -c interface_wrap.c
% gccgo -c interface.go
% gccgo program.o interface.o interface_wrap.o
% swig -go -cgo interface.i
% mkdir -p gopath/src/interface
% cp interface_wrap.c interface_wrap.h interface.go gopath/src/interface
% GOPATH=`pwd`/gopath
% export GOPATH
% cd gopath/src/interface
% go build
% gccgo -c $(SRCDIR)/runme.go
% gccgo -o runme runme.o interface.a
</pre>
</blockquote

Expand All @@ -75,11 +83,11 @@ <h2>Compatibility</h2>
</ul>

All of the examples were last tested with the following configuration
(10 May 2010):
(5 August 2015):

<ul>
<li>Ubuntu Hardy
<li>gcc-4.2.4
<li>Ubuntu Trusty
<li>gcc-4.8.4
</ul>

Your mileage may vary. If you experience a problem, please let us know by
Expand Down

0 comments on commit 95a08b3

Please sign in to comment.