valgrind 交叉编译 android arm/arm64 平台

源代码目录运行编译脚本

  • android arm
#!/usr/bin/env bash

export NDKROOT=~/opt/android-ndk-r14b/
export AR=$NDKROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
export LD=$NDKROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld
export CC=$NDKROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc

bash autogen.sh

CPPFLAGS="--sysroot=$NDKROOT/platforms/android-14/arch-arm" \
CFLAGS="--sysroot=$NDKROOT/platforms/android-14/arch-arm" \
./configure --prefix=/data/local/Inst \
    --host=armv7-unknown-linux --target=armv7-unknown-linux \
    --with-tmpdir=/sdcard

make -j4 
make -j4 install DESTDIR=`pwd`/Inst
  • android arm64
#!/usr/bin/env bash

export NDKROOT=~/opt/android-ndk-r14b/
export AR=$NDKROOT/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar 
export LD=$NDKROOT/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld
export CC=$NDKROOT/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc

bash autogen.sh

CPPFLAGS="--sysroot=$NDKROOT/platforms/android-21/arch-arm64" \
   CFLAGS="--sysroot=$NDKROOT/platforms/android-21/arch-arm64" \
   ./configure --prefix=/data/local/Inst \
   --host=aarch64-unknown-linux --target=aarch64-unknown-linux \
   --with-tmpdir=/sdcard

make -j4
make -j4 install DESTDIR=`pwd`/Inst

将生成的文件 push 到设备

adb push Inst /

运行命令

export VALGRIND_LIB=/data/local/Inst/lib/valgrind
export PATH=$PATH:/data/local/Inst/bin

valgrind [--tool=callgrind]   [args]

你可能感兴趣的:(tool)