Cross-compiled gr-limesdr

Hello, I have cross-compiled GNU Radio 3.7, LimeSuite and gr-limesdr with PetaLinux 2020.2 SDK in order for them to work on ARM.

The thing is that when I boot my PetaLinux, I can run the programs, so they are correctly cross-compiled, but I get ModuleNotFoundError. Is this a problem with PYTHONPATH and LD_LIBRARY_PATH?

Does anyone have experience with this? I hope someone can help me.

Thanks in advance.

Yes, it is likely a problem with one or both, but you do not tell which module is creating the “ModuleNotFoundError” error - so, it is impossible to tell what needs fixing.

My bad, I thought I had said which module produced the error.
The worst of all is that it is gnuradio itself.

You should be getting an error something like -

Traceback (most recent call last):
File “/Users/dir/Desktop/rfspace/osmo_nfm_rx.py”, line 37, in
import extras
ModuleNotFoundError: No module named ‘extras’

from gnuradio-companion - what does it say - list it - the No module named ‘extras’ is the important part ?

It seems my error is about the path, because if I do
#cd /usr/local/lib/python2.7/dist-packages/
#python
#>>> import gnuradio

It works. But I already set the PYTHONPATH to that folder.

If you have set the path - it should work, but it appears that you are running as the superuser. The superuser and pi have different environments. Do a “printenv” to see if you have PYTHONPATH set in the environment that you are using.

That may be it. My PetaLinux only has superuser mode.
If I add sudo to my image, will I be able to run it as a normal user? I will try it anyways.
Thanks for your answer, I will try to run the printenv and see what I get.

Hello, I need gr-limesdr for gnuradio.
I managed to cross-compile the master branch but I need the gr-3.8 branch, which is giving me problems.
I do the cmake and get this:

–The CXX compiler identification is GNU 9.2.0
– The C compiler identification is GNU 9.2.0
– Check for working CXX compiler: /opt/pkg/sdk/sysroots/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-g++
– Check for working CXX compiler: /opt/pkg/sdk/sysroots/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Check for working C compiler: /opt/pkg/sdk/sysroots/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-gcc
– Check for working C compiler: /opt/pkg/sdk/sysroots/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Build type not specified: defaulting to release.
– Found LOG4CPP: /opt/pkg/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib/liblog4cpp.so
– Found PkgConfig: /opt/pkg/sdk/sysroots/x86_64-petalinux-linux/usr/bin/pkg-config (found version “0.29.2”)
– Checking for module ‘gmp’
– No package ‘gmp’ found
– Found GMP: /opt/pkg/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib/libgmpxx.so
– Checking for module ‘mpir >= 3.0’
– No package ‘mpir’ found
– Could NOT find MPIR (missing: MPIRXX_LIBRARY MPIR_LIBRARY MPIR_INCLUDE_DIR)
– Found MPLIB: /opt/pkg/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib/libgmpxx.so
– Found Boost: /opt/pkg/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version “1.71.0”, minimum required is “1.71.0”) found components: date_time program_options filesystem system regex thread
– Found VOLK: Volk::volk
– User set python executable /opt/pkg/test/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/gnuradio/3.8.2.0-r0/recipe-sysroot-native/usr/bin/python3-native/python3
– Found PythonInterp: /opt/pkg/test/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/gnuradio/3.8.2.0-r0/recipe-sysroot-native/usr/bin/python3-native/python3
– Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version “.”)
– Found Git: /usr/bin/git
– Extracting version information from git describe…
– Configuring LimeSuite C++ Libraries…
– Checking for module ‘LimeSuite’
– No package ‘LimeSuite’ found
– Found LimeSuite: /usr/local/include/lime/, /usr/local/lib/libLimeSuite.so
– Found Doxygen: /usr/bin/doxygen (found version “1.8.13”) found components: doxygen missing components: dot
– Using install prefix: /usr/local
– Building for version: 3.1.5.0 / 3.1.5
– No C++ unit tests… skipping
– Checking for module SWIG
– Found SWIG version 3.0.12.
– Found SWIG: /opt/pkg/sdk/sysroots/x86_64-petalinux-linux/usr/bin/swig2.0
– Found PythonLibs: /opt/pkg/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib/libpython3.7m.so (found version “3.7.6”)
– Configuring done
– Generating done
– Build files have been written to: /home/rodrirq/gr-limesdr/build

