Need help configuring pyrex for primes.pyx example
David Lees
debl2nonospamykwamm at bellatlantic.net
Fri Aug 2 01:08:13 EDT 2002
Thanks for all the quick responses and explanations. I should have read
further in the 'quick guide' to the section on 'Using Your Module'. I
get it now and the primes example works just fine. This looks like a
really neat tool.
David Lees
Michael JasonSmith wrote:
>
> In David Lees wrote:
> > I just downloaded Pyrex 0.4 and am running on a linux box at work.
> > I do not have admin privlige which could be my problem.
> I run Pyrex as a normal user, so I doubt that will be the problem.
>
> > I am trying to follow 'Michael"s quick guide' using gcc.
> Hmmm, sounds like I have a documentation bug, I will try and fix
> it. :)
>
> > [debl at whiplash Demos] primes.so
> > Segmentation fault (core dumped)
> Excellent, I think I can help you with this one. Rather than
> executing the module, try
> python
> >>> import primes
> >>> primes.primes(12)
> at the command line. (Make sure you are running Python 2.2.)
>
> > I assume my problem is in the linking, because I am clueless as to
> > what the '-lxosd' on the command line of his link is.
> Pyrex creates a module that can be *loaded* into Python. The modules,
> which have ".so" extensions under Linux/Unix, cannot be run on their
> own, instead you have to "import" the compiled module into Python and
> use it in the same way as a normal Python module.
>
> The "-lxosd" causes the external C module "xosd" (C calls it a
> library, but we will ignore this terminology problem) to be
> incorporated into the Python module. It is needed in the Guide
> example because we are writing a wrapper for the functions provided by
> the "xosd" module. The "primes" example does not need any external C
> modules so you will not need to link against anything. Something like:
> gcc -shared primes.o -oprimes.so
>
> I hope this helps,
> Michael
> --
> Michael JasonSmith http://www.cosc.canterbury.ac.nz/~mpj17/
More information about the Python-list
mailing list