Getting Started with Chilkat Go on Ubuntu Linux

Verify Go is Installed

The $GOPATH environment variable should be defined, and “go” should be a command.  The following commands check $GOPATH, check the version of Go, and list the contents of the $GOPATH directory.

Download chilkat_go.zip into $GOPATH/src

The Chilkat version shown here may not be the latest version of Chilkat.  Get the latest version URL from https://www.chilkatsoft.com/go.asp

Unzip chilkat_go.zip

Download the Chilkat Native C Lib

Uncompress/Untar the Chilkat Native C Lib

This creates the directory linux-x64-gcc

Set the CGO_LDFLAGS Environment Variable

You’ll probably want to put the “export CGO_LDFLAGS …” command in your .profile.

Go to $GOPATH/src/chilkat and Build Chilkat

The “go build” command will take a minute or two to complete.

Note: If you get the following error:  undefined reference to `__res_query’,  it means your system does not have libresolv.so

The res_query function (see https://linux.die.net/man/3/res_query ) is found within libresolv.so (or libresolv.a) and is linked with -lresolv.

On a 64-bit Ubuntu system, libresolv.so is located in /usr/lib/x86_64-linux-gnu

On your system, do the following to see if you have libresolv:

cd /usr/lib
find . -name libresolv.*

 

Build and Run chilkat_example1