[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: looking for fix to AMD64 python dl problem....



On Sat, Feb 17, 2007 at 11:27:12PM +0000, Michael Fothergill wrote:
> Dear Debianists,
> 
> I have been trying to compile a progam called ASCEND IV from 
> sourceforge.net using scons that usually runs on an i386 on my AMD64 
> Sempron 3200 box.  I am running Debian Etch RC1 AMD64.
> 
> One of the developers has been helping me.  We have managed to compile it 
> but have found that the dl function in python doesn't work in AMD64.  It is 
> an essential feature for ASCEND. Ultimately I would make a deb package for 
> this program for general release.  Suggestions on a dl fix welcome.  Am 
> using python2.4
> 
> 
> mikef@localhost:~/ascend$ ./test.py
> Traceback (most recent call last):
>  File "./test.py", line 31, in ?
>    import dl
> ImportError: No module named dl
> mikef@localhost:~/ascend$ pygtk/ascdev models/johnpye/testlog10.a4c
> 
According to the Python docs [0], dl only works with a number of
conditions:

  Note: This module will not work unless sizeof(int) == sizeof(long) ==
  sizeof(char *) If this is not the case, SystemError will be raised on
  import.

If you run this program on an amd64 machine:

  $ cat sizes.c 
  #include <stdio.h>

  int main(void) {
    printf("int: %d; long: %d; char *: %d\n", sizeof(int), sizeof(long), sizeof(char *));
    return 0;
  }

This is what you get:

  $ ./a.out 
  int: 4; long: 8; char *: 8

So, the answer is that the dl module will not work on amd64.  The
recommended fix would then be to not use dl, since it is an ugly hack
(as is any foreign function interface) and instead write proper Python
bindings for whatever library you are trying to access.

Regards,

-Roberto
-- 
Roberto C. Sanchez
http://people.connexer.com/~roberto
http://www.connexer.com

Attachment: signature.asc
Description: Digital signature


Reply to: