Cross compiling (Swig issue?)

Hello all,

I’ve tried to build GNU Radio 3.6.0 for an embedded system running
OpenWRT.
I cross compiled with OpenWRT’s toolchain, but used Swig 2.0.4 on the
host
system. When I try to run a GNU Radio program that requires Python, I
get
the following error:

root@OpenWrt:~# usrp_flex
Traceback (most recent call last):
File “/usr/bin/usrp_flex”, line 24, in
from gnuradio import gr, gru, uhd, optfir, eng_notation, pager
File “/usr/lib/python2.7/dist-packages/gnuradio/gr/init.py”, line
43,
in
from gnuradio_core import *
File “/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core.py”,
line
23, in
from gnuradio_core_runtime import *
File
“/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core_runtime.py”,
line 26, in
_gnuradio_core_runtime = swig_import_helper()
File
“/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core_runtime.py”,
line 22, in swig_import_helper
_mod = imp.load_module(‘_gnuradio_core_runtime’, fp, pathname,
description)
ImportError: File not found

My first hunch is that I am missing environment variables, but I’m not
really sure. It could also be a problem with Swig, which is why I’m
posting
this; I don’t know much about this program. Any help would be greatly
appreciated, and thanks in advance for any help!

Regards,
Chris

View this message in context:
http://old.nabble.com/cross-compiling-(Swig-issue-)-tp34068092p34068092.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Chris, I’m a little confused by “I used SWIG 2.0.4 on the host” I
haven’t
used OpenWRT but the assumption is that you have a cross compiled swig
on
your host which you’re linking against and have installed on your
embedded
target. It sounds like either some library is not installed properly
but
again it can be an environmental variable issue.

Are you making packages via openwrt? Filesystem? Can you provide some
more
details? The easy but loooong way to get gnuradio working on embedded
platforms might be a native compilation … Philip B. might have
more insight … he always does :slight_smile:

Hello Almohanad, thanks for your quick reply!

Almohanad F.-2 wrote:

Chris, I’m a little confused by “I used SWIG 2.0.4 on the host” I haven’t
used OpenWRT but the assumption is that you have a cross compiled swig on
your host which you’re linking against and have installed on your embedded
target. It sounds like either some library is not installed properly but
again it can be an environmental variable issue.

Yes that’s correct, although I haven’t installed swig on the embedded
system. I was under the impression that there was no runtime libraries
for
swig and that it wouldn’t need to be installed. Am I wrong on this?

Almohanad F.-2 wrote:

Are you making packages via openwrt? Filesystem?

As of now I’m not working on a package for openwrt; if I can figure this
out
though, it’s something I’ll certainly consider.

Almohanad F.-2 wrote:

Can you provide some more details? The easy but loooong way to get
gnuradio working on embedded platforms might be a native compilation
… Philip B. might have more insight … he always does :slight_smile:

My approach was to find packages for and install all the prerequisite
software, then cross compile gnuradio as well as the UHD from Ettus
Research. The build is pretty standard, except that I use swig on the
computer on which I’m doing the build. Here’s what I do for cmake:

cmake …/
-DCMAKE_TOOLCHAIN_FILE=~/openwrt/scratch/Toolchain-net6501-gnuradio.cmake

-DCMAKE_INSTALL_PREFIX=foo
-DSWIG_DIR=/usr/share/swig2.0
-DSWIG_EXECUTABLE=/usr/bin/swig
-DSWIG_VERSION=2.0.4
-DENABLE_GR_WXGUI=OFF
-DENABLE_DOXYGEN=OFF
-DENABLE_GRC=OFF
-DENABLE_GR_NOAA=OFF
-DENABLE_GR_ATSC=OFF
-DENABLE_GR_AUDIO=OFF
-DENABLE_GR_VOCODER=OFF
-DENABLE_GR_WAVELET=OFF
-DENABLE_GR_UHD=ON

I do make && make install and transfer the binaries to the target
machine. I
verified that everything was linked properly with ldd (eg. ldd
_gnuradio_core_runtime.so). I don’t think there is anything wrong with
the
build, but there may be something funny going on with swig. I believe
there
are simply missing environment variables. Currently, PYTHONPATH is set
to
/usr/lib/python2.7/dist-packages as it should be.

I hopes this is is enough info, let me know if you need more! I’m sort
of
apprehensive about trying to do a native build as I would need to port
cmake
for the target platform. How would I get a hold of Philip B.?

Thanks again!
Best,
Chris


View this message in context:
http://old.nabble.com/cross-compiling-(Swig-issue-)-tp34068092p34068989.html
Sent from the GnuRadio mailing list archive at Nabble.com.