Skip to content
holodigm edited this page Oct 28, 2014 · 22 revisions

GoLearn is a Go library that's relatively standard apart from a few optional C dependencies. To install it, you'll need to install Go 1.2 or later first.

Installation

System dependencies

  • You'll need to have a compatable compiler installed (to check, run g++ in your terminal.)
  • GoLearn uses Gonum's BLAS wrapper, which requires OpenBLAS or similar to be installed.

Installing a BLAS implementation

Installing OpenBLAS on Ubuntu
sudo apt-get install libopenblas-dev
Installation on OpenSUSE 13.1
sudo zypper in blas-devel cblas-devel
Installation on OSX 10.9+

brew install homebrew/science/openblas

Completing the installation of Gonum's BLAS wrapper

After installing a BLAS implementation, type the following commands

go get github.com/gonum/blas
cd $GOPATH/src/github.com/gonum/blas
go install ./...

On Ubuntu 14.04, modify $GOPATH/src/github.com/gonum/blas/cblas/blas.go and modify the line beginning #cgo linux LDFLAGS: to read #cgo linux LDFLAGS: -L/usr/lib -lopenblas. /usr/lib should be the path to the openblas library. If not, use dpkg -L libopenblas-dev to find the path

On OpenSUSE 13.1, modify $GOPATH/src/github.com/gonum/blas/cblas/blas.go and modify the line beginning #cgo linux LDFLAGS: to read #cgo linux LDFLAGS: -lblas -lcblas.

On OSX modify, modify $GOPATH/src/github.com/gonum/blas/cblas/blas.go and modify the line beginning #cgo linux LDFLAGS: to include your brew install response path such as #cgo linux LDFLAGS: -L/usr/local/opt/openblas/lib -lopenblas.

Installing GoLearn's internal dependencies

After installing go and the system dependencies, type

go get -t -u -v github.com/sjwhitworth/golearn

Completing the installation

Run the following to complete installation.

cd $GOPATH/src/github.com/sjwhitworth/golearn
go get -t -u -v ./...

Common problems

On Linux and Mac OS X, you can verify that Go is installed correctly via your terminal. Try compiling the example program to verify that your installation is working correctly.

Your go directory must exist in your home directory and be writeable. If it isn't, type cd && mkdir go to create it.

Your GOPATH and PATH variables must be set correctly.

  • To verify, type echo $GOROOT and echo $GOPATH.
  • Your $GOPATH variable should include your $GOROOT, plus a bin/ directory. For example, if $GOROOT is set to /home/sen/go, $GOPATH should be set to /home/sen/go/bin
  • To make sure that these variables are setup correctly, add export GOROOT=$HOME/go and export PATH=$PATH:$GOROOT/bin to your Bash configuration file.

Support status

Operating Systems Mac OS X 10.8
Ubuntu 14.04
OpenSUSE 13.1
Go version 1.2
GoLearn version Current
Support status Current
Next revision On version upgrade

Mac OS X 10.8

  • BLAS installation via HomeBrew has not been confirmed working.
Clone this wiki locally