Icinga / icinga-packaging

Packaging documentation and issues for the official Icinga repository
https://packages.icinga.com
44 stars 15 forks source link

icingadb: Build dependency for Go missing and not resolvable on Debian stable #278

Closed Iceforgedmvp closed 1 year ago

Iceforgedmvp commented 1 year ago

Hi folks,

I'm trying to build deb packages for Icinga. I'm using the source packages for Debian 11 (bullseye) for building the final deb packages. I succeeded in building icingadb-redis but fail to build the deb package for icingadb.

Observed behaviour

Unfortunately, the build dependency for Go is missing and I'm not able to solve the problem. When executing debuild, I get the following error:

~/icinga-build/icingadb-1.0.0$ debuild
...
dpkg-source: info: building icingadb in icingadb_1.0.0-1.bullseye+yolo1.dsc
 debian/rules build
dh build --with systemd
dh: warning: Compatibility levels before 10 are deprecated (level 9 in use)
   dh_update_autotools_config
   debian/rules override_dh_auto_build
make[1]: Entering directory '/home/dummy/icinga-build/icingadb-1.0.0'
go build -buildvcs=false -trimpath ./cmd/icingadb
make[1]: go: No such file or directory
make[1]: *** [debian/rules:12: override_dh_auto_build] Error 127
make[1]: Leaving directory '/home/dummy/icinga-build/icingadb-1.0.0'
make: *** [debian/rules:9: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui failed

Installing golang-go does not help as it leads to the next error:

~/icinga-build/icingadb-1.0.0$ debuild
...
make[1]: Entering directory '/home/dummy/icinga-build/icingadb-1.0.0'
go build -buildvcs=false -trimpath ./cmd/icingadb
flag provided but not defined: -buildvcs
usage: go build [-o output] [-i] [build flags] [packages]
Run 'go help build' for details.
make[1]: *** [debian/rules:12: override_dh_auto_build] Error 2
make[1]: Leaving directory '/home/dummy/icinga-build/icingadb-1.0.0'
make: *** [debian/rules:9: build] Error 2

Removing '-buildvcs=false' does not help as I finally end up with this error:

~/icinga-build/icingadb-1.0.0$ debuild
...
pkg/icingadb/overdue/sync.go:5:2: package embed is not in GOROOT (/usr/lib/go-1.15/src/embed)
pkg/icingaredis/telemetry/heartbeat.go:16:2: package runtime/metrics is not in GOROOT (/usr/lib/go-1.15/src/runtime/metrics)
make[1]: *** [debian/rules:12: override_dh_auto_build] Error 1

According to my research, Golang Embed requires at least Go 1.16 but Debian stable only provides Go 1.15: https://github.com/sigstore/fulcio/issues/253#issuecomment-985634704

Expected behaviour

  1. Go should be added to the build dependencies section of the debian package
  2. A solution for the errors/problems above

How to reproduce

You can reproduce the error on a x86_64 machine or arm64 like this:

  1. Set up the debian repository like this: https://icinga.com/docs/icinga-2/latest/doc/02-installation/01-Debian/#debian-repository
  2. Next steps:
apt install build-essential devscripts # Setup build tooling

apt source icingadb # Fetch the source package
cd icingadb-1.0.0
dch --local +yolo # Update the changelog

apt-get build-dep icingadb # Install the build dependencies

debuild # Build the deb package
julianbrost commented 1 year ago

At the moment, Icinga DB requires at least Go 1.18 to build. This is newer than what most distributions provide in their repositories, thus, we build the packages with Go installed locally from https://go.dev/dl/ which is not modeled as a build dependency as there are no deb or rpm packages for it. At the moment, we don't have plans for changing this. So if you want to build the packages, you have to provide a recent enough go version yourself. If there are packages with a suitable version available, those should just work with an addtional golang (>= 1.18) build dependency.