[pypy-issue] Issue #2218: Cross-translating on 64 bit host: recompile with -fPIC and -m32 (pypy/pypy)

mzakharo issues-reply at bitbucket.org
Mon Dec 28 21:05:24 EST 2015

New issue 2218: Cross-translating on 64 bit host: recompile with -fPIC and -m32


When cross-translating  pypy 4.0.1 for 32-bit ARM on a 64 bit host (Ubuntu 14.04),  the translation task:

pypy <path to rpython>/rpython/bin/rpython -Ojit --platform=arm --gcrootfinder=shadowstack --jit-backend=arm targetpypystandalone.py

fails  with:

[platform:Error] /usr/bin/ld: /tmp/usession-release-4.0.1-59/rpython/translator/c/src/signals.o: relocation R_X86_64_32 against `pypysig_counter' can not be used when making a shared object; recompile with -fPIC
[platform:Error] /tmp/usession-release-4.0.1-59/rpython/translator/c/src/signals.o: error adding symbols: Bad value
[platform:Error] collect2: error: ld returned 1 exit status

when I add the -fPIC, the error changes to:

translation:ERROR] OSError: Cannot load library /tmp/usession-release-4.0.1-60/shared_cache/externmod.so: /tmp/usession-release-4.0.1-60/shared_cache/externmod.so: wrong ELF class: ELFCLASS64

Finally, The attached patch adds -m32 to args_for_shared() and get_shared_only_compile_flags(), which which fixes the problem for me.

 The patch is *hackish*  - could someone please advise on what the correct solution  would look like?

More information about the pypy-issue mailing list