On Jan 27, 11:58 am, "Drew Smathers" <[EMAIL PROTECTED]> wrote:
> On Jan 26, 2008 11:39 AM, Gary <[EMAIL PROTECTED]> wrote:
>
>
>
> > So... after poking around a bit more (and a good night's sleep and a
> > cup of coffee) here's a fix to the single load_library in clock.py
>
> > _c =pyglet.lib.load_library('c',linux2='/lib/libc.so.6',darwin='/lib/
> > libc.so.6')
>
> This is definitely not a fix.  You're essentially breaking clock on MacOSX
> and also adding a hard-coded assumption of what version and where libc is
> going to be on Linux - and this varies from distro to distro.

Not true.   Keyword parameters of the form platform=path are only
applied when on the specified platform, so the linux2=  will not
affect
execution of load_library on MacOSX in any way.  (Just like the
darwin=
parameter is completely ignored on Window's and Linux.)

As to the hard-coded version assumption, you are correct, but I'm just
following the precedence set by the darwin=  which was already there.
I'm sure a better solution that makes no assumption on any platform
would be appreciated.

> If you look
> closer at the load_library  method on the Loader class and see what it's
> doing, there's already a check for the platform type - your assumption that
> it was taking the MacOSX branch isn't correct.  The ascii text you mention
> is an ld linker script - ctypes should handle this fine though, to link to
> the correct  library.

Again, not quite right.  I did mis-label the branch when I said it was
MacOSX.  In fact there are two branches to the if -- one for win32 and
cygwin, and the other for everything else, including Linux and
MacOSX.
And in fact, ctypes is *not* following the ld linker script in
/usr/lib/libc.so, but instead gives an error claiming that the file
does
not have an ELF header.  (Which is true -- since the file is ascii
text.)  Perhaps ctypes should handle such a file, but it is not in
this
case.  Maybe this is a ctypes bug.


> >

>
> Anyhow, a complete stacktrace will help us help you some more.

Sure (Python2.5 on Gentoo Linux):

python -c 'import pyglet.clock'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "clock.py", line 165, in <module>
  File "/usr/lib/python2.5/site-packages/pyglet/lib.py", line 44, in
load_library
    return ctypes.cdll.LoadLibrary(path)
  File "/usr/lib/python2.5/site-packages/ctypes/__init__.py", line
395, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python2.5/site-packages/ctypes/__init__.py", line
312, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libc.so: invalid ELF header


Gary Herron

>
> --
> \\\\\/\"/\\\\\\\\\\\
> \\\\/ // //\/\\\\\\\
> \\\/  \\// /\ \/\\\\
> \\/ /\/ / /\/ /\ \\\
> \/ / /\/ /\  /\\\ \\
> / /\\\  /\\\ \\\\\/\
> \/\\\\\/\\\\\/\\\\\\
>               d.p.s
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to