Embedding Python at the OS level - build problems

Ryan Paul segphault at sbcglobal.net
Tue May 25 21:09:38 EDT 2004


On Tue, 25 May 2004 20:34:14 -0400, Phil Frost wrote:

> Greetings all. I'm attempting to embed a python interpreter at a very
> low level in an OS I am writing. Currently I'm stuck with build issues.
> Firstly, as there is no working C compiler in our OS, I must cross
> compile Python. I encountered errors when building Parser/pgen; I got
> around this by building it nativly and copying it. Hopefully this won't
> get me later...
> 
> My current problem (and there are sure to be more ;) ) is when building
> Modules/posixmodule.c. I've already done a great deal of hacking;  I
> manually commented the inclusion of stropts.h as it was getting it from
> /usr/include which is not part of the target machine's include files.
> That was probably not a good idea, but hey...
> 
> Now, I get:
> 
> /home/indigo/dev/uuu/uuu/lib/c/bin-i386/diet gcc  -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include  -DPy_BUILD_CORE  -c ./Modules/posixmodule.c -o Modules/posixmodule.o
> Modules/posixmodule.c: In function `posix_openpty':
> Modules/posixmodule.c:2623: warning: implicit declaration of function `ioctl'
> Modules/posixmodule.c:2623: error: `I_PUSH' undeclared (first use in this function)
> Modules/posixmodule.c:2623: error: (Each undeclared identifier is reported only once
> Modules/posixmodule.c:2623: error: for each function it appears in.)
> Modules/posixmodule.c: In function `posix_setgroups':
> Modules/posixmodule.c:4527: error: `MAX_GROUPS' undeclared (first use in this function)
> 
> I really have a swarm of questions. Among them are:
> 
> - is there a better way to cross compile python?
> - is there anything I can do about the above error?
> 
> But most importantly:
> 
> - is the posix module really required? At the moment, I'm interested in
>   only getting a minimal Python working, so anything that can be
>   disabled, should be. What things can I do to eliminate all features,
>   modules, and whatever that isn't required to build libpython2.3.a?

interesting project. what are the benefits of integrating python into an
operating system? I could understand making kernel modules for services
that you would otherwise run as a daemon, but what is the motivation for
such low level integration of a high level interpreter?



More information about the Python-list mailing list