Cross-compiling for arm64

10,857

Running "make distclean" first solved it.

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

To install those binary files in /opt/install-arm64/papi-5.6.1.0.

Share:
10,857
LuisM
Author by

LuisM

Updated on June 04, 2022

Comments

  • LuisM
    LuisM about 2 years

    I'm trying to install papi tools on juno arm development board, I have installed 64-bit Linaro `ack-armlt' Android Common Kernel plus Android filesystem on that board (I followed this tutorial to accomplish that).

    My system is:

    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
    

    Compiling shows these logs:

        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
    

    Running 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
    

    I'm not very experienced with cross-compilling and/or using juno board and Android. So, if this is a 'basic' question have some pacience and thank you for your time.