Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue building flannel on Ubuntu #552

Closed
wapptastic opened this issue Nov 21, 2016 · 7 comments
Closed

Issue building flannel on Ubuntu #552

wapptastic opened this issue Nov 21, 2016 · 7 comments

Comments

@wapptastic
Copy link

Installing Flannel on Ubuntu using the following:
Step 1: sudo apt-get install linux-libc-dev golang gcc
Step 2: git clone https://github.com/coreos/flannel.git
Step 3: Run the build script: cd flannel; make

I'm getting the following errors:

vagrant@node03:~/flannel$ make
go build -o dist/flanneld \
	  -ldflags "-X github.com/coreos/flannel/version.Version=v0.6.1-39-gf6d7239"
main.go:37:2: cannot find package "github.com/coreos/flannel/backend/alloc" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/backend/alloc (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/backend/alloc (from $GOPATH)
main.go:38:2: cannot find package "github.com/coreos/flannel/backend/awsvpc" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/backend/awsvpc (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/backend/awsvpc (from $GOPATH)
main.go:39:2: cannot find package "github.com/coreos/flannel/backend/gce" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/backend/gce (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/backend/gce (from $GOPATH)
main.go:40:2: cannot find package "github.com/coreos/flannel/backend/hostgw" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/backend/hostgw (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/backend/hostgw (from $GOPATH)
main.go:41:2: cannot find package "github.com/coreos/flannel/backend/udp" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/backend/udp (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/backend/udp (from $GOPATH)
main.go:42:2: cannot find package "github.com/coreos/flannel/backend/vxlan" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/backend/vxlan (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/backend/vxlan (from $GOPATH)
main.go:30:2: cannot find package "github.com/coreos/flannel/network" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/network (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/network (from $GOPATH)
main.go:31:2: cannot find package "github.com/coreos/flannel/remote" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/remote (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/remote (from $GOPATH)
main.go:32:2: cannot find package "github.com/coreos/flannel/subnet" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/subnet (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/subnet (from $GOPATH)
main.go:33:2: cannot find package "github.com/coreos/flannel/subnet/kube" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/subnet/kube (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/subnet/kube (from $GOPATH)
main.go:34:2: cannot find package "github.com/coreos/flannel/version" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/flannel/version (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/flannel/version (from $GOPATH)
main.go:26:2: cannot find package "github.com/coreos/pkg/flagutil" in any of:
	/usr/lib/go/src/pkg/github.com/coreos/pkg/flagutil (from $GOROOT)
	/home/vagrant/go/src/github.com/coreos/pkg/flagutil (from $GOPATH)
main.go:27:2: cannot find package "github.com/golang/glog" in any of:
	/usr/lib/go/src/pkg/github.com/golang/glog (from $GOROOT)
	/home/vagrant/go/src/github.com/golang/glog (from $GOPATH)
main.go:28:2: cannot find package "golang.org/x/net/context" in any of:
	/usr/lib/go/src/pkg/golang.org/x/net/context (from $GOROOT)
	/home/vagrant/go/src/golang.org/x/net/context (from $GOPATH)
make: *** [dist/flanneld] Error 1
@HerrmannHinz
Copy link

u can go get the missing dependencies one after the other until u have all packages.
just doing this - this is of course just a temporary fix.

@HerrmannHinz
Copy link

oh wait but it fails on this one, no step further possible:

root@localhost:/opt/src/flannel# go get k8s.io/kubernetes/pkg/controller/framework package k8s.io/kubernetes/pkg/controller/framework imports k8s.io/kubernetes/pkg/controller/framework imports k8s.io/kubernetes/pkg/controller/framework: cannot find package "k8s.io/kubernetes/pkg/controller/framework" in any of: /usr/lib/go/src/pkg/k8s.io/kubernetes/pkg/controller/framework (from $GOROOT) /root/go/src/k8s.io/kubernetes/pkg/controller/framework (from $GOPATH)

@fabianromerorcc
Copy link

Hi HerrmannHinz! Did you figure out how to resolve that package?

I'll appreciate any help

Cheers!

@HerrmannHinz
Copy link

@fabianromerorcc no not yet. haven't tried anymore.

@besnik
Copy link

besnik commented Dec 29, 2016

Hi all,
following has worked for me (I don't know go so I apologize if there is better solution). You need to specify GOPATH env variable so go can find packages of dependencies that are located in vendor folder. The trick is that you need to clone flannel project into specific path (src/github.com/coreos) and set GOPATH to the directory where src subdirectory is, see below:

Assuming you are in your home directory:

cd ~
export GOPATH=$(pwd)
mkdir -p src/github.com/coreos
cd src/github.com/coreos
git clone https://github.com/coreos/flannel.git
cd flannel
make dist/flanneld

It would be great if go or flannel team could review this as suggest better solution. Ideally vendor folder with dependencies should be located with respect to current directory of calling make (flannel folder). I dont know if this is problem of Go or could be enhanced in Makefile or somewhere.

@tomdee
Copy link
Contributor

tomdee commented Jan 20, 2017

Pushed #594 to improve the instructions.

The info from @besnik is exactly right (#552 (comment)) Please add this to the README in a PR if you'd like to see it included.

@tomdee
Copy link
Contributor

tomdee commented Jan 20, 2017

@HerrmannHinz if you have your GOPATH set up properly you shouldn't need to go get any packages,

@tomdee tomdee closed this as completed Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants