Update prebuilt oneTBB2021.2.1 (#16548)

*update prebuilt oneTBB2021.2.1

*modify tbb and tbb component installation

*modify the implementation of removing soft links

*update prebuilt oneTBB2021.2.1
macos: 11.4
windows: win10+visual studio 2019(MSVC 14.21)
https://github.com/open-mpi/hwloc/archive/refs/tags/hwloc-2.8.0.tar.gz
https://github.com/open-mpi/hwloc/archive/refs/tags/hwloc-2.8.0.zip
https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.2.1.tar.gz(commitid:96af5d3)
https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.2.1.zip(commitid:96af5d3)

before building oneTBB 2021.2.1, replace all strings "2_4" of the source code with "2_5"

for windows, after compilation, replace all strings
INTERFACE_COMPILE_DEFINITIONS "\$<\$<CONFIG:DEBUG>:TBB_USE_DEBUG>" to INTERFACE_COMPILE_DEFINITIONS "\$<\$<CONFIG:DEBUG>:TBB_USE_DEBUG>;__TBB_NO_IMPLICIT_LINKAGE=1"
in cmake file "%cd%\install\lib\cmake\TBB\TBBTargets.cmake"
This commit is contained in:
Fang Xu 2023-03-25 14:16:43 +05:30 committed by GitHub
parent 580b99c99b
commit a96da994ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 30 deletions

View File

@ -97,10 +97,10 @@ function(ov_download_tbb)
if(WIN32 AND X86_64)
# TODO: add target_path to be platform specific as well, to avoid following if
RESOLVE_DEPENDENCY(TBB
ARCHIVE_WIN "tbb2020_617e9a71_win.zip"
ARCHIVE_WIN "oneapi-tbb-2021.2.1-win.zip"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "01cac3cc48705bd52b83a6e1fa1ed95c708928be76160f5b9c5c37f954d56df4"
SHA256 "d81591673bd7d3d9454054642f8ef799e1fdddc7b4cee810a95e6130eb7323d4"
USE_NEW_LOCATION TRUE)
elseif(ANDROID AND X86_64)
RESOLVE_DEPENDENCY(TBB
@ -110,10 +110,10 @@ function(ov_download_tbb)
SHA256 "f42d084224cc2d643314bd483ad180b081774608844000f132859fca3e9bf0ce")
elseif(LINUX AND X86_64)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_LIN "tbb2020_617e9a71_lin_strip.tgz"
ARCHIVE_LIN "oneapi-tbb-2021.2.1-lin.tgz"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "e7a38f68059fb36de8b59d40b283a849f26275e34a58d2acadfdb84d49e31b9b"
SHA256 "0a56f73baaa40d72e06949ea6d593ae63a19f7580ce71c08287c1f59d2e5b988"
USE_NEW_LOCATION TRUE)
elseif(YOCTO_AARCH64)
RESOLVE_DEPENDENCY(TBB
@ -123,10 +123,10 @@ function(ov_download_tbb)
SHA256 "321261ff2eda6d4568a473cb883262bce77a93dac599f7bd65d2918bdee4d75b")
elseif(APPLE AND X86_64)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_MAC "tbb2020_617e9a71_mac.tgz"
ARCHIVE_MAC "oneapi-tbb-2021.2.1-mac.tgz"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "67a44b695bef3348416eaf5bf2baca2b1401576c0e09c394304eba1e0eee96cd"
SHA256 "c57ce4b97116cd3093c33e6dcc147fb1bbb9678d0ee6c61a506b2bfe773232cb"
USE_NEW_LOCATION TRUE)
else()
message(WARNING "Prebuilt TBB is not available on current platform")

View File

