TheThingsArchive / packet_forwarder

Packet forwarder for Linux based gateways
MIT License
84 stars 92 forks source link

Build instructions won't work for me #82

Closed matthijskooijman closed 6 years ago

matthijskooijman commented 7 years ago

The build instructions say to use go get, which AFAICS clones the latest version of all dependencies. However, that does not neccesarily work (for example, the latest version of the ttn package does not work, I believe this is the cause of #77).

I originally started this issue suggesting to use some kind of vendoring approach. However, while writing it I found out that govendor is already installed by make dev-deps and used by make deps. However, the go get -u github.com/TheThingsNetwork/packet_forwarder suggested by the build instructions already fetches dependencies, and then returns failure because packet_forwarder cannot be compiled against them. To fix that, you should probably use git clone instead of go get to fetch packet_forwarder.

If you do that, a secondary problem is that, AFAICS, govendor is not installed into PATH by default, making make deps fail. This could either be fixed in the build instructions, or perhaps be fixed in the makefile by prepending $GOPATH/bin to PATH.

Combining the above suggestions, this is what I used to successfully build, on a system with no prior go environment set up.

export GOPATH=$(pwd)
export PATH=$GOPATH/bin:$PATH
git clone https://github.com/TheThingsNetwork/packet_forwarder src/github.com/TheThingsNetwork/packet_forwarder
cd src/github.com/TheThingsNetwork/packet_forwarder/
make dev-deps
make deps
make build
jeremyherbert commented 7 years ago

Having this problem too:

$ go get -u github.com/TheThingsNetwork/packet_forwarder
package github.com/TheThingsNetwork/ttn/api/gateway: cannot find package "github.com/TheThingsNetwork/ttn/api/gateway" in any of:
    /usr/lib/go-1.8/src/github.com/TheThingsNetwork/ttn/api/gateway (from $GOROOT)
    /home/vagrant/go/src/github.com/TheThingsNetwork/ttn/api/gateway (from $GOPATH)
package github.com/TheThingsNetwork/ttn/api/discovery: cannot find package "github.com/TheThingsNetwork/ttn/api/discovery" in any of:
    /usr/lib/go-1.8/src/github.com/TheThingsNetwork/ttn/api/discovery (from $GOROOT)
    /home/vagrant/go/src/github.com/TheThingsNetwork/ttn/api/discovery (from $GOPATH)
package github.com/TheThingsNetwork/ttn/api/fields: cannot find package "github.com/TheThingsNetwork/ttn/api/fields" in any of:
    /usr/lib/go-1.8/src/github.com/TheThingsNetwork/ttn/api/fields (from $GOROOT)
    /home/vagrant/go/src/github.com/TheThingsNetwork/ttn/api/fields (from $GOPATH)
package github.com/TheThingsNetwork/ttn/api/protocol: cannot find package "github.com/TheThingsNetwork/ttn/api/protocol" in any of:
    /usr/lib/go-1.8/src/github.com/TheThingsNetwork/ttn/api/protocol (from $GOROOT)
    /home/vagrant/go/src/github.com/TheThingsNetwork/ttn/api/protocol (from $GOPATH)
package github.com/TheThingsNetwork/ttn/api/protocol/lorawan: cannot find package "github.com/TheThingsNetwork/ttn/api/protocol/lorawan" in any of:
    /usr/lib/go-1.8/src/github.com/TheThingsNetwork/ttn/api/protocol/lorawan (from $GOROOT)
    /home/vagrant/go/src/github.com/TheThingsNetwork/ttn/api/protocol/lorawan (from $GOPATH)
package github.com/TheThingsNetwork/ttn/api/router: cannot find package "github.com/TheThingsNetwork/ttn/api/router" in any of:
    /usr/lib/go-1.8/src/github.com/TheThingsNetwork/ttn/api/router (from $GOROOT)
    /home/vagrant/go/src/github.com/TheThingsNetwork/ttn/api/router (from $GOPATH)