Just wanted to share some woes I recently suffered when using modules that depend on ctypes, and the problem at hand really is the implementation for find_library works in the ctypes.util module.
What happens in a nutshell is that that code runs ldconfig -p, this has two problems:
We get anything in the ld cache, which means any system library as a result.
It will never find anything inside $SNAP
By changing the implementation (could even just be a mapping of name -> libname for very strict and under control implementations) and setting things will get going successfully.
If you are a victim of this you will see an OSError exception that looks like:
OSError: Could not locate nacl lib, searched for libsodium.so, libsodium.so.13, libsodium.so.10, libsodium.so.5, libsodium.so.4, and tweetnacl.so
And you might be confused because you might have libsodium.so inside $SNAP. This error can be masked the other way if you have it installed on the system and without notice, you’d be using that instance of the library.
Is there a clear symptom of the problem which might help people searching for it to find your solution here? Some telling error message or anything else along those lines?
I’ve hit something very similar to this yesterday. Thank you for noting it here - it was helpful to have found this post.
I ended up hacking python-augeas in the code where it looks for the library. When inside a snap, I’ve hardcoded the path.
This can’t go upstream in its current state of course. Any suggestions on a proper fix? Perhaps the bug you referred to has more information. Could you link it please?
I stuck this modified version of python-augeas in a branch on GitHub and added as an additional part that installs first. Then it fulfills the later requirement for python-augeas so it gets used instead.