树莓派Ubuntu18.04安装srsLTE

一、安装依赖项

环境:Ubuntu Server 18.04 for Raspberry 3(ARM64)

下载地址:Install Ubuntu Server on a Raspberry Pi 2, 3 or 4

sudo apt-get install libfftw3-dev libmbedtls-dev libconfig++-dev libsctp-dev
# 如果你之前安装过高版本boost,那么下面这句不需要执行
sudo apt-get install libboost-program-options-dev

二、源码编译安装srsLTE

git clone https://github.com/srsLTE/srsLTE.git
cd srsLTE
# 选18_12的原因是ubuntu16.04的boost库版本过低,测试到最后只适配release_18_12
git tag -l
git checkout -f release_18_12
mkdir build
cd build
cmake ../ 
# 如果要指定boost版本,指定高版本后可以安装高版本srslte。注意修改了boost后,
# uhd可能也需要重新编译。
#cmake ../ -DBOOST_ROOT=/usr/local/boost -DBoost_NO_SYSTEM_PATHS=ON
make -j3
make test -j3
sudo make install
sudo ldconfig
# 拷贝srsLTE的配置文件到`~/.config/srslte`, 这一步最好执行,因为不是master版本
# 有很多参数是无效的,配置文件里的内容在不同的版本里是不一样的。
sudo srslte_install_configs.sh user

三、ppa安装srsLTE

sudo add-apt-repository ppa:srslte/releases
sudo apt-get update
sudo apt-get install srslte -y

出错:

暂未找到解决方法…

四、源码编译安装srsGUI

sudo apt-get install libboost-system-dev libboost-test-dev libboost-thread-dev libqwt-dev libqt4-dev
git clone https://github.com/srsLTE/srsGUI.git
cd srsGUI
mkdir build && cd build
cmake ../
make -j3
sudo make install
sudo ldconfig

五、出错及解决方法汇总

1.使用源码编译安装srsLTE,git checkout release_18_12出错:

error: Your local changes to the following files would be overwritten by checkout:

解决方法:加-f参数强制切换:

sudo git checkout -f release_18_12

2.使用源码编译安装srsLTE,make时出错:

-mfloat-abi=hard, -mfpu=neon

c++: error: unrecognized command line option ‘-mfloat-abi=hard’
c++: error: unrecognized command line option ‘-mfpu=neon’

ARM编译器文档中得知:

The -mfloat-abi option is not valid with ARMv8 AArch64 targets. AArch64 targets use hardware floating-point instructions and hardware floating-point linkage. However, you can prevent the use of floating-point instructions or floating-point registers for AArch64 targets with the -mcpu=+nofp+nosimdname option. Subsequent use of floating-point data types in this mode is unsupported.

待解决…

2020.07.21新增内容↓

编译问题先查CMakeLists.txtMakefile,查询后发现Makefile里没有“neon”而CMakeLists.txt里有,因此打开CMakeLists.txt文件定位neon,nano编辑器里的查找快捷键为Ctrl+W,可以记为Whereis。

最初查找信息说要根据ARM编译器文档里的-mcpu-mfloat-abi-mfpu介绍来修改出错的参数,尝试了-mcpu=+nofp+nosimd cortex-a53-mfpu=neon-fp-armv8-mfloat-abi=soft等设置后,编译依然出错,然后尝试删掉这两个参数,结果就通过了。

/home/Downloads/srsLTE/CMakeLists.txt文件里的

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DIS_ARM -DHAVE_NEON -mfloat-abi=hard -mfpu=neon")

改为(删去后两个参数):

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DIS_ARM -DHAVE_NEON ")

HWCAP_NEON

根据上面第一步修改后原问题解决,出现新问题‘HWCAP_NEON’ was not declared in this scope

报错的是.o文件,.o文件是由去掉.o后的文件生成的,可能与.o文件不在同一目录,我们使用以下命令查找arch_select.cc文件所在位置:

find /home/Downloads/srsLTE -name arch_select.cc


/home/Downloads/srsLTE/lib/src/common/arch_select.cc文件里的

HWCAP_NENO改为HWCAP_AES


然后重新编译,虽然还有一些warning,但是没有error,顺利通过:

六、查找问题时使用到的一些命令

1.根据文件名查找文件所在目录

#     目录      参数         文件名
find /home -name arch_select.ccarch_select.cc

此外,find还可以用来查找过去x时间内被修改/读取过的文件:

find . -ctime -20  #将目前目录及其子目录下所有最近 20 天内更新过的文件列出

#-amin n : 在过去 n 分钟内被读取过
#-atime n : 在过去n天内被读取过的文件
#-cmin n : 在过去 n 分钟内被修改过
#-ctime n : 在过去n天内被修改过的文件
#-anewer file : 比文件 file 更晚被读取过的文件
#-cnewer file :比文件 file 更新的文件

find的更多用法可参考:Linux find命令

2.查找包含某段内容的文件

#     参数     内容          目录或文件
grep -r -l "cortex" /home/Downloads/srsLTE/

-r:表示在当前文件夹及其子目录中查找;
-l:只输出对应文件的包含路径的文件名,不加此参数还会输出包含该内容的整段信息。
还有一些常用参数:
-n:显示搜索文本在文件中的行数;
-i:忽略大小写问题;
-w :只显示全字符合的列;
更多参数请参考:Linux grep命令

出现grep: invalid max count错误,原因是某些字符需要添加转义字符\才能被正常识别。

猜你喜欢

转载自blog.csdn.net/L_786795853/article/details/107397309