kit-cel / gr-lte

GNU Radio LTE receiver
GNU General Public License v3.0
394 stars 149 forks source link

Unable to cross-compile for Ettus E310 using OE SDK #38

Closed sonium-labs closed 3 years ago

sonium-labs commented 3 years ago

Hello,

I have been struggling with getting gr-lte cross-compiled for the Ettus E310 using the Open Enclave SDK.

I have been following these instructions from the Ettus wiki that delineate how to get UHD, GR, and OOT modules compiled for a host machine, and how to cross-compile them for ARM/E3xx devices. I have followed the instructions verbatim--am using the release 4 version of the SDK, UHD version 3.14.1, version 3.7.14 of GNU Radio, and am compiling on Ubuntu 18.04 LTS. I also have my environment variables setup as described in that guide. When I attempt to compile gr-lte with the SDK, using the cmake commands described in the guide above for gr-ettus as well as these, it works just fine. Then when I run make, I receive the following errors (running make as verbose for add'l debug info):

/home/ddm/rfnoc/oe/sysroots/x86_64-oesdk-linux/usr/bin/cmake -H/home/ddm/rfnoc/src/gr-lte -B/home/ddm/rfnoc/src/gr-lte/build-arm --check-build-system CMakeFiles/Makefile.cmake 0
/home/ddm/rfnoc/oe/sysroots/x86_64-oesdk-linux/usr/bin/cmake -E cmake_progress_start /home/ddm/rfnoc/src/gr-lte/build-arm/CMakeFiles /home/ddm/rfnoc/src/gr-lte/build-arm/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/ddm/rfnoc/src/gr-lte/build-arm'
make -f lib/CMakeFiles/gnuradio-lte.dir/build.make lib/CMakeFiles/gnuradio-lte.dir/depend
make[2]: Entering directory '/home/ddm/rfnoc/src/gr-lte/build-arm'
cd /home/ddm/rfnoc/src/gr-lte/build-arm && /home/ddm/rfnoc/oe/sysroots/x86_64-oesdk-linux/usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/ddm/rfnoc/src/gr-lte /home/ddm/rfnoc/src/gr-lte/lib /home/ddm/rfnoc/src/gr-lte/build-arm /home/ddm/rfnoc/src/gr-lte/build-arm/lib /home/ddm/rfnoc/src/gr-lte/build-arm/lib/CMakeFiles/gnuradio-lte.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/ddm/rfnoc/src/gr-lte/build-arm'
make -f lib/CMakeFiles/gnuradio-lte.dir/build.make lib/CMakeFiles/gnuradio-lte.dir/build
make[2]: Entering directory '/home/ddm/rfnoc/src/gr-lte/build-arm'
/home/ddm/rfnoc/oe/sysroots/x86_64-oesdk-linux/usr/bin/cmake -E cmake_progress_report /home/ddm/rfnoc/src/gr-lte/build-arm/CMakeFiles 4
[  2%] Building CXX object lib/CMakeFiles/gnuradio-lte.dir/crc_check_vbvb_impl.cc.o
cd /home/ddm/rfnoc/src/gr-lte/build-arm/lib && /home/ddm/rfnoc/oe/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++   -march=armv7-a -mfloat-abi=hard -mfpu=neon --sysroot=/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi  -Dgnuradio_lte_EXPORTS -O2 -pipe -g -feliminate-unused-debug-types -O3 -DNDEBUG -fPIC -I/home/ddm/rfnoc/src/gr-lte/lib -I/home/ddm/rfnoc/src/gr-lte/include -I/home/ddm/rfnoc/src/gr-lte/build-arm/lib -I/home/ddm/rfnoc/src/gr-lte/build-arm/include -I/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/include    -fvisibility=hidden -o CMakeFiles/gnuradio-lte.dir/crc_check_vbvb_impl.cc.o -c /home/ddm/rfnoc/src/gr-lte/lib/crc_check_vbvb_impl.cc
/home/ddm/rfnoc/src/gr-lte/lib/crc_check_vbvb_impl.cc: In member function 'virtual int gr::lte::crc_check_vbvb_impl::work(int, gr_vector_const_void_star&, gr_vector_void_star&)':
/home/ddm/rfnoc/src/gr-lte/lib/crc_check_vbvb_impl.cc:90:12: error: expected primary-expression before 'char'
   __GR_VLA(char, bytes, d_data_len / 8);
            ^
/home/ddm/rfnoc/src/gr-lte/lib/crc_check_vbvb_impl.cc:90:18: error: 'bytes' was not declared in this scope
   __GR_VLA(char, bytes, d_data_len / 8);
                  ^
/home/ddm/rfnoc/src/gr-lte/lib/crc_check_vbvb_impl.cc:90:39: error: '__GR_VLA' was not declared in this scope
   __GR_VLA(char, bytes, d_data_len / 8);
                                       ^
lib/CMakeFiles/gnuradio-lte.dir/build.make:77: recipe for target 'lib/CMakeFiles/gnuradio-lte.dir/crc_check_vbvb_impl.cc.o' failed
make[2]: *** [lib/CMakeFiles/gnuradio-lte.dir/crc_check_vbvb_impl.cc.o] Error 1
make[2]: Leaving directory '/home/ddm/rfnoc/src/gr-lte/build-arm'
CMakeFiles/Makefile2:123: recipe for target 'lib/CMakeFiles/gnuradio-lte.dir/all' failed
make[1]: *** [lib/CMakeFiles/gnuradio-lte.dir/all] Error 2
make[1]: Leaving directory '/home/ddm/rfnoc/src/gr-lte/build-arm'
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2

Doing some digging online, I discovered that __GR_VLA is defined in attributes.h. I find that file in the following places:

/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/src/debug/libxslt/1.1.28-r0/libxslt-1.1.28/libxslt/attributes.h
/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/src/debug/attr/2.4.47-r0/attr-2.4.47/include/attr/attributes.h
/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/include/libxslt/attributes.h
/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/include/attr/attributes.h
/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/include/gnuradio/attributes.h
/home/ddm/rfnoc/src/gnuradio/gnuradio-runtime/include/gnuradio/attributes.h

In the file that fails compilation, crc_check_vbvb_impl.cc, I see an include for <gnuradio/io_signature.h>. I thought tracking this down might help me squash this bug as I have not seen an error indicating that the linker cannot find this file, and it is in the following places:

/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/src/debug/gnuradio/3.7.9-r0/git/gnuradio-runtime/include/gnuradio/io_signature.h
/home/ddm/rfnoc/oe/sysroots/armv7ahf-vfp-neon-oe-linux-gnueabi/usr/include/gnuradio/io_signature.h
/home/ddm/rfnoc/src/gnuradio/gnuradio-runtime/include/gnuradio/io_signature.h

Seems that both files are found in some of the same places, most notably in the gnuradio directory. I've tried to explicitly include <gnuradio/attributes.h> in the source files that throw errors (it isn't just the one above), to no effect.

What could I be missing here?

sonium-labs commented 3 years ago

Hello, wanted to provide an update on this. I was able to successfully cross-compile after removing UHD/GNU Radio/gr-lte and recompiling everything with this guide. I wager the issue had to do with the multiple installations of UHD/GNU Radio I had on my system when attempting to cross-compile.

Worth noting that the CMake command run for GNU Radio removes ControlPort as it caused issues with the version of CMake included with the OE SDK. The command used was: cmake -Wno-dev -DCMAKE_TOOLCHAIN_FILE=~/rfnoc/src/gnuradio/cmake/Toolchains/oe-sdk_cross.cmake -DENABLE_GR_WXGUI=OFF -DENABLE_GR_VOCODER=OFF -DENABLE_GR_DTV=OFF -DENABLE_GR_ATSC=OFF -DENABLE_DOXYGEN=OFF -DENABLE_GR_CTRLPORT=OFF -DCMAKE_INSTALL_PREFIX=/usr ../

Now I'm able to run the example flowgraphs included in the examples directory, though I have yet to properly verify that the flowgraphs work as expected--currently working on this. Closing this issue for now.