1. 安装zeromq库
根据setup script安装:
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz tar xvzf zeromq-4.2.2.tar.gz cd zeromq-4.2.2 ./configure sudo make install sudo ldconfig ldconfig -p | grep zmq libzmq.so.5 (libc6,x86-64) => /usr/local/lib/libzmq.so.5 libzmq.so (libc6,x86-64) => /usr/local/lib/libzmq.so export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
2. 获取源码
go get github.com/edgexfoundry/edgex-go
3. 安装依赖包
$ glide install [INFO] Lock file (glide.lock) does not exist. Performing update. [INFO] Downloading dependencies. Please wait... [INFO] --> Fetching updates for github.com/BurntSushi/toml [INFO] --> Fetching updates for github.com/eclipse/paho.mqtt.golang [INFO] --> Fetching updates for github.com/stretchr/testify [INFO] --> Fetching updates for github.com/hashicorp/consul [INFO] --> Fetching updates for github.com/docker/docker [INFO] --> Fetching updates for github.com/gorilla/mux [INFO] --> Fetching updates for github.com/docker/go-units [INFO] --> Fetching updates for github.com/go-zoo/bone [INFO] --> Fetching updates for github.com/docker/go-connections [INFO] --> Fetching updates for github.com/mitchellh/consulstructure [INFO] --> Fetching updates for github.com/pelletier/go-toml [INFO] --> Fetching updates for github.com/pebbe/zmq4 [INFO] --> Fetching updates for github.com/robfig/cron [INFO] --> Fetching updates for gopkg.in/mgo.v2 [INFO] --> Fetching updates for gopkg.in/yaml.v2 [INFO] --> Fetching updates for github.com/mattn/go-xmpp [INFO] --> Fetching updates for github.com/satori/go.uuid [INFO] --> Fetching updates for github.com/magiconair/properties [INFO] --> Fetching updates for github.com/docker/distribution [INFO] --> Fetching updates for github.com/gomodule/redigo [INFO] --> Setting version for github.com/mattn/go-xmpp to e543ad3fcd51155e4b39f7487bdfcb5e3772f1ce. [INFO] --> Setting version for github.com/docker/docker to b1116479b23434de7d70710b6454af7cb2484a58. [INFO] --> Setting version for github.com/docker/go-connections to 97c2040d34dfae1d1b1275fa3a78dbdd2f41cf7e. [INFO] --> Setting version for github.com/docker/go-units to 47565b4f722fb6ceae66b95f853feed578a4a51c. [INFO] --> Setting version for github.com/BurntSushi/toml to a368813c5e648fee92e5f6c30e3944ff9d5e8895. [INFO] --> Setting version for github.com/mitchellh/consulstructure to b407c521973b7b902db2f09e65dbf5cb10f2dc5f. [INFO] --> Setting version for github.com/docker/distribution to 16128bbac47f75050e82f7e91b04df33775e0c23. [INFO] --> Setting version for github.com/go-zoo/bone to 9eaad4b99a9a66b85c0cc32cb9691621ccfa4278. [INFO] --> Detected semantic version. Setting version for github.com/pelletier/go-toml to v1.2.0 [INFO] --> Detected semantic version. Setting version for github.com/hashicorp/consul to v1.1.0 [INFO] --> Detected semantic version. Setting version for github.com/stretchr/testify to v1.2.1 [INFO] --> Detected semantic version. Setting version for github.com/gorilla/mux to v1.3.0 [INFO] --> Detected semantic version. Setting version for github.com/pebbe/zmq4 to v1.0.0 [INFO] --> Detected semantic version. Setting version for github.com/robfig/cron to v1.1.0 [INFO] --> Detected semantic version. Setting version for github.com/gomodule/redigo to v2.0.0 [INFO] --> Detected semantic version. Setting version for github.com/magiconair/properties to v1.8.0 [INFO] --> Detected semantic version. Setting version for github.com/satori/go.uuid to v1.2.0 [INFO] --> Detected semantic version. Setting version for github.com/eclipse/paho.mqtt.golang to v1.1.1 [INFO] --> Setting version for gopkg.in/mgo.v2 to 3f83fa5005286a7fe593b055f0d7771a7dce4655. [INFO] --> Setting version for gopkg.in/yaml.v2 to eb3733d160e74a9c7e442f435eb3bea458e1d19f. [INFO] Resolving imports [INFO] --> Fetching updates for github.com/gorilla/context [INFO] --> Fetching updates for github.com/davecgh/go-spew [INFO] --> Fetching updates for github.com/pmezard/go-difflib [INFO] --> Fetching updates for github.com/stretchr/objx [INFO] --> Fetching golang.org/x/net/proxy [WARN] Unable to checkout golang.org/x/net/proxy [ERROR] Error looking for golang.org/x/net/proxy: Cannot detect VCS [INFO] --> Fetching golang.org/x/net/websocket [WARN] Unable to checkout golang.org/x/net/websocket [ERROR] Error looking for golang.org/x/net/websocket: Cannot detect VCS [INFO] --> Fetching updates for github.com/influxdata/influxdb [INFO] --> Fetching updates for github.com/hashicorp/go-cleanhttp [INFO] --> Fetching updates for github.com/hashicorp/go-rootcerts [INFO] --> Fetching updates for github.com/hashicorp/serf [INFO] --> Fetching updates for github.com/cenkalti/backoff [INFO] --> Fetching updates for github.com/mitchellh/copystructure [INFO] --> Fetching updates for github.com/mitchellh/mapstructure [INFO] --> Fetching updates for github.com/opencontainers/go-digest [INFO] --> Fetching updates for github.com/pkg/errors [INFO] --> Fetching golang.org/x/net/context/ctxhttp [WARN] Unable to checkout golang.org/x/net/context/ctxhttp [ERROR] Error looking for golang.org/x/net/context/ctxhttp: Cannot detect VCS [ERROR] Error scanning github.com/influxdata/influxdb/client/v2: cannot find package "." in: /home/wang/.glide/cache/src/https-github.com-influxdata-influxdb/client/v2 [INFO] --> Fetching updates for github.com/mitchellh/go-homedir [INFO] --> Fetching updates for github.com/armon/go-metrics [INFO] --> Fetching updates for github.com/mitchellh/reflectwalk [INFO] --> Fetching updates for github.com/opencontainers/image-spec [INFO] --> Fetching updates for github.com/Microsoft/go-winio [WARN] Unable to set version on golang.org/x/net/proxy to . Err: Cannot detect VCS [INFO] --> Fetching updates for github.com/hashicorp/go-immutable-radix [INFO] --> Fetching updates for github.com/gogo/protobuf [INFO] --> Fetching golang.org/x/sys/windows [WARN] Unable to checkout golang.org/x/sys/windows [ERROR] Error looking for golang.org/x/sys/windows: Cannot detect VCS [INFO] --> Fetching updates for github.com/hashicorp/golang-lru [WARN] Unable to set version on golang.org/x/sys/windows to . Err: Cannot detect VCS [ERROR] Failed to retrieve a list of dependencies: Error resolving imports
提取如下依赖包错误:
golang.org/x/net/proxy golang.org/x/net/websocket golang.org/x/net/context/ctxhttp golang.org/x/sys/windows
glide搜索到的包应该以git或svn等vcs,但上述proxy、websocket和ctxhttp是net的子包,golang.org/x/net/采用git管理。同样,golang.org/x/sys采用git管理,windows是sys的子目录。此时,可在glide.yaml中指定golang.org/x/net和golang.org/x/sys的子包关系:
- package: golang.org/x/net subpackages: - proxy - websocket - context/ctxhttp - package: golang.org/x/sys subpackages: - windows
此时,直接设置git管理包的镜像即可,mirror设置:
glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git glide mirror set golang.org/x/sys https://github.com/golang/sys --vcs git
此时,glide install成功执行。
注:若安装的依赖包出现错误,可能是包版本不对,需要在glide.yaml中指定软件包的版本(如master中已不包含原来的目录,导致包检索依赖不成功,github.com/influxdata/influxdb/client/v2最新版没有client目录)。
4. 编译
make prepare
make build
5. 启动mongodb,然后直接运行make run即可。
参考:
原文:https://www.cnblogs.com/embedded-linux/p/10920032.html