@ -294,6 +294,16 @@ class PrepareLibs(build_clib):
):
set_rpath(comp_data["rpath"], os.path.realpath(path))
def get_reallink(self, link_file):
real_name = link_file
while True:
real_name = os.readlink(real_name)
if not os.path.isabs(real_name):
real_name = os.path.join(os.path.dirname(link_file), real_name)
if not Path(real_name).is_symlink():
break
return real_name
def generate_package(self, src_dirs):
"""Collect package data files from preinstalled dirs and put all runtime libraries to the subpackage."""
# additional blacklist filter, just to fix cmake install issues
@ -302,27 +312,42 @@ class PrepareLibs(build_clib):
for src_dir in src_dirs:
local_base_dir = Path(src_dir)
# skip symlinks of higher level like libX.so or libX.dylib
# Wheel package content must not contain symlinks
# the block handles two kinds of soft links, take the library on linux as an example
# the first case: there are two soft links pointing to the real file,
# input is libX.so->libX.so.Y and libX.so.Y->libX.so.Y.Z (e.g. hwloc library in oneTBB package)
# input is libX.so->libX.so.Y.Z and libX.so.Y->libX.so.Y.Z (e.g. oneTBB library)
# the second case: there is one soft link pointing to the real file
# process results of the above two cases: remove soft links(libX.so and libX.so.Y), rename libX.so.Y.Z to libX.so.Y
file_dict = {}
# step 1:
# record real files and its symlinks {real file: soft link}
# if there are two soft links pointing to the same file, like libX.so and libX.so.Y(including the above two cases),
# only record the libX.so.Y and remove libX.so
for symlink in local_base_dir.rglob("*"):
if symlink.is_symlink():
file_name = os.readlink(symlink)
if not os.path.isabs(file_name):
file_name = os.path.join(os.path.dirname(symlink), file_name)
if Path(file_name).is_symlink():
self.announce(f"Unlink symlink {symlink}, use {file_name} instead", level=3)
os.unlink(symlink)
real_name = self.get_reallink(symlink)
if real_name in file_dict:
link_file_name_old = os.path.basename(file_dict[real_name])
link_file_name_new = os.path.basename(symlink)
if len(link_file_name_new) > len(link_file_name_old):
# replace libX.so/libX.dylib with libX.so.Y/libX.Y.dylib
self.announce(f"Unlink symlink {file_dict[real_name]}, use {symlink} instead", level=3)
os.unlink(file_dict[real_name])
file_dict[real_name] = symlink
else:
self.announce(f"Unlink symlink {symlink}, use {file_dict[real_name]} instead", level=3)
os.unlink(symlink)
else:
file_dict[real_name] = symlink
# transform libX.so.Y / libX.Y.dylib symlinks to real files
for symlink in local_base_dir.rglob("*"):
if symlink.is_symlink():
file_name = os.readlink(symlink)
if not os.path.isabs(file_name):
file_name = os.path.join(os.path.dirname(symlink), file_name)
os.unlink(symlink)
os.rename(file_name, symlink)
self.announce(f"Resolved symlink {symlink} as {file_name}", level=3)
# step 2:
# according to the corresponding relationship (file_dict),
# remove the reserved soft link and rename the real file to the name of its soft link
for real_name, symlink in file_dict.items():
os.unlink(symlink)
os.rename(real_name, symlink)
self.announce(f"Resolved symlink {symlink} as {real_name}", level=3)
# copy so / dylib files to WHEEL_LIBS_INSTALL_DIR
for file_path in local_base_dir.rglob("*"):

View File

@ -192,7 +192,8 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
else()
install(DIRECTORY "${TBBROOT}/lib"
DESTINATION "${IE_TBB_DIR_INSTALL}"
COMPONENT tbb)
COMPONENT tbb
PATTERN "cmake" EXCLUDE)
endif()
install(FILES "${TBBROOT}/LICENSE"
@ -206,10 +207,19 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
DEPENDS tbb)
list(APPEND core_dev_components tbb_dev)
install(FILES "${TBBROOT}/cmake/TBBConfig.cmake"
"${TBBROOT}/cmake/TBBConfigVersion.cmake"
DESTINATION "${IE_TBB_DIR_INSTALL}/cmake"
COMPONENT tbb_dev)
if(EXISTS "${TBBROOT}/lib/cmake")
# oneTBB case
install(DIRECTORY "${TBBROOT}/lib/cmake"
DESTINATION "${IE_TBB_DIR_INSTALL}/lib"
COMPONENT tbb_dev)
else()
# tbb2020 case
install(FILES "${TBBROOT}/cmake/TBBConfig.cmake"
"${TBBROOT}/cmake/TBBConfigVersion.cmake"
DESTINATION "${IE_TBB_DIR_INSTALL}/cmake"
COMPONENT tbb_dev)
endif()
install(DIRECTORY "${TBBROOT}/include"
DESTINATION "${IE_TBB_DIR_INSTALL}"
COMPONENT tbb_dev)
@ -218,7 +228,8 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
# .lib files are needed only for Windows
install(DIRECTORY "${TBBROOT}/lib"
DESTINATION "${IE_TBB_DIR_INSTALL}"
COMPONENT tbb_dev)
COMPONENT tbb_dev
PATTERN "cmake" EXCLUDE)
endif()
set(pkg_config_tbb_lib_dir "${IE_TBB_DIR_INSTALL}/lib")