But when I do make:

[ 8%] Building CXX object swig/CMakeFiles/_limesdr_swig_doc_tag.dir/_limesdr_swig_doc_tag.cpp.o
[ 16%] Generating documentation with doxygen
[ 33%] Building CXX object lib/CMakeFiles/gnuradio-limesdr.dir/source_impl.cc.o
[ 33%] Building CXX object lib/CMakeFiles/gnuradio-limesdr.dir/sink_impl.cc.o
[ 41%] Building CXX object lib/CMakeFiles/gnuradio-limesdr.dir/device_handler.cc.o
In file included from /home/rodrirq/gr-limesdr/lib/sink_impl.h:24,
from /home/rodrirq/gr-limesdr/lib/sink_impl.cc:25:
/home/rodrirq/gr-limesdr/lib/device_handler.h:24:10: fatal error: LimeSuite.h: No such file or directory
24 | #include <LimeSuite.h>
| ^~~~~~~~~~~~~
compilation terminated.

Any idea? i tried copying LimeSuite.h into the folder, but it didn’t work.
This is my toolchain:

set( CMAKE_SYSTEM_NAME Linux )
#set( CMAKE_C_COMPILER $ENV{CC} )
#set( CMAKE_CXX_COMPILER $ENV{CXX} )
string(REGEX MATCH “sysroots/([a-zA-Z0-9]+)” CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT})
string(REGEX REPLACE “sysroots/” “” CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING “” FORCE )
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING “” FORCE ) #same flags for C sources
set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING “” FORCE ) #same flags for C sources
set( CMAKE_LIBRARY_PATH ${OECORE_TARGET_SYSROOT}/usr/lib )
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( LIMESUITE_INCLUDE_DIRS /usr/local/include/lime/ )
set( LIMESUITE_LIB /usr/local/lib/libLimeSuite.so )

Hello, I have managed to cross-compile the master branch, but I need the gr-3.8 and I get errors.
Why is it different the way to find LimeSuite in each branch? I get this error even when I set the path:

– Found Git: /usr/bin/git
– Extracting version information from git describe…
CMake Error at CMakeLists.txt:116 (find_package):
By not providing “FindLimeSuite.cmake” in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
“LimeSuite”, but CMake did not find one.

Could not find a package configuration file provided by “LimeSuite” with
any of the following names:

LimeSuiteConfig.cmake
limesuite-config.cmake

Add the installation prefix of “LimeSuite” to CMAKE_PREFIX_PATH or set
“LimeSuite_DIR” to a directory containing one of the above files. If
“LimeSuite” provides a separate development package or SDK, be sure it has
been installed.

@rodrirq please stop creating lots of new posts that are all related to compiling gr-limesdr, this is really unhelpful and means that people are less likely to reply. I have moved all your existing posts to this original topic.

Is there a way to close issues?
Sorry for the 3 posts regarding the same question, but as people didn’t answer the previous one I thought it was better to create a new one instead of replying in the same post.
I won’t do it again.

This is a forum and these are forum posts, rather than issues, but I think you can mark/request to delete a post you made. In any case, I’ve moved your posts here and deleted the existing ones.

No, I’m afraid this is just really annoying. With topics such as cross-compilation you may get someone respond if they have come across the issue before or otherwise recognise the problem, but such issues can be a bit more obscure given all the software out there multiplied by all the environments you might want to cross-compile for. Hence this is one of the often less easy topics for someone to respond to.

I’d also suggest that, as I previously noted, such things are often more a matter of general cross-compilation and related issues, rather than specific to some piece of software. Hence there may be other forums where you would stand a far better chance of getting support. E.g. for cross tools, embedded development and Xilinx etc.

Thanks for understanding :slight_smile:

I managed to make gr-limesdr find LimeSuite. It says LimeSuite version is 20.10.0-g1480bfea.
But then when I do make I get the following output:

