Re: Help in understanding the underlying issue here.

  • From: Antti Kantee <pooka@xxxxxx>
  • To: rumpkernel-users@xxxxxxxxxxxxx
  • Date: Wed, 27 May 2015 07:44:51 +0000

On 27/05/15 07:10, Andrew Stuart wrote:

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
^

The multiarch error message is a bit misleading. It's not failing because there's a multiarch problem, it's failing because there's a multi-OS problem. /usr/include/python*/pyconfig.h is trying to figure out where to find the real pyconfig.h from, and since it doesn't know, it's bailing out.

You essentially need a pyconfig.h generated for the target environment. I don't know what produced pyconfig.h, perhaps building cython from source? pyconfig.h looks like something generated by gnu autoconf, so there should not be any big problems in generating it. If you then point the rumprun-xen-cc at the headers generated by pyconfig.h generated against the rumprun env (not the host env), you should get further.

Other related posts: