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.
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.
BASECFLAGS=-m32 LDFLAGS=-m32 CFLAGS=-m32 ./configure --enable-shared --prefix=/home/kbee/opt/python32
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.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 libpython2.7.so -> libpython2.7.so.1.0 -r-xr-xr-x 1 kbee kbee 5776869 Dec 8 08:26 libpython2.7.so.1.0 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 |
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, 'oos_openwsn.so', is in the 'firmware/openos/projects/common' directory.