-
Notifications
You must be signed in to change notification settings - Fork 112
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
find_library is failed to get the sndfile #258
Comments
Is libsndfile installed? |
@bastibe |
As you found out yourself, So you'll have to figure out why Python can't locate your You can probably |
@bastibe I have a buildroot environment, as per as compilation is concern I did a clean build to make sure nothing missed in-terms of dependencies. I don't have any LD_LIBRARY_PATH on my shell env, since the systems is pretty much a rootfs rather than a distro. |
As a first step, try |
@bastibe not sure I have used it properly, would you please check the below syntax and correct me If I'm wrong. linux$ car test.py linux$ LD_PRELOAD=/usr/lib/libsndfile.so python3 -c "import soundfile" |
That looks correct. I'd say that either your libsndfile is somehow incompatible with your Python (different compiler, different glibc, or something like that), or your Python installation is somehow misconfigured. I'd recommend playing around with I've had to deal with issues like this in a different project. Perhaps the following function can help: https://github.com/bastibe/transplant/blob/master/transplant/transplant_master.py#L654 |
I know it sound improper, but I can went through by explicitly mention the path like below. try: try: I tried to find the way to get the libsndfile.so in the system via some os.path.abspath or similar but none can give the desired path of libsndfile.so. @bastibe any clue on this might help to get through this work around atleast for now. thanks! |
Does the If so, you'll have to either
If not, the library is probably incompatible in some way and can't be loaded. Then you'll have to figure out how they differ, or how to get compatible versions of Python and the library. |
Weirdly yes! So, in a kind've wild turn of events, this appears to be a bug in python, that at least pyusb solved with a custom load override. I recently ran into this while making a Rhasspy satellite image in Buildroot, and started looking around. Apparently it's an issue with buildroot not having a library finding mechanism that python can use for For now I'm planning on using a slightly modified soundfile.py. I know this is a really niche subset of folks using python-soundfile on embedded systems, so I'm just letting you know mostly for awareness (and for anyone else who comes across this) as testing something like this on a real system is not easy. Thanks for the work on python-soundfile btw - it's used in a lot of places far and wide! |
Thank you! If you'd like, I'd be grateful for an addition to the README, perhaps under the Known Issues header, to help other users who might be experiencing the same issue. |
Yeah, I can make that happen! |
This issues has observed while importing soundfile module at arm64 target. target runs on Python 3.7.4.
Soundfile.py is unable to get the sndfile but the same /usr/lib/libsndfile.so
linux$ python3 test_imports/test_audio.py
Traceback (most recent call last):
File "test_imports/test_audio.py", line 5, in
import soundfile
File "usr/lib/python3.7/site-packages/soundfile.py", line 142, in
OSError: sndfile library not found
So, I tried ctype.CDLL instead of find_library
-- _libname = _find_library('sndfile')
++ _libname = ctypes.CDLL('libsndfile.so')
++ print('Library: %s' % _libname)
But it is failing to open the _libname
linux$ python3 test_imports/test_audio.py
Library: <CDLL 'libsndfile.so', handle 3a832320 at 0x7f97cf0b50>
Traceback (most recent call last):
File "test_imports/test_audio.py", line 5, in
import soundfile
File "usr/lib/python3.7/site-packages/soundfile.py", line 147, in
TypeError: load_library() argument 1 must be str, bytes or bytearray, not CDLL
Any proper fix for this?
Jagan.
The text was updated successfully, but these errors were encountered: