Bug 2078777

Summary: podman fails to compile with golang-1.18
Product: Red Hat Enterprise Linux 8 Reporter: Jindrich Novy <jnovy>
Component: golangAssignee: David Benoit <dbenoit>
Status: CLOSED DUPLICATE QA Contact: Edjunior Barbosa Machado <emachado>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 8.7CC: asm, emachado, sipoyare, tstellar, vrothber
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-11 08:20:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jindrich Novy 2022-04-26 07:48:08 UTC
Description of problem:
+ GO111MODULE=off
+ go build -buildmode pie -compiler gc '-tags=rpm_crashtraceback remote seccomp btrfs_noversion exclude_graphdriver_devicemapper exclude_graphdriver_btrfs libdm_no_deferred_remove selinux systemd libsubid' -ldflags ' -linkmode=external -compressdwarf=false -B 0x120bcfebae6f11029aff2c514eb87a4fd0e6731a -extldflags '\''-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'\''' -a -v -o bin/gvproxy github.com/containers/gvisor-tap-vsock/cmd/gvproxy
package github.com/containers/gvisor-tap-vsock/cmd/gvproxy
	imports github.com/containers/gvisor-tap-vsock/pkg/virtualnetwork
	imports github.com/containers/gvisor-tap-vsock/pkg/services/dhcp
	imports github.com/containers/gvisor-tap-vsock/pkg/tap
	imports gvisor.dev/gvisor/pkg/tcpip
	imports gvisor.dev/gvisor/pkg/state
	imports gvisor.dev/gvisor/pkg/state/wire
	imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /builddir/build/BUILD/podman-62534053086fdeba7b93117e7c4dc6e797835a3e/gvisor-tap-vsock-0.1.0/_build/src/github.com/containers/gvisor-tap-vsock/vendor/gvisor.dev/gvisor/pkg/gohacks
error: Bad exit status from /var/tmp/rpm-tmp.TjfgxM (%build)
    Bad exit status from /var/tmp/rpm-tmp.TjfgxM (%build)
RPM build errors:
Child return code was: 1

Can you please advise what causes this? It compiles fine with 1.16.5 or 1.17.x. Thanks!

Comment 2 Valentin Rothberg 2022-04-28 09:23:00 UTC
The build constraints in the affected package are:
//go:build go1.13 && !go1.19 
// +build go1.13,!go1.19     

I assume that the RHEL go 1.18 package got it's internal version wrong?

Comment 3 Valentin Rothberg 2022-04-28 09:36:28 UTC
I setup a RHEL 8.7 VM and tried to reproduce manually with golang-1.18.0-2.module+el8.7.0+14880+f5e30240.src.rpm.

Unfortunately, it compiles just fine.  I do not know why the package build fails.

Comment 4 Jindrich Novy 2022-05-10 08:04:03 UTC
Still the same error in podman-4.1.0: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=45157418

Comment 5 Edjunior Barbosa Machado 2022-05-10 15:34:56 UTC
Looks like the build fails due to constraints in the gvisor-tap-vsock code being used (+build !go1.18):

[root@sheep-41 ~]# rpm -ivh podman-4.1.0-1.module%2Bel8.7.0%2B15189%2Be48d4702.src.rpm                                                                                                                                                        
Updating / installing...                                                                                                                                                                                                                      
   1:podman-2:4.1.0-1.module+el8.7.0+1warning: user mockbuild does not exist - using root                                                                                                                                                     
