CentOS Linux release 8.3.2011
Linux localhost.localdomain 4.18.0-240.22.1.el8_3.x86_64 #1 SMP Thu Apr 8 19:01:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Linux Switch 3.14.57_v1.0 #2 SMP Mon May 17 18:29:08 CST 2021 aarch64_be GNU/Linux
工具链下载地址:
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
下载:
gcc-arm-10.2-2020.11-x86_64-aarch64_be-none-linux-gnu.tar.xz
1.版本:2101
2.下载源码:
git clone https://gerrit.fd.io/r/vpp
3.check稳定发行版本:2101
git checkout -b stable/2101 origin/stable/2101
make install-dep
make install-ext-dep
工具链拷贝到开发机上面解压后,交叉编译 libuuid、openssl,并将结果生成到工具链的libc/usr目录:
交叉编译 libuuid:libuuid-1.0.3.tar.gz
CC="aarch64_be-none-linux-gnu-gcc" ./configure --host=x86_64 --prefix=/home/guoqixin/gcc-arm-10.2-2020.11-x86_64-aarch64_be-none-linux-gnu/aarch64_be-none-linux-gnu/libc/usr
交叉编译 openssl:openssl-OpenSSL_1_0_1e.tar.gz
CC="aarch64_be-none-linux-gnu-gcc" ./config no-asm shared --prefix=/home/guoqixin/gcc-arm-10.2-2020.11-x86_64-aarch64_be-none-linux-gnu/aarch64_be-none-linux-gnu/libc/usr
去掉 Makefile 里面的 -m64 编译选项
vim vpp/src/CMakeLists.txt:
1.添加:必须在 project(vpp C) 前面添加:工具链路径根据自身情况做修改
#####################################################################
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_SYSROOT /home/guoqixin/gcc-arm-10.2-2020.11-x86_64-aarch64_be-none-linux-gnu/aarch64_be-none-linux-gnu/libc)
set(tools /home/guoqixin/gcc-arm-10.2-2020.11-x86_64-aarch64_be-none-linux-gnu)
set(CMAKE_C_COMPILER ${tools}/bin/aarch64_be-none-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64_be-none-linux-gnu-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
#####################################################################
project(vpp C)
2. 删除:删掉下面的 -Werror 编译选项
if (CMAKE_BUILD_TYPE)
set(CMAKE_C_FLAGS "-g -fPIC -Werror -Wall ${CMAKE_C_FLAGS}")
endif()
make build-release
编译结果在:
vpp/build-root/install-vpp-native/vpp
将编译结果:vpp/build-root/install-vpp-native/vpp目录打包,拷贝到目标机;
同时将工具链的:
gcc-arm-10.2-2020.11-x86_64-aarch64_be-none-linux-gnu/aarch64_be-none-linux-gnu/libc 目录打包拷贝到目标机
运行:
LD_LIBRARY_PATH=[工具链路径]/libc/lib64:[工具链路径]/libc/usr/lib64 [工具链路径]/libc/lib/ld-linux-aarch64_be.so.1 [vpp路径]/vpp/bin/vpp -c startup.conf
1、问题:
cmake: symbol lookup error: cmake: undefined symbol: archive_write_add_filter_zstd
解决办法:
yum remove libarchive*
wget https://github.com/libarchive/libarchive/releases/download/3.5.1/libarchive-3.5.1.tar.xz
tar -xvf libarchive-3.5.1.tar.xz
cd libarchive-3.5.1
./configure --prefix=/usr --disable-static && make
sudo make install
cd .. && rm -rf libarchive-3.5.1 && rm libarchive-3.5.1.tar.xz
git tag -d v21.10-rc0
git tag -a v21.10-rc0 -m "v21.10-rc0"
git describe