>>You could give instructions on how to repeat your experiment.  Then we apply 
>>science ;)

Ah science, I’m told that works. OK Ive spent a great deal of time trying to 
figure out a solution, learned alot but still haven’t put enough pieces 
together to make it work or even understand where the problem lies.  I shall 
ask for help. 

The context is I do most of my programming in Python. I am trying to learn more 
about C and at least be very good at building C programs if not writing them. 
My immediate goal is to take Python ‘hello world’ program and build it as a 
rump kernel.

I‘m using python 3.4 and using cython http://cython.org/ which is a python 
compiler, or more specifically, translates Python to C. You can install it by 
'pip install cython'

hw.py is hello world in python (attached to this email). 

It is converted to c via this command:
cython --embed hw.py

The embed flag creates a standlone program. The result should be hw.c which is 
attached to this email

To compile it is necessary to first install the python dev headers via 
sudo apt-get install python3.4-dev

hw.c should now be possible to compile, using the following line
gcc $CFLAGS -I/usr/include/python3.4m -o hw hw.c -lpython3.4m -lpthread -lm 
-lutil -ldl

there is now a ‘hw' application which works, and prints ‘hello world'

I now want to build hw.c into a rump kernel. So I re-do last command but 
replace gcc with rump run-xen-cc

rumprun-xen-cc $CFLAGS -I/usr/include/python3.4m -o hw hw.c -lpython3.4m 
-lpthread -lm -lutil -ldl
In file included from hw.c:8:0:
/usr/include/python3.4m/pyconfig.h:78:3: error: #error unknown multiarch 
location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
In file included from /usr/include/python3.4m/Python.h:8:0,
                 from hw.c:16:
/usr/include/python3.4m/pyconfig.h:78:3: error: #error unknown multiarch 
location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
In file included from /usr/include/python3.4m/pyport.h:4:0,
                 from /usr/include/python3.4m/Python.h:50,
                 from hw.c:16:
/usr/include/python3.4m/pyconfig.h:78:3: error: #error unknown multiarch 
location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
In file included from /usr/include/python3.4m/Python.h:50:0,
                 from hw.c:16:
/usr/include/python3.4m/pyport.h:814:2: error: #error "LONG_BIT definition 
appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc 
config?)."
  ^
In file included from /usr/include/python3.4m/pymath.h:4:0,
                 from /usr/include/python3.4m/Python.h:64,
                 from hw.c:16:
/usr/include/python3.4m/pyconfig.h:78:3: error: #error unknown multiarch 
location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
In file included from /usr/include/python3.4m/pytime.h:5:0,
                 from /usr/include/python3.4m/Python.h:65,
                 from hw.c:16:
/usr/include/python3.4m/pyconfig.h:78:3: error: #error unknown multiarch 
location for pyconfig.h
 # error unknown multiarch location for pyconfig.h
   ^
In file included from /usr/include/python3.4m/Python.h:77:0,
                 from hw.c:16:
/usr/include/python3.4m/unicodeobject.h:68:2: error: #error Must define 
SIZEOF_WCHAR_T
 #error Must define SIZEOF_WCHAR_T
  ^
/usr/include/python3.4m/unicodeobject.h:125:2: error: #error "Could not find a 
proper typedef for Py_UCS4"
 #error "Could not find a proper typedef for Py_UCS4"
  ^
/usr/include/python3.4m/unicodeobject.h:131:2: error: #error "Could not find a 
proper typedef for Py_UCS2"
 #error "Could not find a proper typedef for Py_UCS2"
  ^



I feel like I have a fundamental piece of understanding missing here but I’m 
not quite sure what it is.

I’ve had a damn good shot at working it out and now give over to science. Any 
help appreciated.

as





def hello_world():
    import sys
    print("Welcome to Python %d.%d!" % sys.version_info[:2])

if __name__ == '__main__':
    hello_world()

Attachment: hw.c
Description: Binary data

Reply via email to