usnistgov / Blockchain

This is the repository for NIST Blockchain developments
15 stars 7 forks source link

build errors #4

Open tkphd opened 6 years ago

tkphd commented 6 years ago

I have very little experience with Go, and am having difficulty building the executables in this project. When I execute

GOPATH=$(pwd) python gobuilder.py

it throws errors similar to the following:

cd himitsu and go install
himitsu.go:14:3: cannot find package "currency/hashes" in any of:
        /usr/lib/go-1.7/src/currency/hashes (from $GOROOT)
        ${Blockchain}/Model0/src/currency/hashes (from $GOPATH)
Error =  None

cd methods and go install
methods.go:9:3: cannot find package "currency/himitsu" in any of:
        /usr/lib/go-1.7/src/currency/himitsu (from $GOROOT)
        ${Blockchain}/Model0/src/currency/himitsu (from $GOPATH)
methods.go:10:3: cannot find package "currency/structures" in any of:
        /usr/lib/go-1.7/src/currency/structures (from $GOROOT)   
        ${Blockchain}/Model0/src/currency/structures (from $GOPATH)
Error =  None

cd newtxes and go install
newtxes.go:5:3: cannot find package "currency/himitsu" in any of:
        /usr/lib/go-1.7/src/currency/himitsu (from $GOROOT)
        ${Blockchain}/Model0/src/currency/himitsu (from $GOPATH)
newtxes.go:6:3: cannot find package "currency/methods" in any of:
        /usr/lib/go-1.7/src/currency/methods (from $GOROOT)
        ${Blockchain}/Model0/src/currency/methods (from $GOPATH)
newtxes.go:7:3: cannot find package "currency/structures" in any of:
        /usr/lib/go-1.7/src/currency/structures (from $GOROOT)   
        ${Blockchain}/Model0/src/currency/structures (from $GOPATH)
Error =  None

Am I missing key dependencies, or misconfiguring GOPATH?

MheniMerz commented 6 years ago

Hey Trevor, In order to get it to work you need to install Golang and configure the GOPATH and GOROOT properly. https://golang.org/doc/install. I think this link explains the install very well.

And, the python builder “gobuilder.py” generates executables that you can run just by typing their names ( ex: ./masterpay ) Without having to compile them again (ex: go build masterpay.go)

I hope this makes sense, contact me if you have any other questions. Thank you. Mheni

tkphd commented 6 years ago

Hi @MheniMerz,

From the go docs and your note, it seems that $GOROOT should point to the library path (/usr/local/go-1.7 in my case) and $GOPATH is an optional working directory, is that right?

The build errors above come with $GOROOT=/usr/local/go-1.7, no $GOPATH, and attempting to build with python gobuilder.py. My interpretation of the errors is that go is searching for your project files, such as himitsu.go, but it looks like the directory structure gobuilder.py expects is at odds with what the repository contains. Or, if an auxiliary library supplies currency/himitsu, for example, it is not part of the golang distribution and it should be listed as a separate dependency in the docs here.

Thanks.

tkphd commented 6 years ago

On a tangential note, I'm looking at this repo because the GSA Emerging Tech Atlas links to it. If I'm struggling to comprehend and use it, so will members of the public.

MheniMerz commented 6 years ago

Basically

tkphd commented 6 years ago
$ echo $GOROOT
/usr/lib/go-1.7
$ echo $GOPATH
/home/thor/go
$ ls $GOPATH
bin  pkg  src
$ python gobuilder.py
<throws the same error as above>

Do I need to copy/symlink the contents of this repo into my $GOPATH? If so, what directory structure is required? The go errors suggest some things should be in currency, some in scrooge, others in structures. It seems fairly opaque.

Thanks for your help, @MheniMerz!