Need help configuring pyrex for primes.pyx example

Michael JasonSmith mpj17 at
Fri Aug 2 05:59:35 CEST 2002

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] 
> Segmentation fault (core dumped)
Excellent, I think I can help you with this one.  Rather than
executing the module, try 
	>>> 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

I hope this helps,
Michael JasonSmith

More information about the Python-list mailing list