OAI 4G搭建(三): 编译遇到的问题

输入 sudo ./build_oai -I --eNB -x --install-system-files -w USRP报错

问题一: Connection timed out

问题描述如下:

Cloning into '/opt/ssh'...
fatal: unable to access 'https://gist.github.com/2190472.git/': Failed to connect to gist.github.com port 443: Connection timed out
build have failed

这主要是由于无法登陆外网的原因,需要修改build_helper文件, 换一下路径

sudo gedit ~/openairinterface5g/cmake_targets/tools/build_helper

搜索2190472, 找到

$sudo rm -fr /opt/ssh
$sudo git clone https://gist.github.com/2190472.git /opt/ssh

修改第二句为

$sudo git clone https://gitlab.eurecom.fr/oai/ssh.git /opt/ssh

搜索google, 找到

    rm -rf /tmp/protobuf-c
    git clone https://github.com/protobuf-c/protobuf-c.git
    cd protobuf-c

在下面插一句

git checkout 2a46af42784abf86804d536f6e0122d47cfeea45

问题二: 安装ASN1失败

问题描述如下:

Installing ASN1. The log file for ASN1 installation is here: /home/milkola/openairinterface5g/cmake_targets/log/asn1c_install_log.txt 
build have failed

安装ASN1失败, 查看日志文件发现错误原因

error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.

老问题了. 是网速问题, 我多尝试几次就通过了.
也可以自主安装, 但要注意版本号, OAI LTE使用的是版本0.9.22, 我在官网下载安装的是版本0.9.28, 之后编译不通过, 我非常怀疑是版本的问题.
自主安装版本0.9.28的步骤也在下面列出来了.
首先在http://lionet.info/asn1c/download.html下载 asn1c-0.9.28.tar.gz
解压文件

tar -zxvf asn1c-0.9.28.tar.gz

然后进入文件夹, 按照build_helper中的步骤,一步步安装

cd asn1c
autoreconf -iv
 ./configure
make -j`nproc`
sudo make install
cd -
sudo ldconfig

最后在OAI文件build_helper中注释掉install_asn1c_from_source $1

sudo gedit ~/openairinterface5g/cmake_targets/tools/build_helper

自主安装USRP驱动-uhd

虽然参数-I可以安装USRP, 但我查资料的时候找到一个自主安装的方法, 为了学习还是也放在这里吧.

sudo add-apt-repository ppa:ettusresearch/uhd
sudo apt-get update
sudo apt-get install libuhd-dev libuhd003 uhd-host

安装完成之后,USRP插上电源和USB线,运行uhd_find_devices查看是否有信息.
如无上述信息,可根据提示运行uhd_images_downloader.py下载USRP板子镜像.

python /usr/lib/uhd/utils/uhd_images_downloader.py

可能需要安装一些模块,如six和requests, 根据提示运行

pip install six
pip install requests

这里我还遇到一个问题, 提示更新pip版本, 我更新了, 结果造成pip和python版本不匹配, 无法使用pip. 问题描述如下:

    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

我真是手贱啊, 不更新嘛事没有. 最后解决办法是删掉了~/.local/lib/python2.7/site-packages文件夹下的两个pip文件, 我这里是pip和pip-21.0.dist-info, 之后就能正常使用pip啦.
最后查看一下USRP信息

uhd_find_devices

显示如下:

[INFO] [UHD] linux; GNU C++ version 5.4.0 20160609; Boost_105800; UHD_3.15.0.0-release
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
    serial: 30FB59C
    name: MyB210
    product: B210
    type: b200

问题三: 编译CMake Error

编译过程中出现了几个错误,描述如下:

CMake Error at /home/milkola/openairinterface5g/cmake_targets/CMakeLists.txt:639 (message):
  asn1c: error
Call Stack (most recent call first):
  CMakeLists.txt:19 (include)


-- Configuring incomplete, errors occurred!

CMake Error: Cannot determine link language for target "F1AP_LIB".
CMake Error: CMake can not determine linker language for target: F1AP_LIB
You have called ADD_LIBRARY for library F1AP without any source files. This typically indicates a problem with your CMakeLists.txt file
...
CMake Error: Cannot determine link language for target "F1AP".
CMake Error: CMake can not determine linker language for target: F1AP

查看/openairinterface5g/cmake_targets/CMakeLists.txt , 发现FIAP部分似乎有错误, 我改成了下面的样子, 问题解决:

