Skip to content

FIX: package libctranslate2.so in wheel to avoid build fail#1920

Merged
jordimas merged 3 commits intoOpenNMT:masterfrom
yzewei:fix-build-pip
Dec 4, 2025
Merged

FIX: package libctranslate2.so in wheel to avoid build fail#1920
jordimas merged 3 commits intoOpenNMT:masterfrom
yzewei:fix-build-pip

Conversation

@yzewei
Copy link
Contributor

@yzewei yzewei commented Oct 17, 2025

On Linux, installing the ctranslate2 wheel may fail to find the libctranslate2 shared library, causing import errors.

This patch updates setup.py to include libctranslate2.so in the wheel via package_data for Linux.

For detailed error information, see the related issue: [issue#1919]

Signed-off-by: yzewei <yangzewei@loongson.cn>
elif sys.platform == "linux":
cflags.append("-fPIC")
ldflags.append("-Wl,-rpath,-Wl,-rpath,/usr/local/lib64")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Two comments:

  • -Wl,-rpath is repeated twice in " ldflags.append("-Wl,-rpath,-Wl,-rpath"
  • ,/usr/local/lib64 may not work in some distros that use /usr/local/lib

A better solution may be:

ldflags.append("-Wl,-rpath,/usr/local/lib64:/usr/local/lib")

@jordimas jordimas merged commit 600880d into OpenNMT:master Dec 4, 2025
16 checks passed
jordimas added a commit to jordimas/CTranslate2 that referenced this pull request Dec 17, 2025
…1920)

* package libctranslate2.so in wheel to avoid import errors

Signed-off-by: yzewei <yangzewei@loongson.cn>

* Fix based on PR discussion

---------

Signed-off-by: yzewei <yangzewei@loongson.cn>
Co-authored-by: Jordi Mas <jmas@softcatala.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants