Skip to content
Advertisement

Relocations in generic ELF (EM: 183)

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:

JavaScript

After running make:

(…)

JavaScript

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”

JavaScript

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.

(Makefiles that depend on PATH and other environment variables are the worst — they work in one shell, but not in another.)

Advertisement