Build fails with `/usr/bin/ld ... undefined reference to 'srsran_rf_recv_with_time_multi'`
Closed this issue · 3 comments
Received "undefined reference" error for srsran_rf_recv_with_time_multi
.
After discovering potential bug in gcc-12, I downgraded to use of gcc-11. This allowed the build process to run until it reached 100% and ran /usr/bin/ld
, then caught the "undefined reference" error and full stop.
[100%] Linking CXX executable LTESniffer
/usr/bin/ld: src/libDL_Sniffer_lib.a(LTESniffer_Core.cc.o): in function `srsran_rf_recv_wrapper(void*, float _Complex**, unsigned int, srsran_timestamp_t*)':
/LTESniffer/src/src/LTESniffer_Core.cc:726:(.text+0x1675): undefined reference to `srsran_rf_recv_with_time_multi'
/usr/bin/ld: src/libDL_Sniffer_lib.a(LTESniffer_Core.cc.o): in function `UhdStreamThread::get_data_stream_a()':
/LTESniffer/src/src/LTESniffer_Core.cc:897:(.text+0x17bd): undefined reference to `srsran_rf_recv_with_time_multi'
/usr/bin/ld: /LTESniffer/src/src/LTESniffer_Core.cc:906:(.text+0x1801): undefined reference to `srsran_rf_close'
/usr/bin/ld: src/libDL_Sniffer_lib.a(LTESniffer_Core.cc.o): in function `UhdStreamThread::get_data_stream_b()':
/LTESniffer/src/src/LTESniffer_Core.cc:917:(.text+0x1ac5): undefined reference to `srsran_rf_recv_with_time_multi'
/usr/bin/ld: /LTESniffer/src/src/LTESniffer_Core.cc:926:(.text+0x1b15): undefined reference to `srsran_rf_close'
/usr/bin/ld: src/libDL_Sniffer_lib.a(LTESniffer_Core.cc.o): in function `srsran_rf_recv_multi_usrp_wrapper(void*, void*, float _Complex**, float _Complex**, unsigned int, srsran_timestamp_t*)':
/LTESniffer/src/src/LTESniffer_Core.cc:805:(.text+0x213b): undefined reference to `srsran_rf_recv_with_time_multi'
/usr/bin/ld: /LTESniffer/src/src/LTESniffer_Core.cc:821:(.text+0x22fb): undefined reference to `srsran_rf_recv_with_time_multi'
/usr/bin/ld: /LTESniffer/src/src/LTESniffer_Core.cc:823:(.text+0x2321): undefined reference to `srsran_rf_recv_with_time_multi'
/usr/bin/ld: /LTESniffer/src/src/LTESniffer_Core.cc:808:(.text+0x2446): undefined reference to `srsran_rf_recv_with_time_multi'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/LTESniffer.dir/build.make:120: src/LTESniffer] Error 1
make[2]: Target 'src/CMakeFiles/LTESniffer.dir/build' not remade because of errors.
make[1]: *** [CMakeFiles/Makefile2:9828: src/CMakeFiles/LTESniffer.dir/all] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:156: all] Error 2
make: Target 'default_target' not remade because of errors.
The reference occurs on the following lines:
726: return srsran_rf_recv_with_time_multi((srsran_rf_t*)h, ptr, nsamples, true, NULL, NULL);
805: srsran_rf_recv_with_time_multi((srsran_rf_t*)rf_b, dummy_ptr, nof_offset_sample, true, NULL, NULL);
808: srsran_rf_recv_with_time_multi((srsran_rf_t*)rf_a, dummy_ptr, nof_offset_sample, true, NULL, NULL);
821: srsran_rf_recv_with_time_multi((srsran_rf_t*)rf_b, dummy_ptr, nsamples, true, NULL, NULL);
823: srsran_rf_recv_with_time_multi((srsran_rf_t*)rf_a, dummy_ptr, nsamples, true, NULL, NULL);
897: srsran_rf_recv_with_time_multi((srsran_rf_t*)rf_a, ptr_a, nof_sample_a, true, &secs_a, &frac_secs_a);
917: srsran_rf_recv_with_time_multi((srsran_rf_t*)rf_b, ptr_b, nof_sample_b, true, &secs_b, &frac_secs_b);
Performed on new box, with a fresh install, a fresh clone, and new radios.
Building branch: LTESniffer-multi-usrp
Distrobution: Ubuntu-Server Noble (Fresh Install on Fresh Box)
Try the release archive instead of cloning from HEAD
I am so used to cloning directly from HEAD, I don't even consider downloading the recent release archive. Something that should be tried.
The release does not include the multi-device fork.
Attempt implementation in Author's private repo.
Performed a Github repository search for the undefined reference "srsran_rf_recv_with_time_multi", which lead me to the author's personal repository of the multi-device implementation of LTESniffer. Noticed the repository appeared to be structured a little differently, and decided to give it a try.
It built like butter, but there was a kicker. The repository might include files that contain a subset of functions from the official repository used for testing purposes, but the file "LTESniffer_core.cc" is not present, and the strings rf_a_string
and rf_b_string
are not within any of the files in this repository. Both the file and those strings are used to designate the two devices for use with the sniffer, and without them, LTESniffer will not know which device to use for which.
So this repository looks to have been created for purely testing purposes.
Solution: Build UHD from source, rather than use Ubuntu's UHD-host package.
After reviewing previous notes for implementing LTESniffer on a docker image, it was discovered building UHD from source is not an option, it is a requirement. Also, a few optional libraries were installed. Building UHD from source and adding the path manually to the system libraries really is what made the difference. Once performed, LTESniffer built perfectly.
So to summarize:
- Assuming you are running Ubuntu Noble.
- Follow this guide
- Make sure you perform post-installation chores
- Install optional libraries:
sudo apt install libfftw3-dev libmbedtls-dev libboost-program-options-dev libconfig++-dev libsctp-dev
- Clone the repo:
git clone https://github.com/SysSec-KAIST/LTESniffer.git
- Change Directory into the repository:
cd LTESniffer
- Change to multi device branch:
git checkout LTESniffer-multi-usrp
- Make the build directory and change directory into it:
mkdir -p build && cd $_
- Set gcc and g++ to the required versions:
export CC=/usr/bin/gcc-11 && export CXX=/usr/bin/g++-11
- Then build baby, build!
cmake ../ && make -j4
This is how I achieved a successful build.