Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Valgrind for Android

Building valgrind-3.8.1 on ubuntu 12.04 with ndk-r6 or ndk-r8d failed with following error:

...
cc1: Error: not rekognized option "-marm"
priv/main_globals.c:1:0: Error: wrong Value (cortex-a8) for -mtune=switch
...

My build-script:

export NDKROOT=/home/stefan/android-ndk-r6-crystax-2
export HWKIND=generic
PATH=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$PATH
PATH=$PATH:$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/libexec/gcc/arm-linux-androideabi/4.4.3
export CROSS_COMPILE=arm-linux-androideabi-
export AR=${CROSS_COMPLIE}ar
export LD=${CROSS_COMPLIE}ld
export CC=${CROSS_COMPLIE}gcc
export CXX=${CROSS_COMPLIE}g++
export CPP=${CROSS_COMPLIE}cpp

./autogen.sh CPPFLAGS="--sysroot=$NDKROOT/platforms/android-3/arch-arm -DANDROID_HARDWARE_$HWKIND" CFLAGS="--sysroot=$NDKROOT/platforms/android-3/arch-arm"
./configure --prefix=/data/local/Inst --host=armv7-unknown-linux --target=armv7-unknown-linux --with-tmpdir=/tmp

And finally

make    

:)

Any ideas? THANKS

Also i would accept builded binaries ;))

like image 863
oc1d Avatar asked Feb 28 '13 08:02

oc1d


2 Answers

For how to build Valgrind for Android (ARM) see: https://stackoverflow.com/a/19255251/313113

For how to run your app through Valgrind see: https://stackoverflow.com/a/19235439/313113

like image 190
Alex Bitek Avatar answered Oct 15 '22 01:10

Alex Bitek


Follow the instructions on this page : http://valgrind.org/docs/manual/dist.readme-android.html

You don't compile valgrind as embbeded for your application, but you compile a arm-compatible valgrind binary on your computer, linked with the android-ndk library, and then you can ship valgrind on some folder on your device or simulator. That's around 130 Mb of data.

Note that the device must be rooted.

Then, whenever you want to run valgrind with your android app, you will have to attach valgrind to the app. For that, look here : How to start an android app with valgrind

like image 45
user1089645 Avatar answered Oct 14 '22 23:10

user1089645