android - 交叉编译arm64

标签 android cross-compiling papi

我正在尝试在juno arm development board上安装papi工具,我已经在该板上安装了 64 位 Linaro `ack-armlt' Android 通用内核以及 Android 文件系统(我按照 this tutorial 来完成此操作)。

我的系统是:

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

编译显示这些日志:

    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 compiling
configure: Generating fpapi.h
configure: Generating f77papi.h
configure: Generating f90papi.h
configure: Rules.pfm4_pe will be included in the generated Makefile
configure: creating ./config.status
config.status: creating Makefile
config.status: creating papi.pc
config.status: creating components/Makefile_comp_tests.target
config.status: creating testlib/Makefile.target
config.status: creating utils/Makefile.target
config.status: creating ctests/Makefile.target
config.status: creating ftests/Makefile.target
config.status: creating validation_tests/Makefile.target
config.status: creating config.h
config.status: config.h is unchanged

运行 sudo make:

    lfpm1993@lfpm1993-virtual-machine:~/Desktop/papi/src$ sudo make
Host architecture   : Linux with perf_event kernel support and libpfm4
Host CPU component  : perf_event
Installation DESTDIR: 
Installation PREFIX : /opt/install-arm64/papi-5.6.1.0
Installation EPREFIX: /opt/install-arm64/papi-5.6.1.0
Installation INCDIR : /opt/install-arm64/papi-5.6.1.0/include
Installation LIBDIR : /opt/install-arm64/papi-5.6.1.0/lib
Installation BINDIR : /opt/install-arm64/papi-5.6.1.0/bin
Installation MANDIR : /opt/install-arm64/papi-5.6.1.0/share/man
Installation DOCDIR : /opt/install-arm64/papi-5.6.1.0/share/doc/papi
Installation DATADIR: /opt/install-arm64/papi-5.6.1.0/share/papi

aarch64-linux-gnu-gcc -E -DFORTRANUNDERSCORE papi_fwrappers.c > papi_fwrappers_.c
aarch64-linux-gnu-gcc -E -DFORTRANDOUBLEUNDERSCORE papi_fwrappers.c > papi_fwrappers__.c
aarch64-linux-gnu-gcc -E -DFORTRANCAPS papi_fwrappers.c > upper_PAPI_FWRAPPERS.c
rm -f libpapi.so.5.6.1.0 libpapi.so libpapi.so.5; 
aarch64-linux-gnu-gcc -fPIC -DPIC -shared -Wl,-soname -Wl,libpapi.so.5 -Xlinker "-rpath" -Xlinker "/opt/install-arm64/papi-5.6.1.0/lib" -DPAPI_NO_MEMORY_MANAGEMENT -DSTATIC_PAPI_EVENTS_TABLE  -DUSE_PERFEVENT_RDPMC=1 -DPEINCLUDE=\"libpfm4/include/perfmon/perf_event.h\" -D_REENTRANT -D_GNU_SOURCE -DUSE_COMPILER_TLS -Ilibpfm4/include -fvisibility=hidden -I. -g -Wextra -DUSE_PTHREAD_MUTEXES  -Wall -DOSLOCK=\"linux-lock.h\" -DOSCONTEXT=\"linux-context.h\" -O2  papi_libpfm4_events.c papi.c papi_internal.c papi_hl.c extras.c sw_multiplex.c papi_fwrappers.c papi_fwrappers_.c papi_fwrappers__.c upper_PAPI_FWRAPPERS.c threads.c cpus.c linux-memory.c linux-timer.c linux-common.c  papi_preset.c papi_vector.c papi_memory.c components/perf_event/perf_event.c components/perf_event/pe_libpfm4_events.c components/perf_event_uncore/perf_event_uncore.c  -o libpapi.so.5.6.1.0 -Bdynamic -Llibpfm4/lib -lpfm 
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible libpfm4/lib/libpfm.so when searching for -lpfm
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible libpfm4/lib/libpfm.a when searching for -lpfm
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible //usr/local/lib/libpfm.so when searching for -lpfm
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible //usr/local/lib/libpfm.a when searching for -lpfm
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: cannot find -lpfm
collect2: error: ld returned 1 exit status
Makefile.inc:63: recipe for target 'libpapi.so.5.6.1.0' failed
make: *** [libpapi.so.5.6.1.0] Error 1

我对交叉编译和/或使用 juno board 和 Android 不太有经验。因此,如果这是一个“基本”问题,请耐心等待,感谢您抽出时间。

最佳答案

首先运行“make distclean”解决了这个问题。

./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

make

sudo make install

将这些二进制文件安装在/opt/install-arm64/papi-5.6.1.0 中。

关于android - 交叉编译arm64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50491623/

相关文章:

c - 为 ARM 发布交叉编译 apr-1.5.2

c - x86 上的简单 PAPI 分析中意外出现大量 TLB 未命中

c++ - 在 64 位 CENTO 上重复安装 Perl

android - perf_event 用于进程中的多个线程

c - 分析C程序函数的缓存命中率

Android:如何从 native 代码广播 Intent ?

android - Toast.makeText().show() 消息在 Activity-less 服务中去哪里?

javascript - 在 Android 的 WebView 中加载元素时隐藏该元素(或完全阻止其加载)

java - 未知错误 - 整数解析

postgresql - 为 ARM Sitara AM335x 交叉编译 postgresql