rodrirq@rodrirq-ubuntu:~/gr-limesdr/build$ make -j4
Scanning dependencies of target _limesdr_swig_doc_tag
Scanning dependencies of target doxygen_target
Scanning dependencies of target gnuradio-limesdr
[ 8%] Generating documentation with doxygen
[ 16%] Building CXX object swig/CMakeFiles/_limesdr_swig_doc_tag.dir/_limesdr_swig_doc_tag.cpp.o
[ 25%] Linking CXX executable _limesdr_swig_doc_tag
[ 25%] Built target _limesdr_swig_doc_tag
Scanning dependencies of target limesdr_swig_swig_doc
[ 33%] Generating doxygen xml for limesdr_swig_doc docs
[ 50%] Building CXX object lib/CMakeFiles/gnuradio-limesdr.dir/source_impl.cc.o
[ 50%] Building CXX object lib/CMakeFiles/gnuradio-limesdr.dir/device_handler.cc.o
[ 58%] Generating python docstrings for limesdr_swig_doc
/bin/sh: /opt/pkg/test/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/gnuradio/3.8.2.0-r0/recipe-sysroot-native/usr/bin/python3-native/python3: No such file or directory
swig/CMakeFiles/limesdr_swig_swig_doc.dir/build.make:60: recipe for target ‘swig/limesdr_swig_doc.i’ failed
make[2]: *** [swig/limesdr_swig_doc.i] Error 127
CMakeFiles/Makefile2:287: recipe for target ‘swig/CMakeFiles/limesdr_swig_swig_doc.dir/all’ failed
make[1]: *** [swig/CMakeFiles/limesdr_swig_swig_doc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…

Any idea?

I says that you do not have “python3” installed at /opt/pkg/test/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/gnuradio/3.8.2.0-r0/recipe-sysroot-native/usr/bin/python3-native/python3 which is a strange place to look for it - unless you are using a virtualenv - perhaps you build a virtualenv using python2 not python3 and it needs python3.

Hello, I am using PetaLinux 2020.2. It is true that when I boot it on my Zynq, if I do:
$ python3
It seems I don’t have it installed.
I will look at my rootfs to see if I have the libraries that I need.
Thank you!

How much memory and what kind of CPU(s) are in that board ?
(cat /proc/meminfo /proc/cpuinfo ; uname -a ; getconf LONG_BIT )

Because if it has so little processing power that you need to cross-compile for the board, that would be ringing alarm bells for me.

Typically when people run gnuradio it is for design, and then once they have worked out what they need and what works well they would strip away everything else and just implement exactly what is needed with optimised code that use the minimum amount of memory and the minimum amount processing power. Trying to install, what I would have considered, a design tool on, what I would have considered, an embedded platform just seems odd to me. Me personally I would be looking at implementing finished algorithms using something like liquidsdr’s Liquid-DSP. Or if the processing was basic enough I’d even consider using only a command line tool like csdr.

You appear to be going far off the beaten path, making your own untraveled path through thick jungle slowly hacking away with a machete, instead of sticking to the well travelled highways. Well at least by the end of it, if you stick at it, you will learn a lot about PetaLinux.

1 Like

Hello, thank you so much for your reply. With answers like this it is easier to find different ways to reach my objective.

My idea was to create a GNU Radio flowgraph from my computer, and run it on the Zybo Z7-10. That’s the reason why I added meta-sdr to my PetaLinux image. I wanted to cross-compile gr-limesdr because it enables the LimeSuite blocks, which I would use to work with the LimeSDR-Mini.

The final objective is to encode a message, and send it with the LimeSDR to another one that will decode the message.

I don’t know if with Liquid-DSP I could do that, I have to look at it. I don’t have the board with me, so I won’t be able to tell you the info you asked for until Monday. I will let you know by then, thanks again.

gnuradio-companion is a real resource hog - some systems can only handle simple flowgraphs that do not require a lot of resources - your Zybo Z7-10 may be in that class.

If “The final objective is to encode a message, and send it with the LimeSDR to another one that will decode the message.”, the LimeSuite has a simple example of a transmitter -

/LimeSuite-20.10.0/src/examples/basicTX.cpp

You do not need GNU Radio to encode and send a message. LiquidSDR has all routines need to generate the AM, FM, SSB signals required by the transmitter.

3 Likes

Hello @mzs,

Here is the output you asked for:

Hello @RightHalfPlane,

Thanks for your answer. I used basicTX.cpp a few weeks ago to see if I could see the transmission with an airspy. But I have seen the code and I don’t get how you can add a file, for example a photo, and how to encode the message. If it was possible to do it with this, the receiver would have to use the basicRX.cpp?