diff --git a/04dd02515d1ee05e26629ba540afc53986ae60e0.patch b/04dd02515d1ee05e26629ba540afc53986ae60e0.patch new file mode 100644 index 0000000..e832e9c --- /dev/null +++ b/04dd02515d1ee05e26629ba540afc53986ae60e0.patch @@ -0,0 +1,65 @@ +From 04dd02515d1ee05e26629ba540afc53986ae60e0 Mon Sep 17 00:00:00 2001 +From: Bastien Montagne +Date: Fri, 18 Feb 2022 11:05:34 +0100 +Subject: [PATCH] Fix compilation on GCC11. + +GCC11 removed some 'implicit includes', see +https://www.gnu.org/software/gcc/gcc-11/porting_to.html#header-dep-changes +for reference. +--- + pxr/base/js/testenv/testJsWriter.cpp | 1 + + pxr/base/tf/testenv/weakPtr.cpp | 1 + + pxr/base/work/singularTask.h | 2 +- + pxr/usd/sdr/shaderMetadataHelpers.h | 2 ++ + 4 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/pxr/base/js/testenv/testJsWriter.cpp b/pxr/base/js/testenv/testJsWriter.cpp +index cd897b8f4c..bd2a1788a0 100644 +--- a/pxr/base/js/testenv/testJsWriter.cpp ++++ b/pxr/base/js/testenv/testJsWriter.cpp +@@ -29,6 +29,7 @@ + #include "pxr/base/tf/diagnostic.h" + + #include ++#include + + PXR_NAMESPACE_USING_DIRECTIVE + +diff --git a/pxr/base/tf/testenv/weakPtr.cpp b/pxr/base/tf/testenv/weakPtr.cpp +index 6950d502d3..53e55d48b7 100644 +--- a/pxr/base/tf/testenv/weakPtr.cpp ++++ b/pxr/base/tf/testenv/weakPtr.cpp +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + PXR_NAMESPACE_USING_DIRECTIVE + +diff --git a/pxr/base/work/singularTask.h b/pxr/base/work/singularTask.h +index 0c7914d0b7..bc82bbf748 100644 +--- a/pxr/base/work/singularTask.h ++++ b/pxr/base/work/singularTask.h +@@ -108,7 +108,7 @@ class WorkSingularTask + // case we go again to ensure the task can do whatever it + // was awakened to do. Once we successfully take the count + // to zero, we stop. +- size_t old = count; ++ std::size_t old = count; + do { _fn(); } while ( + !count.compare_exchange_strong(old, 0)); + }); +diff --git a/pxr/usd/sdr/shaderMetadataHelpers.h b/pxr/usd/sdr/shaderMetadataHelpers.h +index 1402a27e71..0ed3274a94 100644 +--- a/pxr/usd/sdr/shaderMetadataHelpers.h ++++ b/pxr/usd/sdr/shaderMetadataHelpers.h +@@ -32,6 +32,8 @@ + #include "pxr/base/tf/token.h" + #include "pxr/usd/sdr/declare.h" + ++#include ++ + PXR_NAMESPACE_OPEN_SCOPE + + /// \namespace ShaderMetadataHelpers diff --git a/USD-21.11-disable-malloc-hooks.patch b/USD-21.11-disable-malloc-hooks.patch new file mode 100644 index 0000000..e9164cb --- /dev/null +++ b/USD-21.11-disable-malloc-hooks.patch @@ -0,0 +1,23 @@ +diff -Naur USD-21.11-original/pxr/base/arch/mallocHook.cpp USD-21.11/pxr/base/arch/mallocHook.cpp +--- USD-21.11-original/pxr/base/arch/mallocHook.cpp 2021-11-01 13:10:51.000000000 -0400 ++++ USD-21.11/pxr/base/arch/mallocHook.cpp 2022-03-31 17:26:22.176739670 -0400 +@@ -177,7 +177,7 @@ + _underlyingMemalignFunc || _underlyingFreeFunc; + } + +-#if defined(ARCH_OS_LINUX) ++#if 0 + template + static bool _GetSymbol(T* addr, const char* name, string* errMsg) { + if (void* symbol = dlsym(RTLD_DEFAULT, name)) { +@@ -241,8 +241,8 @@ + ARCH_UNUSED_ARG void (*freeWrapper)(void*, const void*), + string* errMsg) + { +-#if !defined(ARCH_OS_LINUX) +- *errMsg = "ArchMallocHook functionality not implemented for non-linux systems"; ++#if 1 ++ *errMsg = "ArchMallocHook functionality not implemented"; + return false; + #else + if (IsInitialized()) { diff --git a/usd.spec b/usd.spec index 5281c95..0f07cab 100644 --- a/usd.spec +++ b/usd.spec @@ -1,19 +1,20 @@ -%global __cmake_in_source_build 0 -%global libmajor 0 +%global downstream_so_version 0 + %global srcname USD %bcond_without alembic %bcond_with documentation %bcond_without embree %bcond_without imaging -# We must keep jemalloc enabled to work around -# https://github.com/PixarAnimationStudios/USD/issues/1592. -%bcond_without jemalloc +%bcond_with jemalloc %bcond_with openshading %bcond_with openvdb %bcond_with ocio %bcond_with oiio %bcond_without python3 -%bcond_with test +# TODO: Figure out how to re-enable the tests. Currently these want to install +# into /usr/tests and, and there are issues with the launchers finding the +# command-line tools in the buildroot. +%bcond_with test Name: usd Version: 21.11 @@ -43,7 +44,25 @@ URL: http://www.openusd.org/ Source0: https://github.com/PixarAnimationStudios/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz Source1: org.open%{name}.%{name}view.desktop +# Upstream was asked about .so versioning and setting SONAME properly and +# seemed unprepared to handle the request: +# https://github.com/PixarAnimationStudios/USD/issues/1259#issuecomment-657120216 +# +# A patch was offered: # https://github.com/PixarAnimationStudios/USD/issues/1387 +# but it was not sufficient for the general case, since (1) it only handled the +# monolithic build, and (2) it derived the .so version from PXR_MAJOR_VERSION, +# which is *not* reliably bumped on API or ABI changes, and currently is still +# zero. +# +# We will therefore probably need to keep doing downstream .so versioning for +# the foreseeable future. A new scheme is implemented in F37 and later that +# assumes that the ABI is likely to change on every release (an appropriate +# assumption for a large C++ project with no ABI stability policy), and +# therefore builds the .so version from the project version. +# +# In F36 and older, we keep the old .so version scheme to avoid a breaking +# change. Patch1: %{srcname}-20.05-soversion.patch # https://github.com/PixarAnimationStudios/USD/issues/1591 @@ -53,6 +72,15 @@ Patch2: USD-21.08-OpenEXR3.patch # https://github.com/PixarAnimationStudios/USD/pull/1676 Patch3: 1676.patch +# USD uses deprecated malloc hooks removed in glibc 2.34 +# https://github.com/PixarAnimationStudios/USD/issues/1592 +# Based on: +# https://github.com/PixarAnimationStudios/USD/issues/1592#issuecomment-1047152905 +Patch4: USD-21.11-disable-malloc-hooks.patch + +# Backport upstream commit 04dd025 “Fix compilation on GCC11.” +Patch5: https://github.com/PixarAnimationStudios/USD/commit/04dd02515d1ee05e26629ba540afc53986ae60e0.patch + # Base BuildRequires: boost-devel BuildRequires: boost-program-options @@ -106,9 +134,10 @@ BuildRequires: hdf5-devel %endif # Header-only library: -static is for tracking per guidelines -# stb_image 2.27-0.7 is the minimum EVR to contain fixes for all of -# CVE-2021-28021, CVE-2021-42715, and CVE-2021-42716. -BuildRequires: stb_image-devel >= 2.27-0.7 +# +# stb_image 2.27^20210910gitaf1a5bc-0.2 is the minimum EVR to contain fixes for +# all of CVE-2021-28021, CVE-2021-42715, CVE-2021-42716, and CVE-2022-28041. +BuildRequires: stb_image-devel >= 2.27^20210910gitaf1a5bc-0.2 BuildRequires: stb_image-static BuildRequires: stb_image_write-devel BuildRequires: stb_image_write-static @@ -120,6 +149,18 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: python3-%{name}%{?_isa} = %{version}-%{release} %endif +# This package is only available for x86_64 and aarch64 +# Will fail to build on other architectures +# https://bugzilla.redhat.com/show_bug.cgi?id=1960848 +ExclusiveArch: aarch64 x86_64 + +%description +Universal Scene Description (USD) is a time-sampled scene +description for interchange between graphics applications. + +%package libs +Summary: Universal Scene Description library + # Upstream bundles # Filed ticket to convince upstream to use system libraries # https://github.com/PixarAnimationStudios/USD/issues/1490 @@ -141,19 +182,6 @@ Provides: bundled(SPIRV-Reflect) = 1.0 # Version from: pxr/imaging/hgiVulkan/vk_mem_alloc.h (header comment) Provides: bundled(VulkanMemoryAllocator) = 3.0.0~development -# This package is only available for x86_64 and aarch64 -# Will fail to build on other architectures -# https://bugzilla.redhat.com/show_bug.cgi?id=1960848 -ExclusiveArch: aarch64 x86_64 - -%description -Universal Scene Description (USD) is a time-sampled scene -description for interchange between graphics applications. - -%package libs -Summary: Universal Scene Description library - - %description libs Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for @@ -331,8 +359,9 @@ desktop-file-install \ --dir=%{buildroot}%{_datadir}/applications \ %{SOURCE1} -# Remove arch-specific code in /usr/share -find %{buildroot}%{_datadir}/%{name}/examples -name '*.so' -print -delete +# Remove examples that were built and installed even though we set +# -DPXR_BUILD_EXAMPLES=OFF. +rm -vrf '%{buildroot}%{_datadir}/%{name}/examples' # Fix installation path for some files mv %{buildroot}%{_prefix}/lib/python/pxr/*.* \ @@ -340,6 +369,14 @@ mv %{buildroot}%{_prefix}/lib/python/pxr/*.* \ mv %{buildroot}%{_prefix}/lib/python/pxr/Usdviewq/* \ %{buildroot}%{python3_sitearch}/pxr/Usdviewq/ +# Currently, the pxrConfig.cmake that is installed is not correct for +# monolithic builds (and we must do a monolithic build in order to be usable as +# a dependency for Blender). It relies on the libraries that would be in +# pxrTargets.cmake, which is not generated for monolithic builds. +# https://bugzilla.redhat.com/show_bug.cgi?id=2055414 +# https://github.com/PixarAnimationStudios/USD/issues/1088 +rm -vrf '%{buildroot}%{_libdir}/cmake' + %check desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{name}view.desktop %{?with_test:%ctest} @@ -347,9 +384,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %files %doc NOTICE.txt README.md %{_bindir}/* -%dir %{_datadir}/%{name} -%dir %{_datadir}/%{name}/examples/ -%{_datadir}/%{name}/examples/* %if %{with python3} %files -n python3-%{name} @@ -360,14 +394,13 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %files libs %license LICENSE.txt %doc NOTICE.txt README.md -%{_libdir}/lib%{name}_%{name}_ms.so.%{libmajor} +%{_libdir}/lib%{name}_%{name}_ms.so.%{downstream_so_version} %{_libdir}/%{name} %exclude %{_libdir}/%{name}/%{name}/resources/codegenTemplates %files devel %doc BUILDING.md CHANGELOG.md VERSIONS.md %{_includedir}/pxr/ -%{_libdir}/cmake/* %{_libdir}/lib%{name}_%{name}_ms.so %{_libdir}/%{name}/%{name}/resources/codegenTemplates/