compilation - Linking against XCode dylibs with Python ctypes -


i installing pyglet dependency vispy seeing following error after installation

file "/library/python/2.7/site-packages/pyglet/lib.py", line 160, in load_library  raise importerror('library "%s" not found.' % names[0]) importerror: library "c" not found. 

digging through source code, realized pyglet attempting load standard c library using ctypes framework.

further digging reveals actual (un-swallowed) error:

file   "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__ self._handle = _dlopen(self._name, mode) oserror: dlopen(/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.10.sdk/usr/lib/libc.dylib, 6): no suitable image found.  did find: /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.10.sdk/usr/lib/libc.dylib: mach-o, wrong filetype 

the issue, think, similar this question there architecture mismatch. python c binding framework 'ctypes' attempting load .dylib wrong architecture.

since have set $ld_library_path

/applications.../macosx10.10.sdk/usr/lib/ 

the loader favoring directory. however, if try load 'libc.dylib' standard location /usr/lib works perfectly.

the obvious potential problem xcode version of 'libc' 32-bit architecture /usr/lib 64-bit architecture.

not true!

here output of file both libraries:

xcode version

libc.dylib: mach-o universal binary 2 architectures libc.dylib (for architecture x86_64):   mach-o 64-bit dynamically linked shared library stub x86_64 libc.dylib (for architecture i386): mach-o dynamically linked shared library stub i386 

and standard in /usr/lib

/usr/lib/libc.dylib: mach-o universal binary 2 architectures /usr/lib/libc.dylib (for architecture x86_64):  mach-o 64-bit  dynamically linked shared library x86_64 /usr/lib/libc.dylib (for architecture i386):    mach-o dynamically linked shared library i386 

the difference xcode version "stub". despite googling, difference not entirely clear, though appears difference between "stub" dylib , "non-stub" causing problem.

a bit more information setup:

/usr/bin/python : python 2.7.10 , appears running 64-bit app uname -a: darwin x-10-104-106-204.uofm-secure.wireless.umn.edu 14.5.0 darwin kernel version 14.5.0: wed jul 29 02:26:53 pdt 2015; root:xnu-2782.40.9~1/release_x86_64 x86_64 

my question how 1 link against dylibs installed xcode?

thanks in advance ideas , suggestions.


Comments