为Arm64架构交叉编译PAPI工具至Juno开发板求助
环境信息
- 目标平台:Juno Arm开发板,已预装64位Linaro
ack-armltAndroid通用内核及Android文件系统 - 编译主机系统:
Linux lfpm1993-virtual-machine 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
执行的交叉编译配置命令
./configure --host=aarch64-linux-gnu --prefix=/opt/install-arm64/papi-5.6.1.0 --with-ffsll --with-walltimer=cycle --with-tls=__thread --with-virtualtimer=perfctr --with-perf-events --with-arch=aarch64 --with-CPU=arm
配置日志片段
lfpm1993@lfpm1993-virtual-machine:~/Desktop/papi/src$ ./configure --host=aarch64-linux-gnu --prefix=/opt/install-arm64/papi-5.6.1.0 --with-ffsll --with-walltimer=cycle --with-tls=__thread --with-virtualtimer=perfctr --with-perf-events --with-arch=aarch64 --with-CPU=arm checking for architecture... aarch64 checking for OS... linux checking for OS version... 4.13.0-43-generic checking for perf_event workaround level... autodetect checking for if MIC should be used... no checking for aarch64-linux-gnu-xlc... no checking for aarch64-linux-gnu-icc... no checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether aarch64-linux-gnu-gcc accepts -g... yes checking for aarch64-linux-gnu-gcc option to accept ISO C89... none needed checking for aarch64-linux-gnu-xlf... no checking for aarch64-linux-gnu-ifort... no checking for aarch64-linux-gnu-gfortran... no checking for aarch64-linux-gnu-f95... no checking for aarch64-linux-gnu-f90... no checking for aarch64-linux-gnu-f77... no checking for xlf... no checking for ifort... no checking for gfortran... no checking for f95... no checking for f90... no checking for f77... no checking whether we are using the GNU Fortran 77 compiler... no checking whether accepts -g... no checking for mpicc... no checking for gawk... gawk checking how to run the C preprocessor... aarch64-linux-gnu-gcc -E checking whether ln -s works... yes checking whether make sets $(MAKE)... yes checking for aarch64-linux-gnu-ranlib... aarch64-linux-gnu-ranlib checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for ANSI C header files... (cached) yes checking for inline... inline checking whether time.h and sys/time.h may both be included... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking c_asm.h usability... no checking c_asm.h presence... no checking for c_asm.h... no checking intrinsics.h usability... no checking intrinsics.h presence... no checking for intrinsics.h... no checking mach/mach_time.h usability... no checking mach/mach_time.h presence... no checking for mach/mach_time.h... no checking sched.h usability... yes checking sched.h presence... yes checking for sched.h... yes checking for gethrtime... no checking for read_real_time... no checking for time_base_to_time... no checking for clock_gettime... yes checking for mach_absolute_time... no checking for sched_getcpu... yes checking for dlopen and dlerror symbols in base system... not found checking for dlopen and dlerror symbols in -ldl... found checking for native compiler for header generation... gcc checking for debug build... checking for -Wno-override-init... 1 checking for CPU type... arm forcing use of pthread mutexes... checking for ffsll... yes checking for working gettid... no checking for working syscall(SYS_gettid)... yes checking for which real time clock to use... cycle checking for high performance thread local storage... __thread checking for which virtual timer to use... perfctr checking for static user preset events... no checking for static PAPI preset events... yes checking for whether to build static library... yes checking for whether to build shared library... yes checking for static compile of tests and utilities... no checking for linking with papi shared library of tests and utilities... no checking platform... linux-pe checking for components to build... perf_event perf_event_uncore checking for PAPI event CSV filename to use... papi_events.csv configure: Compiling genpapifdef with gcc because cross com
排查建议
首先你的配置日志最后一行明显截断了,这大概率是配置过程中出现了中断或者输出没捕获完整,先把完整的configure输出拿到手,这是定位问题的关键。另外给你几个具体的排查方向:
修正CPU架构参数:你指定了
--with-CPU=arm,但目标平台是aarch64(armv8)架构,这个参数可能会导致配置逻辑出错,建议改成--with-CPU=armv8或者直接去掉该参数,让configure自动适配目标架构。验证交叉工具链完整性:虽然日志里找到了
aarch64-linux-gnu-gcc,但要确认工具链版本是否适配Juno板的内核版本,同时运行aarch64-linux-gnu-gcc --version检查工具链是否正常工作,还要确保工具链的依赖库(比如aarch64版本的libpthread、librt)已安装。简化配置参数:先去掉一些可选的
--with-*参数,比如--with-virtualtimer=perfctr、--with-perf-events,先让配置流程跑通,再逐步添加你需要的功能模块,避免多个参数冲突导致配置失败。检查安装目录权限:你的安装前缀是
/opt/install-arm64/papi-5.6.1.0,要确认这个目录你有读写权限,否则configure在生成安装路径时可能会抛出权限错误。补全依赖项:PAPI编译依赖
gawk、make等基础工具,日志里显示找到了gawk,但可以再确认主机上是否安装了aarch64-linux-gnu-binutils等交叉编译配套工具。
内容的提问来源于stack exchange,提问作者LuisM

