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:
@@ -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("*"):
|
||||
|
||||
Reference in New Issue
Block a user