Bug#1026696: golang-github-prometheus-client-model: FTBFS: make: *** [debian/rules:6: binary] Error 25
On 22.12.22 20:52, Shengjing Zhu wrote: Hmm, this works for me, the generated pb.go uses old timestamp type. I have added above change and built the package, then checked the result. My mistake, I think I must have looked at a stale build. The suggested .proto mapping workaround seems to do what we need. I'll upload a new release shortly. OpenPGP_signature Description: OpenPGP digital signature
Bug#1026696: golang-github-prometheus-client-model: FTBFS: make: *** [debian/rules:6: binary] Error 25
On Thu, Dec 22, 2022 at 02:46:49PM +1300, Daniel Swarbrick wrote: > Updating the 01-Use_go_generate.patch as follows results in a successful > build (without needing to add golang-google-protobuf-dev as a dependency): > > diff --git a/debian/patches/01-Use_go_generate.patch > b/debian/patches/01-Use_go_generate.patch > index cafa5e2..ffa83cf 100644 > --- a/debian/patches/01-Use_go_generate.patch > +++ b/debian/patches/01-Use_go_generate.patch > @@ -6,4 +6,4 @@ Description: Use go generate to avoid depending on special > make rules in > @@ -0,0 +1,3 @@ > +package io_prometheus_client > + > -+//go:generate protoc --proto_path=../io/prometheus/client > --go_out=paths=source_relative:. metrics.proto > ++//go:generate protoc --proto_path=../io/prometheus/client > --go_out=paths=source_relative,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp:. > metrics.proto > > However, the generated metrics.pb.go still uses *timestamppb.Timestamp for > the timestamp fields, which will cause undesirable side-effects on > downstream packages. > > I am not aware of any way to influence protoc to use the old timestamp type. Hmm, this works for me, the generated pb.go uses old timestamp type. I have added above change and built the package, then checked the result.
Bug#1026696: golang-github-prometheus-client-model: FTBFS: make: *** [debian/rules:6: binary] Error 25
Updating the 01-Use_go_generate.patch as follows results in a successful build (without needing to add golang-google-protobuf-dev as a dependency): diff --git a/debian/patches/01-Use_go_generate.patch b/debian/patches/01-Use_go_generate.patch index cafa5e2..ffa83cf 100644 --- a/debian/patches/01-Use_go_generate.patch +++ b/debian/patches/01-Use_go_generate.patch @@ -6,4 +6,4 @@ Description: Use go generate to avoid depending on special make rules in @@ -0,0 +1,3 @@ +package io_prometheus_client + -+//go:generate protoc --proto_path=../io/prometheus/client --go_out=paths=source_relative:. metrics.proto ++//go:generate protoc --proto_path=../io/prometheus/client --go_out=paths=source_relative,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp:. metrics.proto However, the generated metrics.pb.go still uses *timestamppb.Timestamp for the timestamp fields, which will cause undesirable side-effects on downstream packages. I am not aware of any way to influence protoc to use the old timestamp type. OpenPGP_signature Description: OpenPGP digital signature
Bug#1026696: golang-github-prometheus-client-model: FTBFS: make: *** [debian/rules:6: binary] Error 25
Hi, On 22.12.22 00:41, Shengjing Zhu wrote: Hi, The workaroud could be like this: https://salsa.debian.org/go-team/packages/notary/-/commit/b0a072faa72857f7523c8245ecaa8814d5a60051 Fixing the build failure in golang-github-prometheus-client-model is a simple matter of including golang-google-protobuf-dev in the build-deps. However, as the resulting metrics.pb.go now has a different type for the timestamp fields, and downstream packages that use this will likely need patching. I already had to patch golang-github-prometheus-common[1] and golang-github-prometheus-client-golang[2] for similar issues not long ago. With those patches in place, and the new metrics.pb.go, those packages FTBFS. Dropping those patches fixes the build, but prometheus-common then panics with a Go reflect error in one of the tests. So I'm not really sure of the best course of action at the moment. [1]: https://salsa.debian.org/go-team/packages/golang-github-prometheus-common/-/blob/debian/sid/debian/patches/01-support-outdated-protobuf-build-deps.patch [2]: https://salsa.debian.org/go-team/packages/golang-github-prometheus-client-golang/-/blob/debian/sid/debian/patches/02-support-outdated-protobuf-build-deps.patch OpenPGP_signature Description: OpenPGP digital signature
Bug#1026696: golang-github-prometheus-client-model: FTBFS: make: *** [debian/rules:6: binary] Error 25
Hi, On Wed, Dec 21, 2022 at 04:57:39PM +1300, Daniel Swarbrick wrote: > After a fair amount of head scratching, I tracked this down to a change in > behaviour of the protobuf compiler. Version 3.14.0+ generates slightly > different pb.go files with respect to the timestamp type (and possibly > others): > > --- metrics.pb.go.old 2022-11-08 23:31:00.0 +1300 > +++ metrics.pb.go.new 2022-11-08 23:31:00.0 +1300 > @@ -6,7 +6,7 @@ > import ( > fmt "fmt" > proto "github.com/golang/protobuf/proto" > - timestamp "github.com/golang/protobuf/ptypes/timestamp" > + timestamppb "google.golang.org/protobuf/types/known/timestamppb" > math "math" > ) Mathias Gibbens has asked the same problem on debian-go@list.d.o somedays ago. https://lists.debian.org/debian-go/2022/12/msg00024.html The workaroud could be like this: https://salsa.debian.org/go-team/packages/notary/-/commit/b0a072faa72857f7523c8245ecaa8814d5a60051
Bug#1026696: golang-github-prometheus-client-model: FTBFS: make: *** [debian/rules:6: binary] Error 25
After a fair amount of head scratching, I tracked this down to a change in behaviour of the protobuf compiler. Version 3.14.0+ generates slightly different pb.go files with respect to the timestamp type (and possibly others): --- metrics.pb.go.old 2022-11-08 23:31:00.0 +1300 +++ metrics.pb.go.new 2022-11-08 23:31:00.0 +1300 @@ -6,7 +6,7 @@ import ( fmt "fmt" proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" math "math" ) @@ -629,12 +629,12 @@ } type Exemplar struct { - Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"` - Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"` - Timestamp *timestamp.Timestamp `protobuf:"bytes,3,opt,name=timestamp" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"` + Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"` + Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp" json:"timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Exemplar) Reset() { *m = Exemplar{} } @@ -676,7 +676,7 @@ return 0 } -func (m *Exemplar) GetTimestamp() *timestamp.Timestamp { +func (m *Exemplar) GetTimestamp() *timestamppb.Timestamp { if m != nil { return m.Timestamp } I was surprised that the protobuf _compiler_ was responsible for this change, but verified with an older snapshot of the package (3.12.4-1+b5) that the previous behaviour was restored. Snapshot versions 3.14.0-1 and later produce the newer style generated pb.go file, referencing timestamppb.Timestamp. The upstream changelogs for the protobuf compiler do not list any Go-related changes in version 3.13.x, however for version 3.14.0 the following is mentioned: Go: * Update go_package options to reference google.golang.org/protobuf module. I strongly suspect that this resulted in the change in the generated pb.go file. The Makefile in prometheus/client_model also pins the protobuf compiler version to 3.13.0: # Need to be on a previous version that doesn't cause the updated WKT go_package values to be added. PROTOC_VERSION := 3.13.0 OpenPGP_signature Description: OpenPGP digital signature
Bug#1026696: golang-github-prometheus-client-model: FTBFS: make: *** [debian/rules:6: binary] Error 25
Source: golang-github-prometheus-client-model Version: 0.3.0-1 Severity: serious Justification: FTBFS Tags: bookworm sid ftbfs User: lu...@debian.org Usertags: ftbfs-20221220 ftbfs-bookworm Hi, During a rebuild of all packages in sid, your package failed to build on amd64. Relevant part (hopefully): > debian/rules binary > dh binary --builddirectory=_build --buildsystem=golang >dh_update_autotools_config -O--builddirectory=_build -O--buildsystem=golang >dh_autoreconf -O--builddirectory=_build -O--buildsystem=golang >dh_auto_configure -O--builddirectory=_build -O--buildsystem=golang >dh_auto_build -O--builddirectory=_build -O--buildsystem=golang > cd _build && go generate -v github.com/prometheus/client_model/go > src/github.com/prometheus/client_model/go/generate.go > src/github.com/prometheus/client_model/go/metrics.pb.go > cd _build && go install -trimpath -v -p 8 > github.com/prometheus/client_model/go > src/github.com/prometheus/client_model/go/metrics.pb.go:9:2: cannot find > package "google.golang.org/protobuf/types/known/timestamppb" in any of: > /usr/lib/go-1.19/src/google.golang.org/protobuf/types/known/timestamppb > (from $GOROOT) > > /<>/_build/src/google.golang.org/protobuf/types/known/timestamppb > (from $GOPATH) > dh_auto_build: error: cd _build && go install -trimpath -v -p 8 > github.com/prometheus/client_model/go returned exit code 1 > make: *** [debian/rules:6: binary] Error 25 The full build log is available from: http://qa-logs.debian.net/2022/12/20/golang-github-prometheus-client-model_0.3.0-1_unstable.log All bugs filed during this archive rebuild are listed at: https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=ftbfs-20221220;users=lu...@debian.org or: https://udd.debian.org/bugs/?release=na=ign=7=7=only=ftbfs-20221220=lu...@debian.org=1=1=1=1#results A list of current common problems and possible solutions is available at http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute! If you reassign this bug to another package, please mark it as 'affects'-ing this package. See https://www.debian.org/Bugs/server-control#affects If you fail to reproduce this, please provide a build log and diff it with mine so that we can identify if something relevant changed in the meantime.