Getting Started with Chilkat in the Go Language (Linux 64-bit)

This is a walkthrough for getting a “Hello World” working with Chilkat in the Go programming language.
We’ll start from scratch by downloading Go and getting a simple Hello World Go example working. Then we’ll install Chilkat and build and run an example program.

(1) My Go language installation will be in ~/langDists/go.

cd ~
mkdir langDists
cd langDists

(2) Download Go and unpack.

tar xzf go1.12.7.linux-amd64.tar.gz

(3) Edit your .profile by adding these lines. Then restart your shell session..

(The GOPATH will be used in the next steps, but we’ll set it here..)


(4) Create a directory (~/go/src/hello) where we’ll create a simple “hello” Go program.

cd ~
mkdir go
cd go
mkdir src
cd src
mkdir hello

(5) Create the file ~/go/src/hello/hello.go containing this content

package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")

(6) Build and run

cd ~/go/src/hello
go build

If all is OK, proceed…

(7) Download and unzip. (The download link should be updated to the latest version of Chilkat. See

cd $GOPATH/src

(8) Download the Native “C” Chilkat Go library for 64-bit Linux

Make sure the Chilkat version matches the version downloaded for

cd $GOPATH/src
mkdir chilkatLib
cd chilkatLib
tar xzf chilkatext-9.5.0-linux-x64-gcc.tar.gz

(9) Set $CGO_LDFLAGS as shown here. (Add this line to your .bashrc)

export CGO_LDFLAGS="-L$HOME/go/chilkatLib/linux-x64-gcc -lchilkatext-9.5.0 -lresolv -lpthread -lstdc++"

(10) Build the “chilkat” package.
The “go build” will take some time.

cd $GOPATH/src/chilkat
go build
go install

(11) Build and Run an Example Program

cd $GOPATH/src/chilkat_example1
go build

The output for the chilkat_example1 should be some XML followed by a line indicating “success”.

Tags :