Bug 2227328 - %gobuild macro doesn't include BUILDTAGS support
Summary: %gobuild macro doesn't include BUILDTAGS support
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: go-rpm-macros
Version: CentOS Stream
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: David Benoit
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-28 17:46 UTC by Lokesh Mandvekar
Modified: 2023-08-14 12:56 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-163804 0 None None None 2023-07-28 17:47:41 UTC

Description Lokesh Mandvekar 2023-07-28 17:46:34 UTC
Description of problem:

%gobuild macro on c9s seems to have dropped `BUILDTAGS` from its definition which is causing many build failures for podman / buildah etc.

See: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/build/6220412/ . The c9s builds on that copr used to pass until recently.

Also, see the %gobuild defs on Fedora v/s C9S



On C9S
# rpm --eval %gobuild

CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build -compiler gc -buildmode pie '-tags=rpm_crashtraceback libtrust_openssl ' -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 '" -a -v -x ;




On Fedora:
$ rpm --eval %gobuild

  # https://pagure.io/go-rpm-macros/pull-request/38
  # Most of the default LDFLAGS for Fedora are not supported so we don't want
  # LDFLAGS to be automatically initialized with the Fedora flags.
  
  # https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
     GO111MODULE=off \
  go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}  -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -compressdwarf=false -linkmode=external -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1   '" -a -v -x ;


Note You need to log in before you can comment on or make changes to this bug.