- What Grafana version and what operating system are you using?
v8.4.6
-
What are you trying to achieve?
I want use nfpm package grafana in sourcecode generate rpm for arm64 arch in x86_64 environment, this can avoid depend on others like urw-fonts . -
How are you trying to achieve it?
-
compile env prepare
-
0、install git
yum -y install git -
1、install golang
[root@demo BUILDSCRIPTS_CTREMEL]# cat /etc/profile|grep GO
export GOROOT=/usr/local/go
export GOPATH=/root/gocode
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
export GOPROXY=https://goproxy.io,direct -
2、install nodejs
npm root -g
npm install express -g
npm install -g cnpm
npm install -g yarn
npm config set registry
npm install -g @vue/cli
cnpm install -g @vue/cli
yarn -v
cnpm -v -
some conf
[root@demo BUILDSCRIPTS_CTREMEL]# tail -5 /etc/profile
#set nodejs npm yarn environment
export NODE_HOME=/usr/local/nodejs
export PATH=$NODE_HOME/bin:$PATH -
make rpmbuild config file
[root@demo ~]# mkdir -p gocode
[root@demo ~]# cd gocode/
[root@demo gocode]# ll
total 0
drwxr-xr-x 2 root root 58 Aug 17 09:52 bin
drwxr-xr-x 4 root root 30 Aug 16 16:38 BUILDSCRIPTS_CTREMEL
drwxr-xr-x 4 root root 30 Aug 16 16:57 pkg
drwxr-xr-x 5 root root 61 Aug 16 16:37 src
[root@demo gocode]# mkdir -p BUILDSCRIPTS_CTREMEL/{conf,dist}
[root@demo gocode]# ll BUILDSCRIPTS_CTREMEL/
total 0
drwxr-xr-x 2 root root 31 Aug 17 10:27 conf
drwxr-xr-x 2 root root 40 Aug 17 09:59 dist
[root@demo gocode]# cd BUILDSCRIPTS_CTREMEL/
[root@demo BUILDSCRIPTS_CTREMEL]# ll
total 0
drwxr-xr-x 2 root root 31 Aug 17 10:27 conf
drwxr-xr-x 2 root root 40 Aug 17 09:59 dist
[root@demo BUILDSCRIPTS_CTREMEL]#
[root@demo BUILDSCRIPTS_CTREMEL]# pwd
/root/gocode/BUILDSCRIPTS_CTREMEL
[root@demo BUILDSCRIPTS_CTREMEL]# vim conf/grafana_nfpm.yaml
[root@demo BUILDSCRIPTS_CTREMEL]# cat conf/grafana_nfpm.yaml -
grafana_nfpm.yaml
name: "grafana"
arch: "aarch64"
platform: "linux"
version: "8.4.6"
section: "default"
priority: "extra"
release: 1
replaces:
- grafana
provides:
- grafana-server
- grafana-cli
depends:
- coreutils
- shadow-utils
maintainer: "<contact@grafana.com>"
description: |
Grafana
vendor: "Grafana"
homepage: "https://grafana.com"
license: "Apache 2"
contents:
- src: ./bin/linux-amd64/grafana-server
dst: /usr/sbin/grafana-server
- src: ./bin/linux-amd64/grafana-cli
dst: /usr/sbin/grafana-cli
- src: ./packaging/rpm/init.d/grafana-server
dst: /etc/init.d/grafana-server
- src: ./packaging/rpm/sysconfig/grafana-server
dst: /etc/sysconfig/grafana-server
type: config|noreplace
- src: ./packaging/rpm/systemd/grafana-server.service
dst: /usr/lib/systemd/system/grafana-server.service
- src: ./public/
dst: /usr/share/grafana/public
- src: ./conf/
dst: /usr/share/grafana/conf
- src: ./conf/
dst: /etc/grafana
scripts:
postinstall: ./packaging/rpm/control/postinst
rpm:
scripts:
posttrans: ./packaging/rpm/control/posttrans
- build.sh in ~/go/src/github.com/grafana dir
#!/usr/bin/bash
export NODE_OPTIONS=--max-old-space-size=8192
export GRAFANA_VERSION="v8.4.6"
export GOPATH=/root/go
export PATH=${GOPATH}/bin:${PATH}
cd ${GOPATH}/src/github.com/grafana
rm -rf grafana
git clone https://github.com/grafana/grafana
cd grafana
git checkout -f $GRAFANA_VERSION
BUILD_VERSION=$(git describe --tags)
if [[ "$BUILD_VERSION" != "$GRAFANA_VERSION" ]]; then
echo "Version missmatch, look after git tag"
exit 1
else
yarn install
yarn build
make gen-go
go run build.go setup
go run build.go build
# Todo rpm build with nfpm
${GOPATH}/bin/nfpm pkg --packager rpm --config ${GOPATH}/BUILDSCRIPTS_CTREMEL/conf/grafana_nfpm_arm.yaml --target ${GOPATH}/BUILDSCRIPTS_CTREMEL/dist
fi
- What happened?
when build.sh execute go run build.go build ,some errors happend
[root@mathewwu ~/go/src/github.com/grafana/grafana]# go run build.go -goarch=arm64 -cc=aarch64-none-linux-gnu-gcc -goos=linux build
-
What did you expect to happen?
I was nfpm build success in this way before, but arm64 arch happend error , I don’t know how what should i do? Does anyone know what’s going on? -
Can you copy/paste the configuration(s) that you are having problems with?
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
-
Did you follow any online instructions? If so, what is the URL?