isula-build编译记录
isula-build官网:https://gitee.com/openeuler/isula-build
第一遍按照其文档编译时没成功,此处记录一下。
编译环境,直接在华为云申请一台:openEuler 20.03 64bit with ARM
使用root用户登录。
1.安装依赖包
yum install make btrfs-progs-devel device-mapper-devel glib2-devel gpgme-devel libassuan-devel libseccomp-devel git bzip2 systemd-devel golang
注意isula-build对go的版本是有要求的,需要1.15及以上,一开始没注意导致失败了。openeuler的源没这么新,这里手动安装一下。
2.安装新版本go
wget https://go.dev/dl/go1.17.6.linux-arm64.tar.gz
sha256sum go1.17.6.linux-arm64.tar.gz
tar -C /usr/local -xzf go1.17.6.linux-arm64.tar.gz
echo "export PATH=/usr/local/go/bin:\$PATH" >> ~/.bash_profile
echo "export GOPATH=$HOME/project" >> ~/.bash_profile
source ~/.bash_profile
注意:
1.此处将路径放到PATH之前,覆盖已有的版本
2.增加GOPATH,构建项目要在GOPATH下进行,所以下面创建了一个目录:$HOME/project/src
安装后查看版本:
# go version
go version go1.17.6 linux/arm64
3.编译isula-build
mkdir -p $HOME/project/src
cd $HOME/project/src
git clone https://gitee.com/openeuler/isula-build.git
git clone下来的目录名称就叫isula-build
,如果是下载的zip,也将目录名称改为isula-build
。
# cd isula-build
# make safe
Safe building isula-build...
mkdir -p /tmp/isula_build_tmpdir
GO111MODULE=on; go build -mod=vendor -ldflags '-buildid=IdByIsula -buildmode=pie -extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow -tmpdir=/tmp/isula_build_tmpdir -X isula.org/isula-build/pkg/version.GitCommit=a516522 -X isula.org/isula-build/pkg/version.BuildInfo=1641728573 -X isula.org/isula-build/pkg/version.Version=0.9.6 -linkmode=external -extldflags=-static' -o bin/isula-build -tags "seccomp" ./cmd/cli 2>/dev/null
GO111MODULE=on; go build -mod=vendor -ldflags '-buildid=IdByIsula -buildmode=pie -extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow -tmpdir=/tmp/isula_build_tmpdir -X isula.org/isula-build/pkg/version.GitCommit=a516522 -X isula.org/isula-build/pkg/version.BuildInfo=1641728573 -X isula.org/isula-build/pkg/version.Version=0.9.6 ' -o bin/isula-builder -tags "seccomp" ./cmd/daemon
Safe build isula-build done!
# echo $?
0
# ll bin
total 48M
-rwx------ 1 root root 15M Jan 9 19:43 isula-build
-rwx------ 1 root root 33M Jan 9 19:44 isula-builder
可以看到在bin目录下生成了两个二进制文件,isula-build
是客户端,isula-builder
是服务端。
本文来自博客园,作者:ssh_alitheia,转载请注明原文链接:https://www.cnblogs.com/shanchuan/p/15782011.html