edgex foundry的新版本已经由java转向了golang作为开发语言,在编译时,只要编译https://github.com/edgexfoundry/edgex-go下的代码即可
由于edgex foundry依赖于zeromq,所以编译edgex foundry,需要先编译zeromq,本章介绍的编译过程是在CentOS中进行,步骤如下:
第一步:编译zeromq
1)通过如下的命令,安装C和C++ 编译器
yum-y group install "Development Tools"
2)安装 libsodium
#下载最新稳定版本
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
#解压
tar xf LATEST.tar.gz&&cd libsodium-1.0.11
#编译
./configure&&make-j2&&make install
echo/usr/local/lib>/etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
3)配置环境变量
export sodium_CFLAGS="-I/usr/local/include"
export sodium_LIBS="-L/usr/local/lib"
export CPATH=/usr/local/include
export LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib
export LD_RUN_PATH=/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export CFLAGS=$(pkg-config --cflags libsodium)
export LDFLAGS=$(pkg-config --libs libsodium)
4)下载zeromq,并进行编译
wget https://archive.org/download/zeromq_4.1.4/zeromq-4.1.4.tar.gz
tar -xvf zeromq-4.1.4.tar.gz
cd zeromq-4.1.4
./configure&&make&&make install
第二步:编译edgex foundry
go get github.com/edgexfoundry/edgex-go
cd $GOPATH/src/github.com/edgexfoundry/edgex-go
glide install
make build