Cross compiling Gnu Radio for Openwrt

别等时光非礼了梦想. 提交于 2019-12-10 15:54:50

问题


I'm attempting to install Gnu Radio on OpenWRT "Attittude Adjustment" (latest trunk sources). I've cross compiled GR and everything seems to have compiled and linked just fine. However, importing the module in Python results in the following:

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
>>> 

Note that Python has been invoked in the directory containing the SWIG library. Here is ldd _gnuradio_core_runtime.so, running on the target system:

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)

Here is the output of file _gnuradio_core_runtime.so on the build system:

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

The target system runs on an Intel Atom. Finally, the last piece of useful information I can think of is that PYTHONPATH is set to /usr/lib/python2.7/dist-packages. I'm at a loss as to what the problem is. I hope the wonderful stack overflow community may help find a solution. Thank you in advance for any pointers!


回答1:


The target was missing the libfftw3f_threads.so library. Since the system call dlopen() couldn't resolve the dependencies of _gnuradio_core_runtime.so, it told Python the file couldn't be found. I copied the library to the target, did ldconfig, and Python loaded the library correctly. (Solution credited to Flexo).



来源:https://stackoverflow.com/questions/11659973/cross-compiling-gnu-radio-for-openwrt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!