analogdevicesinc / gr-iio

IIO blocks for GNU Radio
GNU General Public License v3.0
94 stars 61 forks source link

Undefined symbol in libgnuradio-iio: _ZN5boost6chrono12steady_clock3nowEv #79

Closed ivanmikh closed 4 years ago

ivanmikh commented 4 years ago

I have a problem with FMComms2/3/4 or PlutoSDR blocks in GNU Radio. I have GNU Radio 3.8 and PlutoSDR connected via USB.

I am trying to run cyclic-sine_pluto.grc from gr-iio/iio-examples and I get an error:

Traceback (most recent call last):
  File "/usr/local/lib/python3/dist-packages/iio/__init__.py", line 30, in <module>
    from .iio_swig import *
  File "/usr/local/lib/python3/dist-packages/iio/iio_swig.py", line 13, in <module>
    from . import _iio_swig
ImportError: /usr/local/lib/x86_64-linux-gnu/libgnuradio-iio.so...: undefined symbol: _ZN5boost6chrono12steady_clock3nowEv

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ivan/Documents/tools/analog_devices/gr-iio/iio-examples/top_block.py", line 34, in <module>
    import iio
  File "/usr/local/lib/python3/dist-packages/iio/__init__.py", line 36, in <module>
    from .iio_swig import *
  File "/usr/local/lib/python3/dist-packages/iio/iio_swig.py", line 13, in <module>
    from . import _iio_swig
ImportError: /usr/local/lib/x86_64-linux-gnu/libgnuradio-iio.so...: undefined symbol: _ZN5boost6chrono12steady_clock3nowEv

Symbol demangling:

ivan@lubuntu20vm:~$c++filt _ZN5boost6chrono12steady_clock3nowEv
boost::chrono::steady_clock::now()

Symbol in library:

ivan@lubuntu20vm:~$ nm /usr/local/lib/x86_64-linux-gnu/libgnuradio-iio.so.... | grep _ZN5boost6chrono12steady_clock3nowEv
                 U _ZN5boost6chrono12steady_clock3nowEv

I have compiled and installed library using AD wiki.

Does anybody know how to fix this issue? I would be really grateful for any help or tip.

ivanmikh commented 4 years ago

So the problem was that library was not linking against libboost_chrono

I was able to fix it by adding this to CMakeLists.txt:

add_definitions(-lboost_chrono)
add_definitions(-DBOOST_CHRONO_DYN_LINK)
add_definitions(-lboost_timer)
add_definitions(-DBOOST_TIMER_DYN_LINK)

And adding -lboost_chrono -lboost_timer flags to gr-iio/build/lib/CMakeFiles/gnuradio-iio.dir/link.txt.

This is just a temporary hack, what would be the right way to fix this issue?

adisuciu commented 4 years ago

Can you tell us what version of boost are you running and what version of gnuradio (and where you installed from ) ?

ivanmikh commented 4 years ago

I installed GNU Radio from Ubuntu repository using apt. My OS is Lubuntu 20.04 LTS (Focal Fossa).

GNU radio:

ii  gnuradio                                      3.8.1.0~rc1-2build2                 amd64        GNU Radio Software Radio Toolkit
ii  gnuradio-dev:amd64                            3.8.1.0~rc1-2build2                 amd64        GNU Software Defined Radio toolkit development

libbosst:

ii  libboost-all-dev                              1.71.0.0ubuntu2                     amd64        Boost C++ Libraries development files (ALL) (default version)
Doom4535 commented 4 years ago

I can confirm this issue using Ubuntu-20.04 and that @ivanmikh's solution works.

My Setup

Extended replication

Sources