# F1AP
##############
add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15)
set(F1AP_DIR ${OPENAIR2_DIR}/F1AP)
if (${F1AP_RELEASE} STREQUAL "R15")
  make_version(F1AP_VERSION 15 2 1)
  set (ASN1RELDIR R15.2.1)
endif(${F1AP_RELEASE} STREQUAL "R15")
add_definitions(-DF1AP_VERSION=${F1AP_VERSION})
set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(F1AP_ASN_FILES
  ${F1AP_ASN_DIR}/F1AP-CommonDataTypes.asn
  ${F1AP_ASN_DIR}/F1AP-Constants.asn
  ${F1AP_ASN_DIR}/F1AP-PDU-Descriptions.asn
  ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn
  ${F1AP_ASN_DIR}/F1AP-IEs.asn
  ${F1AP_ASN_DIR}/F1AP-Containers.asn
  )

set(F1AP_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_C_DIR} ${F1AP_ASN_FILES}")
execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${F1AP_C_DIR}" "${F1AP_ASN_DIR}/${F1AP_ASN_FILES}" "F1AP_" -fno-include-deps
                RESULT_VARIABLE ret
                OUTPUT_QUIET
                ERROR_QUIET)

if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "asn1c: error")
endif (NOT ${ret} STREQUAL 0)

file(GLOB F1AP_source ${F1AP_C_DIR}/*.c)

add_library(F1AP_LIB
  ${F1AP_source}
  ${F1AP_DIR}/f1ap_common.c
)

include_directories ("${F1AP_C_DIR}")
include_directories ("${F1AP_DIR}")

add_library(F1AP
  ${F1AP_DIR}/f1ap_du_paging.c
  ${F1AP_DIR}/f1ap_cu_interface_management.c
  ${F1AP_DIR}/f1ap_du_rrc_message_transfer.c
  ${F1AP_DIR}/f1ap_cu_paging.c
  ${F1AP_DIR}/f1ap_du_system_information.c
  ${F1AP_DIR}/f1ap_cu_rrc_message_transfer.c
  ${F1AP_DIR}/f1ap_du_task.c
  ${F1AP_DIR}/f1ap_cu_system_information.c
  ${F1AP_DIR}/f1ap_du_ue_context_management.c
  ${F1AP_DIR}/f1ap_cu_task.c
  ${F1AP_DIR}/f1ap_du_warning_message_transmission.c
  ${F1AP_DIR}/f1ap_cu_ue_context_management.c
  ${F1AP_DIR}/f1ap_du_interface_management.c
  ${F1AP_DIR}/f1ap_encoder.c
  ${F1AP_DIR}/f1ap_decoder.c
  ${F1AP_DIR}/f1ap_cu_warning_message_transmission.c
  ${F1AP_DIR}/f1ap_itti_messaging.c
  ${F1AP_DIR}/f1ap_messaging.c
)

问题四: 找不到头文件

问题描述如下:

Log file for compilation has been written to: /home/milkola/openairinterface5g/cmake_targets/log/lte-softmodem.Rel14.txt
lte-softmodem compilation failed

查看日志文件, 描述如下:

/platform_constants.h:31:30: fatal error: LTE_asn_constant.h: No such file or directory
compilation terminated.
CMakeFiles/PROTO_AGENT.dir/build.make:62: recipe for target 'CMakeFiles/PROTO_AGENT.dir/home/milkola/openairinterface5g/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c.o' failed
make[3]: *** [CMakeFiles/PROTO_AGENT.dir/home/milkola/openairinterface5g/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c.o] Error 1
CMakeFiles/Makefile2:357: recipe for target 'CMakeFiles/PROTO_AGENT.dir/all' failed
make[2]: *** [CMakeFiles/PROTO_AGENT.dir/all] Error 2

找不到 LTE_asn_constant.h文件, 进而导致编译失败. 我在整个系统上查找该文件的位置发现确实没有这个文件, 然后看OAI的README合理推测这个头文件应该是ASN1C编译生成的, 那现在没有这个文件应该就是ASN1C有问题, 解决办法我猜应该是卸载现有的ASN1C, 重新安装0.9.22版本, 但是我没有尝试, 因为我在另一台电脑上使用OAI分支v1.2.0编译, 只有问题一, 没有遇到问题二~问题四.

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值