From 95a08b3950ea1f43846ccff11969c9179f2eeddd Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 5 Aug 2015 07:19:05 -0700 Subject: [PATCH] [Go] update build instructions in Examples/go/index.html --- Examples/go/index.html | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/Examples/go/index.html b/Examples/go/index.html index 4c07af3f0ab..b7d7017d3b1 100644 --- a/Examples/go/index.html +++ b/Examples/go/index.html @@ -36,20 +36,23 @@

Compilation Issues

  • On Unix the compilation of examples is done using the -file Example/Makefile. This makefile performs a manual -module compilation which is platform specific. When using -the 6g or 8g compiler, the steps look like this +file Example/Makefile. Normally builds are done simply +using go build. For testing purposes this makefile performs +a manual module compilation that is platform specific. When using +the gc compiler, the steps look approximately like this (GNU/Linux):
    -% 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
     
    @@ -57,10 +60,15 @@

    Compilation Issues

    -% 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
     
    Compatibility All of the examples were last tested with the following configuration -(10 May 2010): +(5 August 2015): Your mileage may vary. If you experience a problem, please let us know by