Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issues on an AArch32 userspace when running an AArch64 kernel #2017

Open
lgeek opened this issue Aug 8, 2017 · 1 comment
Open

Build issues on an AArch32 userspace when running an AArch64 kernel #2017

lgeek opened this issue Aug 8, 2017 · 1 comment

Comments

@lgeek
Copy link

lgeek commented Aug 8, 2017

Trying to build on a system running Linux 3.18.0 (AArch64) in an AArch32 chroot (Arch Linux ARM, gcc 6.3.1, cmake 3.7.2). The first error I get is:

[ 11%] Building ASM object dynamorio/core/CMakeFiles/drhelper.dir/arch/asm_shared.asm.o
In file included from /home/cosmin/drmemory/dynamorio/core/arch/asm_shared.asm:37:0:
/home/cosmin/drmemory/dynamorio/core/arch/asm_defines.asm:65:3: error: #error ARM is only 32-bit; AARCH64 is 64-bit
 # error ARM is only 32-bit; AARCH64 is 64-bit
   ^~~~~

I guessed that the architecture reported by the kernel is used at some point in the build process, so I've then enabled the PER_LINUX32 personality by prepending linux32 to the cmake and make commands (on a clean build). This changes the output of uname, /proc/cpuinfo, etc to be compatible with that on AArch32 kernels. The build then completed.

DynamoRIO 266b8a3c8b on its own also fails to build without PER_LINUX32, but with a different error, so I think both the DR and Dr. Memory build systems misbehave.

[  8%] Building CXX object clients/drcachesim/CMakeFiles/drcachesim_ops.dir/common/options.cpp.o
c++: error: unrecognized command line option '-mpreferred-stack-boundary=2'; did you mean '-mstructure-size-boundary='?

I've generally found the output of $(CC) -dumpmachine to be a more robust way of detecting the target architecture, but I'm not sure how well that would work with your build system.

@egrimley
Copy link

egrimley commented Aug 8, 2017

This might be a CMake bug rather than a DynamoRIO/DrMemory bug. Personally I always (except when I forget) use linux32 when entering the chroot, thus:

chroot debian-armhf-stretch linux32 /bin/su -

Some interesting comments on -dumpmachine here:
https://stackoverflow.com/questions/28505562/is-there-a-gcc-option-to-print-the-target-triplet-when-cross-compiling

Asking the C compiler does make sense, because you could be on a system that is capable of running lots of different kinds of binary. For example, with one kernel I built:

$ arch-test 
arm64
arm64ilp32
armel
armhf

(See https://packages.debian.org/sid/admin/arch-test. It's unlikely that DynamoRIO will ever be ported to arm64ilp32 but thinking about how it would be handled might contribute to a better understanding of what we mean by "architecture".)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants