From d9d59a78cee55c3df9e4317834ce3dac78ff0c06 Mon Sep 17 00:00:00 2001 From: yzewei Date: Fri, 17 Oct 2025 09:52:35 +0800 Subject: [PATCH 1/2] package libctranslate2.so in wheel to avoid import errors Signed-off-by: yzewei --- python/setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/setup.py b/python/setup.py index 92d07fa08..b00cd9bde 100644 --- a/python/setup.py +++ b/python/setup.py @@ -51,6 +51,9 @@ def _maybe_add_library_root(lib_name): elif sys.platform == "win32": cflags = ["/std:c++17", "/d2FH4-"] package_data["ctranslate2"] = ["*.dll"] +elif sys.platform == "linux": + cflags.append("-fPIC") + ldflags.append("-Wl,-rpath,-Wl,-rpath,/usr/local/lib64") ctranslate2_module = Extension( "ctranslate2._ext", From 929f5daf0a7de77b3601a0ad7b160a81edbf810a Mon Sep 17 00:00:00 2001 From: Jordi Mas Date: Thu, 4 Dec 2025 08:20:51 +0100 Subject: [PATCH 2/2] Fix based on PR discussion --- python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/setup.py b/python/setup.py index 70be750c5..5ba4c04c7 100644 --- a/python/setup.py +++ b/python/setup.py @@ -53,7 +53,7 @@ def _maybe_add_library_root(lib_name): package_data["ctranslate2"] = ["*.dll"] elif sys.platform == "linux": cflags.append("-fPIC") - ldflags.append("-Wl,-rpath,-Wl,-rpath,/usr/local/lib64") + ldflags.append("-Wl,-rpath,/usr/local/lib64:/usr/local/lib") ctranslate2_module = Extension( "ctranslate2._ext",