Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python ctranslate2 breaks with glibc 2.41: cannot enable executable stack #1849

Open
igormp opened this issue Feb 4, 2025 · 9 comments · May be fixed by #1852
Open

Python ctranslate2 breaks with glibc 2.41: cannot enable executable stack #1849

igormp opened this issue Feb 4, 2025 · 9 comments · May be fixed by #1852

Comments

@igormp
Copy link

igormp commented Feb 4, 2025

After upgrading to glibc==2.41, ctranslate2 now stopped working with Python 3.12.8.

After installing it and trying to import it, I'm met with the following:

import ctranslate2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/igor/.cache/pypoetry/virtualenvs/ctranslate-_DJS7Z3B-py3.12/lib/python3.12/site-packages/ctranslate2/__init__.py", line 21, in <module>
    from ctranslate2._ext import (
ImportError: libctranslate2-bc15bf3f.so.4.5.0: cannot enable executable stack as shared object requires: Invalid argument

Trying to clear the execstack flag leads to this other error:

$ execstack -c /home/igor/.local/lib/python3.12/site-packages/ctranslate2.libs/libctranslate2-bc15bf3f.so.4.5.0
execstack: /home/igor/.local/lib/python3.12/site-packages/ctranslate2.libs/libctranslate2-bc15bf3f.so.4.5.0: section file offsets not monotonically increasing

Maybe related to #1698

@gulldan
Copy link

gulldan commented Feb 4, 2025

same with python 3.10, uv and glibc 2.41

@infranscia
Copy link

I've got the same error with python 3.12.8, and also glibc 2.41(+r2+g0a7c7a2e283a-1).

This said, the stable (and Arch Electron) version(s) of Discord was hit with the exact error issue recently. It affected the voice chat component and made it so Discord couldn't access your mic info. I'm guessing the same dependency affected them both. That said, the AUR indicates that vanilla Discord doesn't use Python.

The only non-optional shared dependency I'm seeing between vanilla Discord and the Arch Electron version is libxss... which is downstream from glibc. I'm thinking maybe they need some info, if they don't have it already. 😅

@gestur1976
Copy link

gestur1976 commented Feb 6, 2025

Same here in Arch Linux with Python 3.12.8 and glibc 2.41+r2+g0a7c7a3e283a-1

ImportError: libctranslate2-bc15bf3f.so.4.5.0: cannot enable executable stack as shared object requires: Invalid argument

Downgrading to glibc-2.40-1 temporary addresses the issue:

pacman -U https://archive.archlinux.org/packages/g/glibc/glibc-2.40-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/l/lib32-glibc/lib32-glibc-2.40-1-x86_64.pkg.tar.zst

@TwenZy2005
Copy link

same issue on arch with python 3.10 but downgrading solved it

@igormp
Copy link
Author

igormp commented Feb 17, 2025

Fwiw, another likely workaround would be to use patchelf instead of execstack:

patchelf --clear-execstack /home/igor/.local/lib/python3.12/site-packages/ctranslate2.libs/libctranslate2-bc15bf3f.so.4.5.0

Source

@xcsnowcity
Copy link

Same here in Arch Linux with Python 3.12.8 and glibc 2.41+r2+g0a7c7a3e283a-1

ImportError: libctranslate2-bc15bf3f.so.4.5.0: cannot enable executable stack as shared object requires: Invalid argument

Downgrading to glibc-2.40-1 temporary addresses the issue:

pacman -U https://archive.archlinux.org/packages/g/glibc/glibc-2.40-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/l/lib32-glibc/lib32-glibc-2.40-1-x86_64.pkg.tar.zst

Normally, downgrading such a package is not a good idea, as it may prevent your system from booting.

@undrwater
Copy link

Fwiw, another likely workaround would be to use patchelf instead of execstack:

patchelf --clear-execstack /home/igor/.local/lib/python3.12/site-packages/ctranslate2.libs/libctranslate2-bc15bf3f.so.4.5.0

Source

I attempted this, but the same error was returned upon running.

@Tear4Pixelation
Copy link

Tear4Pixelation commented Feb 19, 2025

Fwiw, another likely workaround would be to use patchelf instead of execstack:

patchelf --clear-execstack /home/igor/.local/lib/python3.12/site-packages/ctranslate2.libs/libctranslate2-bc15bf3f.so.4.5.0

this works for me! Thank you. Make sure to replace user with your username (command whoami) if you have it installed globally, else replace /home/user/.local/lib/ with path_to_venv/lib/...
/home/user/.local/lib/python3.12/site-packages/ctranslate2.libs/libctranslate2-bc15bf3f.so.4.5.0

@igormp
Copy link
Author

igormp commented Feb 19, 2025

I believe my PR at #1852 is finally ready, which should fix this issue on Linux. Hopefully someone will find time to take a look at it.

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 a pull request may close this issue.

8 participants