龙芯电脑编译portainer过程

1、环境说明

     操作系统:loongnix-server

     golang环境:yum install golang-1.18

export ¥=/opt/gocode
go env -w GOPROXY=http://goproxy.loongnix.cn:3000,direct
go env -w GOSUMDB=off

     node环境:yum install nodejs

     npm环境:npm install -g npm@latest

     yarn安装:npm install -g yarn

    portainer源码:2.9.0

2、下载源码

    下载地址:https://github.com/portainer/portainer 

     下载后解压到$GOPATH/src/github.com/portainer下

3、直接执行yarn & yarn start

    报错一:Fatal error: Unable to find local grunt.

npm install -g grunt-cli
npm install -g grunt
npm install grunt --save-dev

   报错二:

go: downloading golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b
go: downloading golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54
verifying golang.org/x/sys@v0.0.0-20210331175145-43e1dd70ce54: checksum mismatch
    downloaded: h1:5HZZhvdNN0O5KldlyABQ6eFwlX3k1RRGy0D+JtnQ0zU=
    go.sum:     h1:rF3Ohx8DRyl8h2zw9qojyLHLhrJpEMgyPOImREEryf0=

  解决:切换到api目录,将api目录下go.sum删除,然后执行go mod tidy

  报错三:

>> # github.com/boltdb/bolt
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:101:13: undeclared name maxMapSize for array length
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:317:12: undefined: maxMapSize
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:335:10: undefined: maxMapSize
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:336:8: undefined: maxMapSize
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:795:2: pos declared but not used
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/bolt_unix.go:62:15: undeclared name maxMapSize for array length
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/bucket.go:135:15: undefined: brokenUnaligned
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/freelist.go:166:2: idx declared but not used
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/freelist.go:169:19: undeclared name maxAllocSize for array length
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/freelist.go:176:14: undeclared name maxAllocSize for array length
>> /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/freelist.go:166:2: too many errors

  解决:

 cd /opt/gocode/pkg/mod/github.com/boltdb/bolt@v1.3.1/
cp bolt_amd64.go bolt_loong64.go

   报错四:编译完成后,生成dist文件夹,里边有portainer可执行文件,执行./portainer会报错:

INFO 2022/08/17 17:20:53 [INFO] [internal,ssl] [message: no cert files found, generating self signed ssl certificates] 
INFO 2022/08/17 17:20:53 [INFO] [main,compose] [message: binary is missing, falling-back to compose plugin] [error: docker-compose binary not found] 
INFO 2022/08/17 17:20:53 failed creating compose manager: docker-compose binary not found 

  解决:找到本地的docker-compose直接放入替代(docker-compose先需要在本地安装,后续补充安装方法)

[root@Master build]# whereis docker-compose
docker-compose: /usr/local/bin/docker-compose
[root@Master build]# cd /usr/local/bin/
[root@Master bin]# cp docker-compose /opt/gocode/src/github.com/portainer/dist
然后cd /opt/gocode/src/github.com/portainer/
yarn start
posted @ 2022-08-18 11:07  silent  阅读(362)  评论(1编辑  收藏  举报