warning: group mock does not exist - using root                                                                                                                                                                                               
warning: user mockbuild does not exist - using root                                                                                                                                                                                           
warning: group mock does not exist - using root                                                                                                                                                                                               
warning: user mockbuild does not exist - using root                                                                                                                                                                                           
warning: group mock does not exist - using root                                                                                                                                                                                               
warning: user mockbuild does not exist - using root                                                                                                                                                                                           
warning: group mock does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mock does not exist - using root                   
################################# [100%]                           
warning: user mockbuild does not exist - using root
warning: group mock does not exist - using root
[root@sheep-41 ~]# rpmbuild -bb rpmbuild/SPECS/podman.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.J9FpNa                                                                                                                                                                                           
+ umask 022                                                                  
+ cd /root/rpmbuild/BUILD                                            
+ cd /root/rpmbuild/BUILD                                                                                                                                        
+ rm -rf podman-e4b03902052294d4f342a185bb54702ed5bed8b1                                            
+ /usr/bin/gzip -dc /root/rpmbuild/SOURCES/podman-4.1.0-e4b0390.tar.gz                                                                                                                                                                        
+ /usr/bin/tar -xof -                                                                              
+ STATUS=0                                                                                                            
+ '[' 0 -ne 0 ']'                                                                                                                              
+ cd podman-e4b03902052294d4f342a185bb54702ed5bed8b1                                                                                                                                                                                          
(...)
+ export GOPATH=/root/rpmbuild/BUILD/podman-e4b03902052294d4f342a185bb54702ed5bed8b1/gvisor-tap-vsock-0.1.0/_build:/root/rpmbuild/BUILD/podman-e4b03902052294d4f342a185bb54702ed5bed8b1/gvisor-tap-vsock-0.1.0
+ GOPATH=/root/rpmbuild/BUILD/podman-e4b03902052294d4f342a185bb54702ed5bed8b1/gvisor-tap-vsock-0.1.0/_build:/root/rpmbuild/BUILD/podman-e4b03902052294d4f342a185bb54702ed5bed8b1/gvisor-tap-vsock-0.1.0
++ tr -d ' \n'
++ head -c20 /dev/urandom
++ od -An -tx1
+ GO111MODULE=off
+ go build -buildmode pie -compiler gc '-tags=rpm_crashtraceback remote seccomp btrfs_noversion exclude_graphdriver_devicemapper exclude_graphdriver_btrfs  selinux systemd libsubid' -ldflags ' -linkmode=external -compressdwarf=false -B 0x19bc6107f0b6fa47cb2d830cec152a417a0bf130 -extldflags '\''-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'\''' -a -v -o bin/gvproxy github.com/containers/gvisor-tap-vsock/cmd/gvproxy
package github.com/containers/gvisor-tap-vsock/cmd/gvproxy
        imports github.com/containers/gvisor-tap-vsock/pkg/virtualnetwork
        imports github.com/containers/gvisor-tap-vsock/pkg/services/dhcp
        imports github.com/containers/gvisor-tap-vsock/pkg/tap
        imports gvisor.dev/gvisor/pkg/tcpip
        imports gvisor.dev/gvisor/pkg/state
        imports gvisor.dev/gvisor/pkg/state/wire
        imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /root/rpmbuild/BUILD/podman-e4b03902052294d4f342a185bb54702ed5bed8b1/gvisor-tap-vsock-0.1.0/_build/src/github.com/containers/gvisor-tap-vsock/vendor/gvisor.dev/gvisor/pkg/gohacks
error: Bad exit status from /var/tmp/rpm-tmp.Q975DB (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.Q975DB (%build)
[root@sheep-41 ~]# head -n 20 /root/rpmbuild/BUILD/podman-e4b03902052294d4f342a185bb54702ed5bed8b1/gvisor-tap-vsock-0.1.0/_build/src/github.com/containers/gvisor-tap-vsock/vendor/gvisor.dev/gvisor/pkg/gohacks/gohacks_unsafe.go 
// Copyright 2020 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +build go1.13
// +build !go1.18

// Check type signatures when updating Go version.

// Package gohacks contains utilities for subverting the Go compiler.
[root@sheep-41 ~]# rpm -qa golang
golang-1.18.0-2.module+el8.7.0+14880+f5e30240.x86_64
[root@sheep-41 ~]# go env GOVERSION
go1.18
[root@sheep-41 ~]#

Comment 6 Edjunior Barbosa Machado 2022-05-11 06:15:07 UTC
Quickly tweaked the specfile to use a newer version of gvisor-tap-vsock (%global gvproxyver 0.2.0) and verified that it builds on x86_64 with no failures.

Comment 7 Jindrich Novy 2022-05-11 06:48:16 UTC
Thanks for confirmation - just updated gvisor-tap-vsock to 0.2.0 to fix compilation with golang 1.18

Comment 8 Jindrich Novy 2022-05-11 08:20:55 UTC

*** This bug has been marked as a duplicate of bug 2079761 ***