1

I am trying to build the Ethereum Geth client node on an Ubuntu 14.04 LTS box. I am using the 2017.3 Goland client. When I try to compile the project I get the errors below:

interfaces.go:25:2: cannot find package "github.com/ethereum/go-ethereum/common" in any of:
    /usr/local/go/src/github.com/ethereum/go-ethereum/common (from $GOROOT)
    /home/robert/go/src/github.com/ethereum/go-ethereum/common (from $GOPATH)
interfaces.go:26:2: cannot find package "github.com/ethereum/go-ethereum/core/types" in any of:
    /usr/local/go/src/github.com/ethereum/go-ethereum/core/types (from $GOROOT)
    /home/robert/go/src/github.com/ethereum/go-ethereum/core/types
(from $GOPATH)

I have checked my GOPATH which has go-ethereum as its root. I do see a common directory underneath it but not types directory. I checked the Geth repo on GitHub:

https://github.com/ethereum

And I don't see a sibling common or types project. Does anyone know how to fix this problem?

  • You GOPATH directory is incorrect. This can happen only if you are putting your fingers into the sources. Normally if you untar and make geth you are not going to have this problem, as all the dependences are unpacked into ./vendor directory and you don't need any GOPATH setting by hand. If you are doing a custom ethereum build then you should familiarize yourself with Gos directory structure, this is basic stuff in golang – Nulik Feb 18 '18 at 1:55
  • download the Release tarball in the releases section and make geth, that's all you have to do – Nulik Feb 18 '18 at 1:57
  • @Nulik I never touched the sources. I simply cloned the repo and tried to build it with the Goland IDE. – Robert Oschler Feb 18 '18 at 2:30
  • then use the tarball, master repo is the dev branch – Nulik Feb 18 '18 at 14:53
2

The problem is that the setting of GOPATH is incorrect.

You need to set the GOPATH in the IDE to: /home/robert/go and then open the project via Open Directory to /home/robert/go/src/github.com/ethereum/go-ethereum.

See the Go Workspace for how to set up a Go workspace.

  • 1
    @disniper That document you linked me "Go Workspace" is crucial. Go is a picky about the directory structure it requires. Once I changed my setup to match that indicated by the document, I could build successfully. Thanks. – Robert Oschler Feb 18 '18 at 16:06
  • Being a newbie to Go, I'm wondering what the rationale is behind setting the package name in source as "github.com/.../...". What if the hosting website isn't determined at the time of coding? Wouldn't it be better if the source only needs to know the relative folder structure? – Isilmë O. May 22 '18 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.