John-Lin/tinynet

can't execute example

Closed this issue · 4 comments

Environment

Ubuntu 16.04
go version go1.9 linux/amd64

Steps

  1. go get -u github.com/John-Lin/tinynet
  2. execute tinynet/example/topo-single-8.go

Issue

When I type go run topo-single-8.go, I got following error.

/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-905310536/000003.o: In function `_cgo_f36fc5609ae4_C2func_load_simple_bpf':
/tmp/go-build/github.com/containernetworking/plugins/vendor/github.com/vishvananda/netlink/_obj/cgo-gcc-prolog:32: multiple definition of `_cgo_f36fc5609ae4_C2func_load_simple_bpf'
/tmp/go-link-905310536/000001.o:/tmp/go-build/github.com/vishvananda/netlink/_obj/cgo-gcc-prolog:32: first defined here
/tmp/go-link-905310536/000003.o: In function `_cgo_f36fc5609ae4_Cfunc_load_simple_bpf':
/tmp/go-build/github.com/containernetworking/plugins/vendor/github.com/vishvananda/netlink/_obj/cgo-gcc-prolog:55: multiple definition of `_cgo_f36fc5609ae4_Cfunc_load_simple_bpf'
/tmp/go-link-905310536/000001.o:/tmp/go-build/github.com/vishvananda/netlink/_obj/cgo-gcc-prolog:55: first defined here
collect2: error: ld returned 1 exit status

This issue only happens if I install tinynet via go get.

And how to avoid this error?

I try to download source from git and use govendor sync to install dependency packages and it works now.

@hwchiu thanks. I should add a dependencies installation in README. If you like create a PR for that.
@07skat Use govendor and govendor sync to install dependencies.