为Openwrt交叉编译Gnu Radio

时间:2012-07-25 23:05:55

标签: swig cross-compiling openwrt gnuradio

我正在尝试在OpenWRT上安装Gnu Radio“Attittude Adjustment”(最新的主干来源)。我已经交叉编译了GR,一切似乎已经编译和链接就好了。但是,在Python中导入模块会产生以下结果:

root@OpenWrt:/usr/lib/python2.7/dist-packages/gnuradio/gr# python
Python 2.7.3 (default, Jul 21 2012, 17:36:54) 
[GCC 4.6.3 20120201 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gnuradio import gr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gnuradio/gr/__init__.py", line 43, in <module>
    from gnuradio_core import *
  File "/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core.py", line 23, in <module>
    from gnuradio_core_runtime import *
  File "/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core_runtime.py", line 26, in <module>
    _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
>>> 

请注意,已在包含SWIG库的目录中调用Python。这是ldd _gnuradio_core_runtime.so,在目标系统上运行:

checking sub-depends for '/usr/lib/libgnuradio-core-3.6.2git.so.0.0.0'
checking sub-depends for '/usr/lib/libgruel-3.6.2git.so.0.0.0'
checking sub-depends for '/usr/lib/libboost_date_time.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_program_options.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_filesystem.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_system.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_thread.so.1.49.0'
checking sub-depends for '/lib/libpthread.so.0'
checking sub-depends for '/usr/lib/libstdc++.so.6'
checking sub-depends for '/lib/libm.so.0'
checking sub-depends for '/lib/libgcc_s.so.1'
checking sub-depends for '/lib/libc.so.0'
checking sub-depends for '/usr/lib/libfftw3f.so.3'
checking sub-depends for 'not found'
checking sub-depends for '/lib/librt.so.0'
checking sub-depends for '/usr/lib/libvolk.so.0.0.0'
checking sub-depends for '/lib/libdl.so.0'
    libgnuradio-core-3.6.2git.so.0.0.0 => /usr/lib/libgnuradio-core-3.6.2git.so.0.0.0 (0x00000000)
    libgruel-3.6.2git.so.0.0.0 => /usr/lib/libgruel-3.6.2git.so.0.0.0 (0x00000000)
    libboost_date_time.so.1.49.0 => /usr/lib/libboost_date_time.so.1.49.0 (0x00000000)
    libboost_program_options.so.1.49.0 => /usr/lib/libboost_program_options.so.1.49.0 (0x00000000)
    libboost_filesystem.so.1.49.0 => /usr/lib/libboost_filesystem.so.1.49.0 (0x00000000)
    libboost_system.so.1.49.0 => /usr/lib/libboost_system.so.1.49.0 (0x00000000)
    libboost_thread.so.1.49.0 => /usr/lib/libboost_thread.so.1.49.0 (0x00000000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00000000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00000000)
    libm.so.0 => /lib/libm.so.0 (0x00000000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00000000)
    libc.so.0 => /lib/libc.so.0 (0x00000000)
    libfftw3f.so.3 => /usr/lib/libfftw3f.so.3 (0x00000000)
    libfftw3f_threads.so.3 => not found (0x00000000)
    librt.so.0 => /lib/librt.so.0 (0x00000000)
    libvolk.so.0.0.0 => /usr/lib/libvolk.so.0.0.0 (0x00000000)
    libdl.so.0 => /lib/libdl.so.0 (0x00000000)
    ld-uClibc.so.0 => ld-uClibc.so.0 (0x00000000)

以下是构建系统中file _gnuradio_core_runtime.so的输出:

_gnuradio_core_runtime.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

目标系统在Intel Atom上运行。最后,我能想到的最后一条有用信息是PYTHONPATH设置为/usr/lib/python2.7/dist-packages。我不知道问题是什么。我希望精彩的堆栈溢出社区可以帮助找到解决方案。提前感谢您的任何指示!

1 个答案:

答案 0 :(得分:2)

目标缺少libfftw3f_threads.so库。由于系统调用dlopen()无法解析_gnuradio_core_runtime.so的依赖关系,因此它告诉Python无法找到该文件。我将库复制到目标,执行ldconfig,并且Python正确加载了库。 (解决方案归功于Flexo)。