diff --git a/README.md b/README.md index 2d5dd033..27c8ab23 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 1d460a3b..ddb9b948 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 3ed20330..75006f34 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 925e3f66..0ccb1e79 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 6c9311d2..733e5185 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