aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2020-08-11 21:41:24 +0800
committerBenda Xu <heroxbd@gentoo.org>2020-08-11 21:44:16 +0800
commit72df8ef8dc56f868d4feaf7b558e93562b7627f3 (patch)
treedabf11fe319f0bb0b44692e9bc72e8c5a888213c
parentsci-biology/fsl: fixed compilation bug (diff)
downloadsci-72df8ef8dc56f868d4feaf7b558e93562b7627f3.tar.gz
sci-72df8ef8dc56f868d4feaf7b558e93562b7627f3.tar.bz2
sci-72df8ef8dc56f868d4feaf7b558e93562b7627f3.zip
sci-libs/pytorch: donot hardcode the library path.
Closes: https://bugs.gentoo.org/736643 Package-Manager: Portage-2.3.88, Repoman-2.3.18 Signed-off-by: Benda Xu <heroxbd@gentoo.org>
-rw-r--r--sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch15
-rw-r--r--sci-libs/pytorch/pytorch-1.6.0.ebuild3
2 files changed, 17 insertions, 1 deletions
diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch
new file mode 100644
index 000000000..1e9388ff1
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch
@@ -0,0 +1,15 @@
+Don't hardcode the library path. Leave it to the dynamic loader.
+
+Index: pytorch-1.6.0/torch/__init__.py
+===================================================================
+--- pytorch-1.6.0.orig/torch/__init__.py
++++ pytorch-1.6.0/torch/__init__.py
+@@ -138,7 +138,7 @@ def _load_global_deps():
+ here = os.path.abspath(__file__)
+ lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
+
+- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
+
+
+ if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv('TORCH_USE_RTLD_GLOBAL')) and \
diff --git a/sci-libs/pytorch/pytorch-1.6.0.ebuild b/sci-libs/pytorch/pytorch-1.6.0.ebuild
index 1394bdbe3..8c3236244 100644
--- a/sci-libs/pytorch/pytorch-1.6.0.ebuild
+++ b/sci-libs/pytorch/pytorch-1.6.0.ebuild
@@ -110,6 +110,7 @@ DEPEND="${RDEPEND}
PATCHES=(
"${FILESDIR}"/${PN}-1.6.0-setup.patch
"${FILESDIR}"/${PN}-1.6.0-skip-tests.patch
+ "${FILESDIR}"/${PN}-pytorch-1.6.0-global-dlopen.patch
"${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.4.0.patch
"${FILESDIR}"/0003-Change-path-to-caffe2-build-dir-made-by-libtorch.patch
"${FILESDIR}"/0005-Change-library-directory-according-to-CMake-build.patch
@@ -272,7 +273,7 @@ src_install() {
python_foreach_impl python_optimize
fi
- find "${ED}/usr/lib64" -name "*.a" -exec rm -fv {} \;
+ find "${ED}/usr/${LIB}" -name "*.a" -exec rm -fv {} \;
use test && rm -rfv "${ED}/usr/test" "${ED}"/usr/bin/test_{api,jit}