5

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 ;))

oc1d
  • 233
  • 1
  • 3
  • 9
  • There's an Android.mk available for Valgrind in the Android source tree. See e.g. https://android.googlesource.com/platform/external/valgrind/+/master/main – Michael Feb 28 '13 at 09:31
  • hmm.. but how actually compile this? put in jni folder? With that, no include-path is defined in Android.mk and build failed :( – oc1d Feb 28 '13 at 15:00
  • possible duplicate of [Android valgrind build fails](http://stackoverflow.com/questions/16450650/android-valgrind-build-fails) – tonylo Dec 17 '13 at 18:01
  • I have been able to build valgrind for android. Do let me know if you need the working binary. BTW, it should also work on non rooted devices. – learn_develop Oct 31 '17 at 06:14

2 Answers2

10

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

Community
  • 1
  • 1
Alex Bitek
  • 6,529
  • 5
  • 47
  • 77
2

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

Community
  • 1
  • 1