osx - Android valgrind build fails -
hello i'm trying build valgrind android-arm. on linux mint 13 fails with:
$ make echo "# generated file, composed of following suppression rules:" > default.supp echo "# " exp-sgcheck.supp xfree-3.supp xfree-4.supp glibc-2.x-drd.supp glibc-2.34567-nptl-helgrind.supp glibc-2.x.supp >> default.supp cat exp-sgcheck.supp xfree-3.supp xfree-4.supp glibc-2.x-drd.supp glibc-2.34567-nptl-helgrind.supp glibc-2.x.supp >> default.supp make all-recursive make[1]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1' making in include make[2]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1/include' make[2]: nothing done `all'. make[2]: leaving directory `/home/matt/desktop/valgrind/valgrind-3.8.1/include' making in vex make[2]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1/vex' make all-am make[3]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1/vex' gcc -dhave_config_h -i. -i.. -i.. -i../include -i../vex/pub -dvga_arm=1 -dvgo_linux=1 -dvgp_arm_linux=1 -dvgpv_arm_linux_vanilla=1 -ipriv -m32 -o2 -g -wall -wmissing-prototypes -wshadow -wpointer-arith -wstrict-prototypes -wmissing-declarations -wno-format-zero-length -fno-strict-aliasing -fno-builtin -marm -mcpu=cortex-a8 -wbad-function-cast -wcast-qual -wcast-align -fstrict-aliasing -wno-long-long -wno-pointer-sign -fno-stack-protector -mt libvex_arm_linux_a-main_globals.o -md -mp -mf .deps/libvex_arm_linux_a-main_globals.tpo -c -o libvex_arm_linux_a-main_globals.o `test -f 'priv/main_globals.c' || echo './'`priv/main_globals.c gcc: warning: ‘-mcpu=’ deprecated; use ‘-mtune=’ or ‘-march=’ instead cc1: error: unrecognised command line option ‘-marm’ priv/main_globals.c:1:0: error: bad value (cortex-a8) -mtune= switch make[3]: *** [libvex_arm_linux_a-main_globals.o] error 1 make[3]: leaving directory `/home/matt/desktop/valgrind/valgrind-3.8.1/vex' make[2]: *** [all] error 2 make[2]: leaving directory `/home/matt/desktop/valgrind/valgrind-3.8.1/vex' make[1]: *** [all-recursive] error 1 make[1]: leaving directory `/home/matt/desktop/valgrind/valgrind-3.8.1' make: *** [all] error 2
i using ndk-r8e , valgrind 3.8.1. configure ends with:
maximum build arch: arm primary build arch: arm secondary build arch: build os: linux primary build target: arm_linux secondary build target: platform variant: vanilla primary -dvgpv string: -dvgpv_arm_linux_vanilla=1 default supp files: exp-sgcheck.supp xfree-3.supp xfree-4.supp glibc-2.x-drd.supp glibc-2.34567-nptl-helgrind.supp glibc-2.x.supp
what can fix this? alternatively, there pre-built android-arm valgrind binaries can use?
for building , installing valgrind android use bash script below, prefer call build_valgrind.sh
to run run_hello_jni_through_valgrind=true need 2 additional scripts (bootstrap_valgrind.sh, start_valgrind.sh) in directory run script below from.
running script run_hello_jni_through_valgrind=true flag build hello-jni application samples directory inside android ndk home, deploy phone , run through valgrind, using either callgrind or memcheck tool, can specify in start_valgrind.sh script.
the other 2 scripts described here: https://stackoverflow.com/a/19235439/313113
here's directory structure:
|-- build_valgrind.sh (the script below) |-- bootstrap_valgrind.sh (second script https://stackoverflow.com/a/19235439/313113) |-- start_valgrind.sh (first script https://stackoverflow.com/a/19235439/313113) |-- valgrind-3.10.0 (will extracted build_valgrind.sh) `-- valgrind-3.10.0.tar.bz2 (will downloaded build_valgrind.sh)
i've tested working (memcheck , callgrind tools) on samsung galaxy nexus device cyanogenmod 10.2.1 , android 4.3.1 , cyanogenmod 11 20140804 snapshot, android 4.4.4
you can see file size of generated output with: adb shell ls -lr "/sdcard/*grind*"
the build_valgrind.sh script:
#!/usr/bin/env bash #set -x function extract() { if [ -f "$1" ] ; case "$1" in *.tar.bz2) tar xvjf "$1" ;; *.tar.gz) tar xvzf "$1" ;; *.bz2) bunzip2 "$1" ;; *.rar) unrar x "$1" ;; *.gz) gunzip "$1" ;; *.tar) tar xvf "$1" ;; *.tbz2) tar xvjf "$1" ;; *.tgz) tar xvzf "$1" ;; *.zip) unzip "$1" ;; *.z) uncompress "$1" ;; *.7z) 7z x "$1" ;; *) echo "$1 cannot extracted via >extract<" ;; esac else echo "'$1' not valid file" fi } run_hello_jni_through_valgrind=true valgrind_version="3.10.0" valgrind_extension=".tar.bz2" valgrind_directory="valgrind-${valgrind_version}" valgrind_tarball="valgrind-${valgrind_version}${valgrind_extension}" # download valgrind tarball again if not downloaded if [[ ! -f "${valgrind_tarball}" ]]; wget -v -nc "http://valgrind.org/downloads/${valgrind_tarball}" fi # extract valgrind tarball again if not extracted if [[ ! -d "$valgrind_directory" ]]; extract "$valgrind_tarball" fi # ensure android_ndk_home set if [[ ! -z "$android_ndk_home" ]]; export android_ndk_home="$home/software/android/android-ndk-r10c" fi # ensure andoid_sdk_home set if [[ ! -z "$android_sdk_home" ]]; export android_sdk_home="$home/software/android/android-sdk/" fi if [[ ! -d "$valgrind_directory" ]]; echo "problem extracting valgrind $valgrind_tarball $valgrind_directory!!!" exit -1 fi # move extracted directory cd "$valgrind_directory" # arm toolchain arch_abi="arm-linux-androideabi-4.9" export ar="$android_ndk_home/toolchains/${arch_abi}/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar" export ld="$android_ndk_home/toolchains/${arch_abi}/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld" export cc="$android_ndk_home/toolchains/${arch_abi}/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc" export cxx="$android_ndk_home/toolchains/${arch_abi}/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++" [[ ! -d "$android_ndk_home" || ! -f "$ar" || ! -f "$ld" || ! -f "$cc" || ! -f "$cxx" ]] && echo "make sure ar, ld, cc, cxx variables defined correctly. ensure android_ndk_home defined also" && exit -1 # configure build export hwkind="nexus_s" android_platform=android-18 export cppflags="--sysroot=$android_ndk_home/platforms/${android_platform}/arch-arm -dandroid_hardware_$hwkind" export cflags="--sysroot=$android_ndk_home/platforms/${android_platform}/arch-arm" # bug: reason file command unable detect if file not exist ! -f , says doesn't exist when does!!! build=false if [[ "${valgrind_directory}/inst/data/local/inst/bin/valgrind" = *"no such file or directory"* ]]; build=true fi if [[ "$build" = true ]]; ./configure --prefix="/data/local/inst" \ --host="armv7-unknown-linux" \ --target="armv7-unknown-linux" \ --with-tmpdir="/sdcard " [[ $? -ne 0 ]] && echo "can't configure!" && exit -1 # determine number of jobs (commands) run simultaneously gnu make no_cpu_cores=$(grep -c ^processor /proc/cpuinfo) if [ $no_cpu_cores -le 8 ]; jobs=$(($no_cpu_cores+1)) else jobs=${no_cpu_cores} fi # compile valgrind make -j "${jobs}" [[ $? -ne 0 ]] && echo "can't compile!" && exit -1 # install valgrind locally make -j "${jobs}" install destdir="$(pwd)/inst" [[ $? -ne 0 ]] && echo "can't install!" && exit -1 fi # push local valgrind installtion phone if [[ $(adb shell ls -ld /data/local/inst/bin/valgrind) = *"no such file or directory"* ]]; adb root adb remount adb shell "[ ! -d /data/local/inst ] && mkdir /data/local/inst" adb push inst / adb shell "ls -l /data/local/inst" # ensure valgrind on phone running adb shell "/data/local/inst/bin/valgrind --version" # add valgrind executable path (this might fail) adb shell "export path=$path:/data/local/inst/bin/" fi if [ $run_hello_jni_through_valgrind = true ]; package="com.example.hellojni" # location of hello jni sample application hello_jni_path="$android_ndk_home/samples/hello-jni" pushd "$hello_jni_path" # update build target desired android sdk version android_project_target="android-18" android update project --target "$android_project_target" --path . --name hello-jni --subprojects # enable android ndk build ant echo '<?xml version="1.0" encoding="utf-8"?> <project name="hellojni" basedir="." default="debug"> <target name="-pre-build"> <exec executable="${ndk.dir}/ndk-build" failonerror="true"/> </target> <target name="clean" depends="android_rules.clean"> <exec executable="${ndk.dir}/ndk-build" failonerror="true"> <arg value="clean"/> </exec> </target> </project> ' > "custom_rules.xml" # set ndk home ant (only if not set) if ! grep -p -q "ndk.dir=.+" "local.properties" ; echo -e "\nndk.dir=$android_ndk_home" >> "local.properties" fi # fix java 8 warning (warning: [options] source value 1.5 obsolete , removed in future release) echo "java.compilerargs=-xlint:-options" >> "ant.properties" # workaround install_parse_failed_inconsistent_certificates error adb uninstall "$package" # build hello jni project in debug mode , install on device ant clean && ant debug && ant installd popd cd .. # start hellojni app adb shell start -a android.intent.action.main -n $package/.hellojni # make script executable chmod a+x bootstrap_valgrind.sh # run application through valgrind on phone /usr/bin/env bash bootstrap_valgrind.sh adb shell ls -lr "/sdcard/*grind*" adb shell ls -lr "/storage/sdcard0/*grind*" adb shell ls -lr "/storage/sdcard1/*grind*" fi exit 0
Comments
Post a Comment