problem with python-ctypes on embedded systems

Hi,

I tried to add pyusb to buildroot (

formatting link
) and run into problems with ctypes not load ing the appropriate libusb backend (
formatting link
).

The problem is associated with the way how ctypes package detects the name of necessary shared library. Particularly it fails on uclibc based systems running on Arm platform. I'm interested if someone has also faced that problem, and found a good sol ution. I had to patch the nested _findSoname_ldconfig(name) function in the Pyth on-2.7.3/Lib/ctypes/util.py file, adding the appropriate definition for my platform:

mach_map = { 'x86_64-64': 'libc6,x86-64', 'ppc64-64': 'libc6,64bit', 'sparc64-64': 'libc6,64bit', 's390x-64': 'libc6,64bit', 'ia64-64': 'libc6,IA-64', 'armv6l','libc0', # Added by WZab for ctypes support on Ras pberry Pi } abi_type = mach_map.get(machine, 'libc6')

but this approach doesn't seem to be satissfactory...

--
Regards, 
Wojtek
Reply to
wzab01
Loading thread data ...

Wojtek - did you mean to put a colon ":" instead of the first comma "," above ?

Reply to
Dave Nadler

bove ?

Yes, of course. My mistake. But anyway the problem exists.

This mistype would only break my workaround... Thanks, Wojtek

Reply to
wzab01

Well, in fact my mistake was even worse, to get it working one must add the "-32" or "-64" suffix to the name of the platform.

So the correct content of mach_map is:

mach_map = { 'x86_64-64': 'libc6,x86-64', 'ppc64-64': 'libc6,64bit', 'sparc64-64': 'libc6,64bit', 's390x-64': 'libc6,64bit', 'ia64-64': 'libc6,IA-64', 'armv6l-32':'libc0', # Added by WZab for ctypes support } abi_type = mach_map.get(machine, 'libc6')

Sorry for confusion. My fault. I have tested that setting of abi_type to 'libc0' does the trick, and then sent the workaround supposed to substitute it only for my platform, without testing it :-(.

--
Regards, 
Wojtek 
 Click to see the full signature
Reply to
wzab01

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.