From 108b5b9f89998d3ec69b22a01b8de15992329df0 Mon Sep 17 00:00:00 2001 From: Vincent Quenneville-Belair Date: Fri, 18 Dec 2020 15:26:12 -0800 Subject: [PATCH] experiment with relative path for conda build. --- build_tools/setup_helpers/extension.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build_tools/setup_helpers/extension.py b/build_tools/setup_helpers/extension.py index 31e7407ddc6..3ab5d1e33f5 100644 --- a/build_tools/setup_helpers/extension.py +++ b/build_tools/setup_helpers/extension.py @@ -164,6 +164,13 @@ def _get_ext_transducer(debug): else: print("Not building GPU extensions.") + if platform.system() == 'Darwin': + root_dir = "@loader_path" + else: + root_dir = "$ORIGIN" + rel_warp_rnnt_path = os.path.join(root_dir, 'third_party', 'warp_transducer', 'build') + print("path for object:", rel_warp_rnnt_path) + # rel_warp_rnnt_path = os.path.realpath(warp_rnnt_path) return CppExtension( name='_warp_transducer', sources=[os.path.realpath(base_path / 'pytorch_binding' / 'src' / 'binding.cpp')], @@ -172,7 +179,7 @@ def _get_ext_transducer(debug): extra_objects=extra_objects, library_dirs=[os.path.realpath(warp_rnnt_path)], libraries=librairies, - extra_link_args=['-Wl,-rpath,' + os.path.realpath(warp_rnnt_path)], + extra_link_args=['-Wl,-rpath,' + rel_warp_rnnt_path], extra_compile_args=extra_compile_args )