From 3a16585f047beef95f9df29643529545f0342add Mon Sep 17 00:00:00 2001 From: Gustavo Varela Date: Mon, 5 Oct 2026 20:19:14 +0200 Subject: [PATCH] Add build targets for current openSUSE Leap and SLE The only SUSE build target was opensuse-leap15.1, which has been end of life since 2021. Add opensuse-leap15.6, opensuse-leap16.0, sles15.7 and sles16.0 (built on the SLE Base Container Image) for x86_64 and aarch64. Making these build required: - Dockerfile.opensuse-leap: createrepo is now createrepo_c, rpcgen is a separate package, and bmake/rpmlint are installed only when the repository provides them (the SLE BCI 16 repository has neither). - WITH_TIRPC=yes for the new targets: glibc no longer ships the Sun RPC headers from Leap 15.6 on. sles16 also uses WITH_LIBELF=yes because bmake is unavailable there. - libtirpc.mk: build the bundled libtirpc 1.3.2 with -std=gnu11, the standard the project itself uses. GCC 15 defaults to C23, which rejects its unprototyped declarations. - The RPM spec runs make against _topdir/BUILD. rpm 4.20 runs the install section in a per-build subdirectory, so the bare "make install" found no Makefile. Fixes #100 Signed-off-by: Gustavo Varela --- README.md | 2 +- mk/Dockerfile.opensuse-leap | 11 ++++++++--- mk/docker.mk | 16 ++++++++++++++-- mk/libtirpc.mk | 3 ++- pkg/rpm/SPECS/libnvidia-container.spec | 4 +++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2d5dd0335..27c8ab231 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ libnvidia-container-tools With Docker: ```bash # Generate docker images for a supported -make {ubuntu18.04, ubuntu16.04, debian10, debian9, centos7, amazonlinux2, opensuse-leap15.1} +make {ubuntu18.04, ubuntu16.04, debian10, debian9, centos7, amazonlinux2, opensuse-leap15.1, opensuse-leap15.6, opensuse-leap16.0, sles15.7, sles16.0} # Or generate docker images for all supported distributions in the dist/ directory make docker diff --git a/mk/Dockerfile.opensuse-leap b/mk/Dockerfile.opensuse-leap index 1d460a3bb..ddb9b9487 100644 --- a/mk/Dockerfile.opensuse-leap +++ b/mk/Dockerfile.opensuse-leap @@ -4,9 +4,8 @@ FROM ${BASEIMAGE} SHELL ["/bin/bash", "-c"] RUN zypper install -y \ - bmake \ bzip2 \ - createrepo \ + createrepo_c \ curl \ gcc \ git \ @@ -18,11 +17,17 @@ RUN zypper install -y \ make \ lsb-release \ pkg-config \ + rpcgen \ rpm-build \ - rpmlint \ which && \ rm -rf /var/cache/zypp/* +# bmake is only needed to build the bundled elftoolchain (WITH_LIBELF=no) and rpmlint is +# optional. Neither is available in every SUSE repository (e.g. SLE BCI 16), so they are +# installed when the repository provides them. +RUN (zypper install -y bmake rpmlint || zypper install -y bmake || true) && \ + rm -rf /var/cache/zypp/* + ARG OS_ARCH ARG GOLANG_VERSION ENV OS_ARCH=${OS_ARCH} diff --git a/mk/docker.mk b/mk/docker.mk index 3ed20330a..75006f349 100644 --- a/mk/docker.mk +++ b/mk/docker.mk @@ -35,10 +35,10 @@ include $(CURDIR)/versions.mk # Supported OSs by architecture AMD64_TARGETS := ubuntu22.04 ubuntu20.04 ubuntu18.04 ubuntu16.04 debian10 debian9 -X86_64_TARGETS := centos7 centos8 rhel7 rhel8 amazonlinux2 opensuse-leap15.1 +X86_64_TARGETS := centos7 centos8 rhel7 rhel8 amazonlinux2 opensuse-leap15.1 opensuse-leap15.6 opensuse-leap16.0 sles15.7 sles16.0 PPC64LE_TARGETS := ubuntu18.04 ubuntu16.04 centos7 centos8 rhel7 rhel8 ARM64_TARGETS := ubuntu18.04 -AARCH64_TARGETS := centos7 rhel7 centos8 rhel8 amazonlinux2 +AARCH64_TARGETS := centos7 rhel7 centos8 rhel8 amazonlinux2 opensuse-leap15.6 opensuse-leap16.0 sles15.7 sles16.0 # Define top-level build targets docker%: SHELL:=/bin/bash @@ -145,6 +145,18 @@ docker-amd64-verify: $(patsubst %, %-verify, $(AMD64_TARGETS)) \ # private opensuse-leap target with overrides --opensuse-leap%: OS := opensuse-leap --opensuse-leap%: BASEIMAGE = opensuse/leap:$(VERSION) +# glibc no longer ships the Sun RPC headers from Leap 15.6 on; build against libtirpc +--opensuse-leap15.6%: WITH_TIRPC = yes +--opensuse-leap16%: WITH_TIRPC = yes + +# private sles target (built on the SLE Base Container Image with the opensuse-leap Dockerfile) +--sles%: OS := opensuse-leap +--sles%: VERSION = $(patsubst sles%-$(ARCH),%,$(TARGET_PLATFORM)) +--sles%: BASEIMAGE = registry.suse.com/bci/bci-base:$(VERSION) +--sles%: BUILDIMAGE = $(IMAGE_PREFIX)nvidia/$(LIB_NAME)/sles$(VERSION)-$(ARCH) +--sles%: ARTIFACTS_DIR = $(DIST_DIR)/sles$(VERSION)/$(ARCH) +--sles%: WITH_TIRPC = yes +--sles16%: WITH_LIBELF = yes # private rhel target (actually built on centos) --rhel%: OS := centos diff --git a/mk/libtirpc.mk b/mk/libtirpc.mk index 925e3f66d..0ccb1e793 100644 --- a/mk/libtirpc.mk +++ b/mk/libtirpc.mk @@ -16,7 +16,8 @@ LIBTIRPC := $(SRCS_DIR)/libtirpc ##### Flags definitions ##### export CPPFLAGS := -D_FORTIFY_SOURCE=2 -export CFLAGS := -O2 -g -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fPIC +# libtirpc 1.3.2 has unprototyped declarations that C23 (the GCC 15 default) rejects. +export CFLAGS := -std=gnu11 -O2 -g -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fPIC ##### Private rules ##### diff --git a/pkg/rpm/SPECS/libnvidia-container.spec b/pkg/rpm/SPECS/libnvidia-container.spec index 6c9311d27..733e51850 100644 --- a/pkg/rpm/SPECS/libnvidia-container.spec +++ b/pkg/rpm/SPECS/libnvidia-container.spec @@ -25,7 +25,9 @@ containers leveraging NVIDIA hardware. The implementation relies on several kernel subsystems and is designed to be agnostic of the container runtime. %install -DESTDIR=%{buildroot} %{__make} install prefix=%{_prefix} exec_prefix=%{_exec_prefix} bindir=%{_bindir} libdir=%{_libdir} includedir=%{_includedir} docdir=%{_licensedir} +# rpm >= 4.20 runs the install section in a per-build subdirectory, so point make at the +# source tree that the Makefile links to _topdir/BUILD. +DESTDIR=%{buildroot} %{__make} -C %{_topdir}/BUILD install prefix=%{_prefix} exec_prefix=%{_exec_prefix} bindir=%{_bindir} libdir=%{_libdir} includedir=%{_includedir} docdir=%{_licensedir} %package -n %{name}%{_major} Summary: NVIDIA container runtime library