[libvirt-users] Golang libvirt bindings problem

Branimir Pejakovic branimirp at gmail.com
Thu Jan 3 01:37:51 UTC 2019


Hello everybody!

First, allow me to wish you all a Happy New year!

I have a problem with a small app that I wrote in Go and which uses libvirt
go bindings. Actually, the problem exists only when I want to compile the
code statically. Basically, when CGO_ENABLED=0 is exported, go (running go
test, go run, go build) complains:

undefined: libvirt.NewConnect

When I try to compile the source dynamically (running the same go <command>
commands) the app works/checks out as expected and works without any
problem.

I tried this on:

- CentOS 7.6 (go version 1.11.2)
- Ubuntu 18.04 LTS (go version 1.10.4)

Both systems - as advised on project's github pages/godoc.org - have
libvirt-dev package installed. Also, the libvirt module is imported as
advised:

libvirt "github.com/libvirt/libvirt-go"

GOPATH is set to /home/$USER/go

I downloaded the package via go get; go get -v -u
github.com/libvirt/libvirt-go. Please if somebody encountered this before,
could you give me a hint if possible in order to solve this?

Thank you very much in advance!


Regards,

Branimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20190103/1cdebe26/attachment.htm>


More information about the libvirt-users mailing list