Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Issues
  • #2154
Closed
Open
Issue created Jan 25, 2017 by Administrator@rootContributor

BUILD: Building for Android AARCH64 on Linux

Created by: manizzle

Cannot build for Android AARCH64.

Build for Android ARM32 works fine.

I initialize my toolchain like,

../ndk/android-ndk-r13b/build/tools/make-standalone-toolchain.sh --arch=arm --platform=android-21 --install-dir=android-ndk-21 --toolchain=arm-linux-androideabi-4.9

Replace linkers:

ln -sf arm-linux-androideabi-ld.bfd bin/arm-linux-androideabi-ld
ln -sf ld.bfd arm-linux-androideabi/bin/ld
cmake -DCMAKE_TOOLCHAIN_FILE=/root/dr/dynamorio/make/toolchain-android.cmake -DANDROID_TOOLCHAIN=/root/dr/android-ndk-21/ -DDR_COPY_TO_DEVICE=ON DYNAMORIO_CONFIGDIR=/sdcard/dynamo/ -DTARGET_ABI=arm-linux-androideabi /root/dr/dynamorio/
make -j

works fine.

Then if I try to do the same, but for aarch64 it fails:

../ndk/android-ndk-r13b/build/tools/make-standalone-toolchain.sh --arch=arm64 --platform=android-21 --install-dir=android-ndk-21-64 --toolchain=aarch64-linux-android-4.9
ln -sf aarch64-linux-android-ld.bfd bin/aarch64-linux-android-ld
ln -sf ld.bfd aarch64-linux-android/bin/ld

I tried this cmake line:

cmake -DCMAKE_TOOLCHAIN_FILE=/root/dr/dynamorio/make/toolchain-android.cmake -DANDROID_TOOLCHAIN=/root/dr/android-ndk-21-64/ -DDR_COPY_TO_DEVICE=ON DYNAMORIO_CONFIGDIR=/sdcard/dynamo/ -DTARGET_ABI=aarch64-linux-android /root/dr/dynamorio/

and it errors with

-- Performing Test no_pie_avail - Failed
CMake Error at /root/dr/build_android_64/cmake/DynamoRIOConfig.cmake:1069 (message):
  *** /root/dr/android-ndk-21-64/bin/aarch64-linux-android-ld.bfd failed: ***

  /root/dr/android-ndk-21-64/bin/aarch64-linux-android-ld.bfd: unrecognised
  emulation mode: elf_x86_64

  Supported emulations: aarch64linux aarch64elf aarch64elf32 aarch64elf32b
  aarch64elfb armelf armelfb aarch64linuxb aarch64linux32 aarch64linux32b
  armelfb_linux_eabi armelf_linux_eabi

Call Stack (most recent call first):
  clients/drcov/CMakeLists.txt:43 (configure_DynamoRIO_client)


-- Configuring incomplete, errors occurred!

So I tried with:

cmake -DCMAKE_TOOLCHAIN_FILE=/root/dr/dynamorio/make/toolchain-android.cmake -DANDROID_TOOLCHAIN=/root/dr/android-ndk-21-64/ -DDR_COPY_TO_DEVICE=ON DYNAMORIO_CONFIGDIR=/sdcard/dynamo/ -DTARGET_ABI=aarch64-linux-android -DCMAKE_SYSTEM_PROCESSOR=aarch64 /root/dr/dynamorio/

The cmake runs fine, but then when I build it with make -j, it errors with:


[  3%] Linking C executable ../bin64/drloader
In file included from /root/dr/dynamorio/core/lib/../globals.h:332:0,
                 from /root/dr/dynamorio/core/lib/dr_helper.c:40:
/root/dr/dynamorio/core/unix/os_exports.h:122:5: error: #error NYI
 #   error NYI
     ^
/root/dr/dynamorio/core/unix/os_exports.h:328:0: error: "_NSIG_BPW" redefined [-Werror]
 # define _NSIG_BPW 64
 ^
In file included from /root/dr/android-ndk-21-64/sysroot/usr/include/asm/signal.h:22:0,
                 from /root/dr/android-ndk-21-64/sysroot/usr/include/linux/signal.h:21,
                 from /root/dr/android-ndk-21-64/sysroot/usr/include/signal.h:43,
                 from /root/dr/dynamorio/core/lib/globals_shared.h:126,
                 from /root/dr/dynamorio/core/lib/../globals.h:90,
                 from /root/dr/dynamorio/core/lib/dr_helper.c:40:
/root/dr/android-ndk-21-64/sysroot/usr/include/asm-generic/signal.h:24:0: note: this is the location of the previous definition
 #define _NSIG_BPW __BITS_PER_LONG
 ^
In file included from /root/dr/dynamorio/core/lib/../globals.h:332:0,
                 from /root/dr/dynamorio/core/lib/dr_helper.c:40:
/root/dr/dynamorio/core/unix/os_exports.h:334:0: error: "_NSIG_WORDS" redefined [-Werror]
 # define _NSIG_WORDS (MAX_SIGNUM / _NSIG_BPW)
 ^
In file included from /root/dr/android-ndk-21-64/sysroot/usr/include/asm/signal.h:22:0,
                 from /root/dr/android-ndk-21-64/sysroot/usr/include/linux/signal.h:21,
                 from /root/dr/android-ndk-21-64/sysroot/usr/include/signal.h:43,
                 from /root/dr/dynamorio/core/lib/globals_shared.h:126,
                 from /root/dr/dynamorio/core/lib/../globals.h:90,
                 from /root/dr/dynamorio/core/lib/dr_helper.c:40:
/root/dr/android-ndk-21-64/sysroot/usr/include/asm-generic/signal.h:25:0: note: this is the location of the previous definition
 #define _NSIG_WORDS (_KERNEL__NSIG / _NSIG_BPW)
 ^
cc1: all warnings being treated as errors
core/CMakeFiles/drhelper.dir/build.make:104: recipe for target 'core/CMakeFiles/drhelper.dir/lib/dr_helper.c.o' failed
make[2]: *** [core/CMakeFiles/drhelper.dir/lib/dr_helper.c.o] Error 1
CMakeFiles/Makefile2:167: recipe for target 'core/CMakeFiles/drhelper.dir/all' failed
make[1]: *** [core/CMakeFiles/drhelper.dir/all] Error 2
Assignee
Assign to
Time tracking