Rh9 rpm build failing

Hello,

I’m using the source RPMS provided by Fedora in an attempt to build RPMs for RHEL9. With a few macro modifications, I was able to build LXC on RHEL9 based on the the lxc-6.0.3-1.fc41.src.rpm from Fedora.

I also downloaded incus-6.8-1.fc41.src.rpm and attempted a build, using mock. I’ve tried both supplying a repo with lxc-6.0.3-1 from above, and without. Both have this same issue…

  • CGO_CPPFLAGS=‘-D_FORTIFY_SOURCE=2 -fstack-protector-all’
  • go build -compiler gc -buildmode pie ‘-tags=rpm_crashtraceback libtrust_openssl libsqlite3’ -ldflags ‘-linkmode=external -compressdwarf=false -B 0x76e08ed32a3f59020a7fac76edea757543a16c08 -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 -o /builddir/build/BUILD/incus-6.8/_build/lib/incusd github.com/lxc/incus/cmd/incusd
    WORK=/tmp/go-build919625839
    cannot find module providing package github.com/lxc/incus/cmd/incusd: import lookup disabled by -mod=vendor
    (Go version in go.mod is at least 1.14 and vendor directory exists.)
    error: Bad exit status from /var/tmp/rpm-tmp.MQiVYG (%build)
    Setting %{thisgofilelist} = devel.file-list
    Setting %{currentgoipath} = GitHub - lxc/incus: Powerful system container and virtual machine manager
    Setting %{currentgosourcedir} = /builddir/build/BUILD/incus-6.8
    Setting %{currentgofilelist} = devel.file-list
    Setting %{currentversion} = 6.8
    Setting %{currentgoldflags} = -X github.com/lxc/incus/version=6.8
    Bad exit status from /var/tmp/rpm-tmp.MQiVYG (%build)

More system info:
$ cat /etc/os-release
NAME=“Red Hat Enterprise Linux”
VERSION=“9.5 (Plow)”
ID=“rhel”
ID_LIKE=“fedora”
VERSION_ID=“9.5”
PLATFORM_ID=“platform:el9”
PRETTY_NAME=“Red Hat Enterprise Linux 9.5 (Plow)”
ANSI_COLOR=“0;31”
LOGO=“fedora-logo-icon”
CPE_NAME=“cpe:/o:redhat:enterprise_linux:9::baseos”
HOME_URL=“https://www.redhat.com/
DOCUMENTATION_URL=“https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9
BUG_REPORT_URL=“https://issues.redhat.com/

REDHAT_BUGZILLA_PRODUCT=“Red Hat Enterprise Linux 9”
REDHAT_BUGZILLA_PRODUCT_VERSION=9.5
REDHAT_SUPPORT_PRODUCT=“Red Hat Enterprise Linux”
REDHAT_SUPPORT_PRODUCT_VERSION=“9.5”

$ uname -a
Linux chlc-bwil01.etc.cboe.net 5.14.0-362.8.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Oct 3 11:12:36 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux

To build Incus you need a newer “go” version than RHEL9 (and clones) provide. This is only required for the build, not for running Incus.

One way to do it is this:

wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.24.2.linux-amd64.tar.gz
export PATH=/usr/local/go/bin:$PATH

Then build your Incus and you’ll be fine. You can grab our Incus-6.12.0 RPM from here:

https://updates.aventurin.net/pub/Aventurin/6110R/EL9/os_updates/x86_64/RPMS/incus-6.12.0-1.el9.x86_64.rpm

The SRPM is here:

https://updates.aventurin.net/pub/Aventurin/6110R/EL9/SRPMS/incus-6.12.0-1.el9.src.rpm

However, the SRPM requires that the build process is started after the above “go”-version has been activated.