Build Simulation Library for Linux x86 on Debian x86_64 host

This page describes the simplest way to build an x86 (32-bit) Linux OpenVisualizer simulation module on a Debian Linux x86_64 (64-bit) host.

We require a 32-bit Python library and include files, so we build it from source. Then we use the generated files to create the simulation module in the usual way with SCons. We must pass extra parameters to SCons to specify an x86 build.

Build 32-bit Python

The Python library itself is required for the final linking step of the simulation module. The instructions below are based on Floris Bruynooghe's helpful HOWTO.

  1. Install the gcc-multilib package, which allows for 32-bit generation.
  2. Download and install the Python 2.7 tarball. As of this writing, the latest is 2.7.6.
  3. Run the configure script with the proper environment variables. The '–prefix' directory can be a local user directory, so we do not need superuser privileges for the 'make install' step.
       BASECFLAGS=-m32 LDFLAGS=-m32 CFLAGS=-m32 ./configure --enable-shared --prefix=/home/kbee/opt/python32
  4. Run make. The result will complain about unbuilt modules. My build showed _bsddb, _curses, _curses_panel, _sqlite3, _ssl, _tkinter, bsddb185, bz2, dbm, gdbm, readline, sunaudiodev, zlib. However, we don't care because our goal only was to build the python library for linking the simulation module.
  5. Run make install. The end result is shown below.
kbee@verix:~/opt/python32$ ls -l
total 16
drwxr-xr-x 2 kbee kbee 4096 Dec  8 08:26 bin
drwxr-xr-x 3 kbee kbee 4096 Dec  8 08:31 include
drwxr-xr-x 4 kbee kbee 4096 Dec  8 08:26 lib
drwxr-xr-x 3 kbee kbee 4096 Dec  8 07:52 share

kbee@verix:~/opt/python32$ ls -l lib
total 13932
-r-xr-xr-x  1 kbee kbee 8461856 Dec  8 07:52 libpython2.7.a
lrwxrwxrwx  1 kbee kbee      19 Dec  8 08:26 ->
-r-xr-xr-x  1 kbee kbee 5776869 Dec  8 08:26
drwxr-xr-x  2 kbee kbee    4096 Dec  8 08:26 pkgconfig
drwxr-xr-x 27 kbee kbee   20480 Dec  8 08:26 python2.7

Build 32-bit simulation module

With the Python library and headers in place, we now can build the simulation module. We must specify the x86-linux cross-build, and the location of the 32-bit Python files.

$ scons board=python toolchain=gcc simhost=x86-linux simhostpy=~/opt/python32 oos_openwsn

The resulting library, '', is in the 'firmware/openos/projects/common' directory.