本文介绍了交叉编译Gnu Radio for Openwrt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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)

这是的输出内部版本系统上的文件_gnuradio_core_runtime.so

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



PYTHONPATH 设置为 /usr/lib/python2.7/dist-packages 。我不知所措是什么问题。我希望精彩的堆栈溢出社区可以帮助您找到解决方案。预先感谢您提供任何指针!

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!

推荐答案

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

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

这篇关于交叉编译Gnu Radio for Openwrt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 01:22