Rebase to version 2021.11.0

Based on https://copr.fedorainfracloud.org/coprs/jjames/TBB2021 by Jerry James.
This commit is contained in:
Jonathan Wakely 2024-01-17 17:30:37 +00:00
parent 9d62900fe8
commit 24feecbea0
4 changed files with 136 additions and 126 deletions

View File

@ -1 +1 @@
SHA512 (tbb-2020.3.tar.gz) = ea1ffd22c7234d715b8c46a4e51b40719c7a9b8837ab3166f1da5a2c6061167c2be2126b1d74fd361eec6975b8fce0df26829ca2e7af8029edbb52e40f23d630 SHA512 (tbb-2021.11.0.tar.gz) = 4779141b7602f2fa3a509fdd346824ba270a3a568df3649ce8cb51264d233df5cec5e5cb67b91319dd11d3d5e054697b4ed345e07216107985ddb6e1e7ef94e5

30
tbb-2021-Werror.patch Normal file
View File

@ -0,0 +1,30 @@
diff -up oneTBB-2021.11.0/cmake/compilers/Clang.cmake.orig oneTBB-2021.11.0/cmake/compilers/Clang.cmake
--- oneTBB-2021.11.0/cmake/compilers/Clang.cmake.orig 2023-11-17 09:23:05.000000000 -0700
+++ oneTBB-2021.11.0/cmake/compilers/Clang.cmake 2023-12-28 20:35:24.422191660 -0700
@@ -46,11 +46,6 @@ endif()
set(TBB_WARNING_LEVEL -Wall -Wextra $<$<BOOL:${TBB_STRICT}>:-Werror>)
set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor)
-# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
-if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
- tbb_remove_compile_flag(-Werror)
-endif()
-
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)")
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>:-mwaitpkg>)
diff -up oneTBB-2021.11.0/cmake/compilers/GNU.cmake.orig oneTBB-2021.11.0/cmake/compilers/GNU.cmake
--- oneTBB-2021.11.0/cmake/compilers/GNU.cmake.orig 2023-11-17 09:23:05.000000000 -0700
+++ oneTBB-2021.11.0/cmake/compilers/GNU.cmake 2023-12-28 20:37:54.828060692 -0700
@@ -42,11 +42,6 @@ endif()
set(TBB_COMMON_LINK_LIBS ${CMAKE_DL_LIBS})
-# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
-if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
- tbb_remove_compile_flag(-Werror)
-endif()
-
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL Intel)
# gcc 6.0 and later have -flifetime-dse option that controls elimination of stores done outside the object lifetime
set(TBB_DSE_FLAG $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},6.0>>:-flifetime-dse=1>)

View File

@ -0,0 +1,12 @@
diff -up oneTBB-2021.7.0/src/tbbmalloc/frontend.cpp.orig oneTBB-2021.7.0/src/tbbmalloc/frontend.cpp
--- oneTBB-2021.6.0/src/tbbmalloc/frontend.cpp.orig 2022-10-07 08:34:12.000000000 -0600
+++ oneTBB-2021.6.0/src/tbbmalloc/frontend.cpp 2022-11-03 13:28:39.050045201 -0600
@@ -1516,7 +1516,7 @@ bool Block::readyToShare()
{
MallocMutex::scoped_lock scoped_cs(publicFreeListLock);
if ( (oldVal=publicFreeList)==nullptr )
- (intptr_t&)(publicFreeList) = UNUSABLE;
+ publicFreeList = reinterpret_cast<FreeObject *>(UNUSABLE);
}
#endif
return oldVal==nullptr;

218
tbb.spec
View File

