lsof
下载lsof-4.95.0版本解压后,使用./configure --help查看相关编译选项,根据提示,查看目录下面的
0XXCONFIG文件确认交叉编译能够配置的选项
编译选项配置
使用终端进入lsof-4.95.0目录,配置以下项目
export LSOF_HOST=“arm64”
export LSOF_INCLUDE=/usr/local/oecore-x86_64/sysroots/aarch64-oe-linux/usr/include
export LSOF_CC=“aarch64-oe-linux-gcc --sysroot=/usr/local/oecore-x86_64/sysroots/aarch64-oe-linux”
需要在CC配置中增加sysroot配置,否则编译会报以下错误
/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/aarch64-oe-linux/gcc/aarch64-oe-linux/9.2.0/real-ld: cannot find crt1.o: No such file or directory
/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/aarch64-oe-linux/gcc/aarch64-oe-linux/9.2.0/real-ld: cannot find crti.o: No such file or directory
/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/aarch64-oe-linux/gcc/aarch64-oe-linux/9.2.0/real-ld: cannot find crtbegin.o: No such file or directory
/usr/local/oecore-x86_64/sysroots/x8

本文介绍了如何在aarch64平台上进行lsof的交叉编译,包括查看编译选项、配置链接库,并解决在没有sysroot时遇到的编译错误,以及添加tirpc库依赖以避免链接错误。
最低0.47元/天 解锁文章
1070





