This used to work before. I don’t know what changed, the thing is I can’t run anymore. I’m cross-compiling for an aarch64 architecture with ARM cpu’s, using Ubuntu 16.04 x86-64.
This is what I’m running to configure:
./configure –host=aarch64-linux-gnu –prefix=/data/data/papi/independent –exec-prefix=/data/data/papi/dependent –with-static-lib=yes –with-shared-lib=no –with-static-tools –with-arch=aarch64 –with-CPU=arm –with-ffsll –with-walltimer=cycle –with-tls=__thread –with-virtualtimer=clock_cputime_id –with-perf-events
Logs from running configure:
checking for architecture... aarch64 checking for OS... linux checking for OS version... 4.15.0-29-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... gfortran configure: WARNING: using cross tools not prefixed with host triplet checking whether we are using the GNU Fortran 77 compiler... yes checking whether gfortran accepts -g... yes checking for mpicc... mpicc 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... clock_cputime_id 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... no checking for static compile of tests and utilities... yes 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
After running make:
(…)
mpicc -I../testlib -I../validation_tests -I.. -I. -g -Wextra -DUSE_PTHREAD_MUTEXES -Wall -O1 first.c ../testlib/libtestlib.a ../testlib/do_loops.o ../libpapi.a -ldl -static -o mpifirst /usr/bin/ld: ../testlib/libtestlib.a(test_utils.o): Relocations in generic ELF (EM: 183) /usr/bin/ld: ../testlib/libtestlib.a(test_utils.o): Relocations in generic ELF (EM: 183) /usr/bin/ld: ../testlib/libtestlib.a(test_utils.o): Relocations in generic ELF (EM: 183) /usr/bin/ld: ../testlib/libtestlib.a(test_utils.o): Relocations in generic ELF (EM: 183) /usr/bin/ld: ../testlib/libtestlib.a(test_utils.o): Relocations in generic ELF (EM: 183) /usr/bin/ld: ../testlib/libtestlib.a(test_utils.o): Relocations in generic ELF (EM: 183) ../testlib/libtestlib.a: error adding symbols: File in wrong format collect2: error: ld returned 1 exit status Makefile.recipies:230: recipe for target 'mpifirst' failed make[2]: *** [mpifirst] Error 1 make[2]: Leaving directory '/home/lfpm1993/Desktop/papi/src/ctests' Makefile.inc:240: recipe for target 'ctests' failed make[1]: *** [ctests] Error 2 make[1]: Leaving directory '/home/lfpm1993/Desktop/papi/src' Rules.pfm4_pe:42: recipe for target 'libpfm4/lib/libpfm.a' failed make: *** [libpfm4/lib/libpfm.a] Error 2
file test_utils.o gives:
test_utils.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
It looks to me that it is the right type for the file I’m trying to build.
Any clues on how to solve it?
Thanks, Luís
Advertisement
Answer
mpicc -I../testlib ... first.c ../testlib/libtestlib.a ...
/usr/bin/ld: ../testlib/libtestlib.a(test_utils.o): Relocations in generic ELF (EM: 183)
This is invoking the wrong linker (system linker), and most likely also invoking the wrong compiler to compile first.c
.
What happens when you run”
mpicc -c -I../testlib -I../validation_tests -I.. -I. -DUSE_PTHREAD_MUTEXES first.c file first.o
I bet it says ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
, which would explain your problem: your libtestlib.a
is compiled for desired architecture, but your main program is not.
I can reproduce this exact error message by trying to link x86_64
foo.o
with a library of aarch64
objects.
This used to work before.
Possibly you have modified PATH
before, such that mpicc
found gcc
for target. And how you’ve neglected to set the PATH
appropriately.
(Makefile
s that depend on PATH
and other environment variables are the worst — they work in one shell, but not in another.)