SWIG + Go:动态符号不受支持的重定位

I'm trying to wrap a C++ library in Go using SWIG, but I'm getting build errors when I try to use the package since I upgraded to Go 1.4.2.

The package can be found here: https://bitbucket.org/evanh/goewah

It contains the .swigcxx file as well as the C++ headers. For reference, I'm trying to interface with this library: https://github.com/lemire/EWAHBoolArray

Following the instructions on the SWIG website, I'm able to build my package and have it install on my machine. I couldn't figure out how to get Go to automatically read my .swigcxx file and build the package, so I had to add a Makefile that called all the commands manually.

However, the library builds and installs without errors. On Go 1.3.3, I could also use the package with no problems. However, running the same program in Go 1.4.2 causes a number of build errors.

My test program:

package main

import (
    "fmt"
    "bitbucket.org/evanh/goewah"
)

func main() {
    x := goewah.NewEWAHBoolArray()
    x.Set(1)
    x.Set(2)
    fmt.Println(x.Get(1))
}

The errors I see when I try to go build it:

# command-line-arguments
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_sizeInBits: unsupported  relocation for dynamic symbol _wrap_EWAHBoolArray_sizeInBits (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_isEmpty: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_isEmpty (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_toIntArray: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_toIntArray (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_numberOfOnes: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_numberOfOnes (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_readStr: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_readStr (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_writeStr: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_writeStr (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_read__SWIG_1: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_read__SWIG_1 (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_read__SWIG_0: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_read__SWIG_0 (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_write__SWIG_1: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_write__SWIG_1 (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_write__SWIG_0: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_write__SWIG_0 (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_reset: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_reset (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_logicalandnot: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_logicalandnot (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_logicalxor: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_logicalxor (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_logicalor: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_logicalor (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_logicaland: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_logicaland (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_inplace_logicalnot: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_inplace_logicalnot (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_logicalnot: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_logicalnot (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_set: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_set (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_get: unsupported relocation for dynamic symbol _wrap_EWAHBoolArray_get (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_new_EWAHBoolArray: unsupported relocation for dynamic symbol _wrap_new_EWAHBoolArray (type=1 stype=32)
bitbucket.org/evanh/goewah._wrap_EWAHBoolArray_get: unhandled relocation for _wrap_EWAHBoolArray_get (type 32 rtype 1)
too many errors

Figured it out. I had to link against the C library as well. Fixed code below.

package main

//#cgo LDFLAGS: -L/usr/local/lib -lewah
import "C"

import (
    "fmt"
    "bitbucket.org/evanh/goewah"
)

func main() {
    x := goewah.NewEWAHBoolArray()
    x.Set(1)
    x.Set(2)
    fmt.Println(x.Get(1))
}