struggling with cgo error messages

133 views
Skip to first unread message

kortschak

unread,
Jun 5, 2012, 2:13:00 AM6/5/12
to golan...@googlegroups.com
Hi,

I've put together a wrapper for a C library I need to use: https://github.com/kortschak/boom

So far I think I will be able to get all the behaviour I want and I can get the boom package to build. It's a different story when I try to build the couple of examples I threw together to see if the thing works (e.g. https://github.com/kortschak/boom/blob/master/examples/samtest.go).

If I try to `go build samtest.go' I get:

$ go build samtest.go
# command-line-arguments
github.com/kortschak/boom.(*textHeader).header: undefined: github.com/kortschak/boom.textHeader.header
bam_index_build(0): not defined
bam_fetch(0): not defined
samclose(0): not defined
bam_index_destroy(0): not defined
samread(0): not defined
bam_index_load(0): not defined
samwrite(0): not defined
samopen(0): not defined
github.com/kortschak/boom.(*bamHeader).header(0): not defined


What am I doing wrong (I have no idea what this errors refer to and I haven't found any docs that help)? All the C things go on in https://github.com/kortschak/boom/blob/master/boom.go

thanks
Dan

Andrew Wilkins

unread,
Jun 5, 2012, 3:01:43 AM6/5/12
to golan...@googlegroups.com
On Tuesday, 5 June 2012 14:13:00 UTC+8, kortschak wrote:
What am I doing wrong (I have no idea what this errors refer to and I haven't found any docs that help)? All the C things go on in https://github.com/kortschak/boom/blob/master/boom.go

gc currently doesn't fully support linking with static libraries.

Cheers,
Andrew

kortschak

unread,
Jun 5, 2012, 3:35:39 AM6/5/12
to golan...@googlegroups.com
Yeah, I found that just a minute ago. I can make the library shared. Do I then need to install the shared lib system wide? - if I place the libbam.so file in the boom directory ld can't find it. (This is all very new to me).

thanks for your help
Dan

(since I've already done this here is a link to the build failure with -x output: https://gist.github.com/49d38646c58029679c47)

kortschak

unread,
Jun 5, 2012, 8:10:33 AM6/5/12
to golan...@googlegroups.com
Resolved.

The final issue was that while I had placed the .so file in the boom directory I did not build boom against it, so when it came to build the example, it failed.

The cgo/testso example in the misc dir helped out figuring what was going on.

thanks
Dan
Reply all
Reply to author
Forward
0 new messages