|
GNU Radio 3.8与UHD-3.15.LTS对Boost版本的要求
-- Using install prefix: /usr/local
-- Building for version: v3.8.5.0-6-g57bd109d / 3.8.5git
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jiang/c_c++_works/gnuradio/build
编译GNU Radio 3.8:
cmake ..(默认是开启UHD的啊) 发现本机的: cmake -DENABLE_GR_UHD=OFF ..
-- Found Boost: /usr/local/include (found suitable version "1.69.0", minimum required is "1.53") found components: date_time program_options filesystem system regex thread unit_test_framework chrono atomic 这是可以的啊
make -j8
后报错:
[ 40%] Linking CXX executable tags_demo
/usr/bin/ld: warning: libboost_regex.so.1.65.1, needed by /usr/lib/libuhd.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libboost_serialization.so.1.65.1, needed by /usr/lib/libuhd.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libboost_thread.so.1.65.1, needed by /usr/lib/libuhd.so, may conflict with libboost_thread.so.1.69.0
/usr/lib/libuhd.so:对‘boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)’未定义的引用
原因是: 本机的boost版本是1.69.0 但是libuhd(UHD-3.15.LTS)要求Minimum Version: 1.65啊 为何一定要1.65.1呢?
之前改过版本了(源码编译的方式): http://www.ai111.vip/thread-1251-1-1.html
官方推荐的安装中: https://wiki.gnuradio.org/index.php/InstallingGR#From_Source
在Ubuntu 18.04系统上 sudo apt install libboost-all-dev 就是 1.65.1的版本
所以: 删掉源码编译安装的 改用apt方式安装 或者 还是源码编译的方式 但是换版本为 1.65.1
下载地址:https://boostorg.jfrog.io/ui/native/main/release/1.65.1/source/
先删(默认是安装在/usr/local下的 可以自己修改--prefix=/usr下):
源码编译安装的,这样删得干干净净
sudo rm -rf /usr/local/include/boost
sudo rm -rf /usr/local/lib/libboost*
sudo rm -rf /usr/local/lib/cmake/boost*
sudo rm -rf /usr/local/lib/cmake/Boost*
后安装:
tar -zxvf boost_1_65_1.tar.gz
cd boost_1_65_1/
运行bootstrap.sh脚本: ./bootstrap.sh
开始进行boost的编译: ./b2 toolset=gcc 可以变交叉编译工具链
安装指令: sudo ./b2 install
马上使用: sudo ldconfig
注意没有这样的删除指令: sudo ./b2 uninstall
报错:
CMakeFiles/main.dir/01_01.cpp.o:在函数‘__static_initialization_and_destruction_0(int, int)’中:
01_01.cpp.text+0x3e2):对‘boost::system::generic_category()’未定义的引用
01_01.cpp.text+0x3ee):对‘boost::system::generic_category()’未定义的引用
01_01.cpp.text+0x3fa):对‘boost::system::system_category()’未定义的引用
解决:
# Found Boost: /usr/local/include (found version "1.65.1")
cmake工程下引入boost库的时候,提示 “对‘boost::system::generic_category()’未定义的引用”,在网上找了很久的解决方案,大多建议是说要加入-lboost-system编译链接选项,这对于cmake构建的工程项目是不必的。如果你用的是cmake,你只需要添加一句命令:
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
换了版本后,编译GNU Radio 3.8就没问题了:
cmake ..
make -j8
sudo make install
sudo ldconfig
|
|