@ -1,46 +1,32 @@
Name: tbb Name: tbb
Summary: The Threading Building Blocks library abstracts low-level threading details Summary: The Threading Building Blocks library abstracts low-level threading details
Version: 2020.3 Version: 2021.11.0
Release: 21%{?dist} Release: 2%{?dist}
License: Apache-2.0 AND BSD-3-Clause License: Apache-2.0 AND BSD-3-Clause
URL: http://threadingbuildingblocks.org/ URL: http://threadingbuildingblocks.org/
Source0: https://github.com/intel/tbb/archive/v%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/oneapi-src/oneTBB/archive/v%{version}/%{name}-%{version}.tar.gz
# These three are downstream sources. # These two are downstream sources.
Source6: tbb.pc
Source7: tbbmalloc.pc Source7: tbbmalloc.pc
Source8: tbbmalloc_proxy.pc Source8: tbbmalloc_proxy.pc
# Don't snip -Wall from C++ flags. Add -fno-strict-aliasing, as that # TBB tries to remove -Werror from the compiler flags, which turns
# uncovers some static-aliasing warnings. # -Werror=format-security into =format-security
# Related: https://bugzilla.redhat.com/show_bug.cgi?id=1037347 Patch0: tbb-2021-Werror.patch
Patch0: tbb-2019-dont-snip-Wall.patch
# Make attributes of aliases match those on the aliased function. # Fix code that violates the strict aliasing rules.
Patch1: tbb-2020-attributes.patch Patch1: tbb-2021-strict-aliasing.patch
# Fix test-thread-monitor, which had multiple bugs that could (and did, on
# ppc64le) result in a hang.
Patch2: tbb-2019-test-thread-monitor.patch
# Fix a test that builds a 4-thread barrier, but cannot guarantee that more
# than 2 threads will be available to use it.
Patch3: tbb-2019-test-task-scheduler-init.patch
# Fix ABI break resulting from tbb::empty_task being removed from libtbb.so's
# exported symbols
Patch4: tbb-mark-empty_task-execute-with-gnu-used.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2161412
# https://github.com/oneapi-src/oneTBB/pull/833
Patch5: tbb-2020-task-namespace.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: hwloc
BuildRequires: hwloc-devel
BuildRequires: make BuildRequires: make
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python-setuptools BuildRequires: python3-docs
BuildRequires: %{py3_dist setuptools}
BuildRequires: %{py3_dist sphinx}
BuildRequires: %{py3_dist sphinx-rtd-theme}
BuildRequires: swig BuildRequires: swig
%description %description
@ -55,9 +41,19 @@ platforms. Since the library is also inherently scalable, no code
maintenance is required as more processor cores become available. maintenance is required as more processor cores become available.
%package bind
Summary: NUMA support library for TBB
Requires: %{name}%{?_isa} = %{version}-%{release}
%description bind
NUMA support library for TBB, allowing the binding of tasks to selected
CPU cores.
%package devel %package devel
Summary: The Threading Building Blocks C++ headers and shared development libraries Summary: The Threading Building Blocks C++ headers and shared development libraries
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-bind%{?_isa} = %{version}-%{release}
%description devel %description devel
Header files and shared object symlinks for the Threading Building Header files and shared object symlinks for the Threading Building
@ -87,133 +83,105 @@ Python 3 TBB module.
%prep %prep
%autosetup -p1 -n oneTBB-%{version} %autosetup -p1 -n oneTBB-%{version}
# For repeatable builds, don't query the hostname or architecture
sed -i 's/"`hostname -s`" ("`uname -m`"/fedorabuild (%{_arch}/' \
build/version_info_linux.sh
# Insert --as-needed before the libraries to be linked.
sed -i "s/-fPIC/& -Wl,--as-needed/" build/linux.gcc.inc
# Invoke the right python binary directly # Invoke the right python binary directly
sed -i 's,env python,python3,' python/TBB.py python/tbb/__*.py for fil in $(grep -Frl %{_bindir}/env python); do
sed -i.orig 's,env python3,python3,' $fil
touch -r $fil.orig $fil
rm $fil.orig
done
# Remove shebang from files that don't need it # Use local objects.inv for intersphinx
sed -i '/^#!/d' python/tbb/{pool,test}.py sed -e "s|\('https://docs\.python\.org/': \)None|\1'%{_docdir}/python3-docs/html/objects.inv'|" \
-i doc/GSG/conf.py doc/main/conf.py
%generate_buildrequires
cd python
%pyproject_buildrequires
%build %build
compiler="" export TBBROOT=$PWD
if [[ %{__cc} == *"gcc"* ]]; then export PYTHONPATH=$(sed "s,%{_prefix},$PWD/%{_vpath_builddir}/python/build," <<< %{python3_sitearch})
compiler="gcc" %cmake \
elif [[ %{__cc} == *"clang"* ]]; then -DCMAKE_CXX_STANDARD=17 \
compiler="clang" -DTBB4PY_BUILD:BOOL=ON \
else -DTBB_STRICT:BOOL=OFF \
compiler="%{__cc}" -DCMAKE_HWLOC_2_4_LIBRARY_PATH=%{_libdir}/libhwloc.so \
fi -DCMAKE_HWLOC_2_4_INCLUDE_PATH=%{_includedir}/hwloc \
%cmake_build
%make_build tbb_build_prefix=obj stdver=c++14 \ # The python package is not built the Fedora way. Do it over.
compiler=${compiler} \ unset PYTHONPATH
CXXFLAGS="%{optflags} -DUSE_PTHREAD" \ export LD_LIBRARY_PATH=$(ls -1d $PWD/%{_vpath_builddir}/*relwithdebinfo)
LDFLAGS="$RPM_LD_FLAGS -lpthread" export LDFLAGS="-L $LD_LIBRARY_PATH %{build_ldflags}"
for file in %{SOURCE6} %{SOURCE7} %{SOURCE8}; do cd python
base=$(basename ${file}) %pyproject_wheel
sed 's/_FEDORA_VERSION/%{version}/' ${file} > ${base} cd -
touch -r ${file} ${base}
done
# Build for python 3 # Build documentation
. build/obj_release/tbbvars.sh export BUILD_TYPE=oneapi
pushd python sphinx-build doc/GSG getting-started
%make_build -C rml stdver=c++14 \ sphinx-build doc/main html
compiler=${compiler} \
CPLUS_FLAGS="%{optflags} -DUSE_PTHREAD" \
LDFLAGS="$RPM_LD_FLAGS -lpthread"
cp -p rml/libirml.so* .
%py3_build
popd
# Build the documentation
make doxygen
%check
# This test assumes it can create thread barriers for arbitrary numbers of
# threads, but tbb limits the number of threads spawned to a function of the
# number of CPUs available. Some of the koji builders have a small number of
# CPUs, so the test hangs waiting for threads that have not been created to
# arrive at the barrier. Skip this test until upstream fixes it.
sed -i '/test_task_scheduler_observer/d' build/Makefile.test
make test tbb_build_prefix=obj stdver=c++14 CXXFLAGS="%{optflags}"
%install %install
mkdir -p $RPM_BUILD_ROOT/%{_libdir} %cmake_install
mkdir -p $RPM_BUILD_ROOT/%{_includedir}
pushd build/obj_release # The python package is not installed the Fedora way. Do it over.
for file in libtbb{,malloc{,_proxy}}; do rm -fr %{buildroot}%{python3_sitearch}
install -p -D -m 755 ${file}.so.2 $RPM_BUILD_ROOT/%{_libdir} cd python
ln -s $file.so.2 $RPM_BUILD_ROOT/%{_libdir}/$file.so %pyproject_install
done cd -
popd
pushd include mkdir -p %{buildroot}/%{_libdir}/pkgconfig
find tbb -type f ! -name \*.htm\* -exec \ for file in %{SOURCE7} %{SOURCE8}; do
install -p -D -m 644 {} $RPM_BUILD_ROOT/%{_includedir}/{} \ target=%{buildroot}/%{_libdir}/pkgconfig/$(basename ${file})
\; sed 's/_FEDORA_VERSION/%{version}/' $file > $target
popd touch -r $file $target
for file in %{SOURCE6} %{SOURCE7} %{SOURCE8}; do
install -p -D -m 644 $(basename ${file}) \
$RPM_BUILD_ROOT/%{_libdir}/pkgconfig/$(basename ${file})
done done
# Install the rml headers rm -fr %{buildroot}%{_datadir}/doc
mkdir -p $RPM_BUILD_ROOT%{_includedir}/rml
cp -p src/rml/include/*.h $RPM_BUILD_ROOT%{_includedir}/rml
# Python 3 install %check
. build/obj_release/tbbvars.sh # Running the tests in parallel often leads to resource exhaustion.
pushd python ctest --output-on-failure --force-new-ctest-process
%py3_install
chmod a+x $RPM_BUILD_ROOT%{python3_sitearch}/TBB.py
chmod a+x $RPM_BUILD_ROOT%{python3_sitearch}/tbb/__*.py
cp -p libirml.so.1 $RPM_BUILD_ROOT%{_libdir}
ln -s libirml.so.1 $RPM_BUILD_ROOT%{_libdir}/libirml.so
popd
# Install the cmake files
cmake \
-DINSTALL_DIR=$RPM_BUILD_ROOT%{_libdir}/cmake/TBB \
-DSYSTEM_NAME=Linux \
-DLIB_REL_PATH=../.. \
-P cmake/tbb_config_installer.cmake
%files %files
%doc doc/Release_Notes.txt README.md %doc README.md
%license LICENSE %license LICENSE.txt
%{_libdir}/libtbb.so.2 %{_libdir}/libtbb.so.12*
%{_libdir}/libtbbmalloc.so.2 %{_libdir}/libtbbmalloc.so.2*
%{_libdir}/libtbbmalloc_proxy.so.2 %{_libdir}/libtbbmalloc_proxy.so.2*
%{_libdir}/libirml.so.1 %{_libdir}/libirml.so.1
%files bind
%{_libdir}/libtbbbind_2_5.so.3*
%files devel %files devel
%doc CHANGES cmake/README.rst %doc cmake/README.md
%{_includedir}/rml/ %{_includedir}/oneapi/
%{_includedir}/tbb/ %{_includedir}/tbb/
%{_libdir}/*.so %{_libdir}/*.so
%{_libdir}/cmake/TBB/ %{_libdir}/cmake/TBB/
%{_libdir}/pkgconfig/*.pc %{_libdir}/pkgconfig/*.pc
%files doc %files doc
%doc doc/Release_Notes.txt %doc getting-started html
%doc html
%files -n python3-%{name} %files -n python3-%{name}
%doc python/index.html %doc python/README.md
%{python3_sitearch}/TBB* %{python3_sitearch}/TBB*
%{python3_sitearch}/tbb/ %{python3_sitearch}/tbb/
%{python3_sitearch}/__pycache__/TBB* %{python3_sitearch}/__pycache__/TBB*
%changelog %changelog
* Wed Jan 17 2024 Jonathan Wakely <jwakely@fedoraproject.org> - 2021.11.0-2
- Add patch for strict aliasing violation
* Thu Dec 28 2023 Jerry James <loganjerry@gmail.com> - 2021.11.0-1
- Rebase to version 2021.11.0
- New -bind subpackage for the NUMA support library
- Build with cmake
- Minor spec file cleanups
* Thu Aug 10 2023 Jonathan Wakely <jwakely@fedoraproject.org> - 2020.3-21 * Thu Aug 10 2023 Jonathan Wakely <jwakely@fedoraproject.org> - 2020.3-21
- SPDX migration - SPDX migration