Skip to content

Commit 0d1f167

Browse files
committed
package libctranslate2.so in wheel to avoid import errors
Signed-off-by: yzewei <[email protected]>
1 parent 617405f commit 0d1f167

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ def _maybe_add_library_root(lib_name):
5151
elif sys.platform == "win32":
5252
cflags = ["/std:c++17", "/d2FH4-"]
5353
package_data["ctranslate2"] = ["*.dll"]
54+
elif sys.platform == "linux":
55+
package_data["ctranslate2"] = [
56+
"../libctranslate2.so",
57+
"../libctranslate2.so.4",
58+
"../libctranslate2.so.4.6.0"
59+
]
60+
cflags.append("-fPIC")
61+
ldflags.append("-Wl,-rpath,$ORIGIN")
5462

5563
ctranslate2_module = Extension(
5664
"ctranslate2._ext",

0 commit comments

Comments
 (0)