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 ;))
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
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
Related
I am trying to achieve something similar to this
https://github.com/volatilityfoundation/volatility/wiki/Android#initialize-the-android-build-environment.
Below is the environment I am using:
Ubuntu 14.04, Android Studio 2.3, Android NDK r14, emulator -api22.
I am facing difficulties at step Cross Compile the Kernel.
I am targeting the goldfish kernel 3.10
following are the step I followed. Any help would be really appreciated.
method 1:
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=~/android-ndk/android-ndk-r14/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
The tutorial suggesting that we have to run the next command as
make goldfish_armv7_defconfig
but when I checked the directory "android-source/arch/arm/configs/" there is no such config file there. Some tutorials suggesting that we can just copy and paste the file from kernel 2.6, so I did the same thing, and after that add
CONFIG_MODULES=y
CONFIG_MODULES_UNLOAD=y
CONFIG_MODULES_FORCE_UNLOAD=y
But futher
$ make
results in error:
arch/arm/mm/mmu.c: In function 'build_mem_type_table':
arch/arm/mm/mmu.c:470:18: error: 'L_PTE_MT_VECTORS' undeclared (first use in this function)
vecs_pgprot |= L_PTE_MT_VECTORS;
^
arch/arm/mm/mmu.c:470:18: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/mm/mmu.c: At top level:
arch/arm/mm/mmu.c:637:23: warning: 'early_pte_alloc_and_install' defined but not used [-Wunused-function]
static pte_t * __init early_pte_alloc_and_install(pmd_t *pmd,
^
make[1]: *** [arch/arm/mm/mmu.o] Error 1
make: *** [arch/arm/mm] Error
methos 2:
Everything is same as in method 1, I just changed single variable
export ARCH=arm64
And run
make ranchu_deconfig
But I got the same error.
method 3:
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=~/android-ndk/android-ndk-r14/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
$ make ranchu_defconfig
$ vim .config # added this to .config file
CONFIG_MODULES=y
CONFIG_MODULES_UNLOAD=y
CONFIG_MODULES_FORCE_UNLOAD=y
$ make
This command run successfully: zImage found.
But when I run the emulator using the below command
root#ubuntu:~/Android/Sdk/tools# ./emulator -avd Nexus5x22 -kernel ~/android-source2/android-source/arch/arm/boot/zImage -show-kernel –verbose
I am getting the error of "Linux kernel too old to run ram disk":
ram disk error
Google's Android Kernel is messed up. They forgot to define L_PTE_MT_VECTORS when they back ported this patch.
The solution is to just add it here.
Hi Guys I am using this tutorial to build ghostscript-9.19 to be able to use in my android application to convert eps document to pdf. It fails while configure. Here are the logs
checking whether to enable maintainer-specific portions of Makefiles...
no
checking for gcc... arm-linux-androideabi-gcc --
sysroot=/<path>/android-ndk-
r11c/platforms/android-17/arch-arm/
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in
`/<path>/ghostscript-9.19/tiff-config':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
configure: error: libtiff configure script failed
This is the build file I am running
#!/bin/sh
# Compiles ghostscript for Android
# Make sure you have NDK_ROOT defined in .bashrc or .bash_profile
INSTALL_DIR="`pwd`/app/jni/gs"
SRC_DIR="`pwd`/../ghostscript-9.19"
cd $SRC_DIR
export
PATH="/<path>/android-ndk-r11c/toolchains/arm-
linux-androideabi-4.9/prebuilt/darwin-x86_64/bin:$PATH"
export SYS_ROOT="/<path>/Android/android-ndk-
r11c/platforms/android-17/arch-arm/"
export CC="arm-linux-androideabi-gcc --sysroot=$SYS_ROOT"
export LD="arm-linux-androideabi-ld"
export AR="arm-linux-androideabi-ar"
export RANLIB="arm-linux-androideabi-ranlib"
export STRIP="arm-linux-androideabi-strip"
mkdir -p $INSTALL_DIR
./configure --host=arm-linux-androideabi --build=x86_64-apple-darwin
--prefix=$INSTALL_DIR LIBS="-lc -lgcc"
make PREFIX=$INSTALL_DIR
make install DESTDIR=$INSTALL_DIR
exit 0
I am using --host=arm-linux-androideabi. What host should i use? What do I need to change in ghostScript project to make compile in successfully?
Any help is highly appreciated.
Cross compiling Ghostscript is pretty involved, partly because the Ghostscript build relies on building and running interim tools (genarch, genconf, mkromfs and echogs) which, obviously, must be built with the native compiler, rather than the cross compiler.
I think the problem you are seeing is because the call to the libtiff configure doesn't pass on the required options.
You may be better served grabbing, and tweaking the two files (a makefile and a header) from this commit:
Makefile for Android MuPDF libgs.so
and tweaking it to match your requirements.
There is a basic guide of what to do for cross compiling at the bottom of this page:
Ghostscript FAQ
I have a "project" to improve support for cross compiling, but it is slow going at the moment.
My final goal is to be able to profile native code (C++) in android environments using gperftools.
My environment/Tools:
ubuntu 14.04
crystax-ndk-10.2.1
gcc-4.8.4
gperftools-2.4
(1)
I followed through this to make a standalone toolchain for later use:
Cross compiling for arm using crystax NDK
command:
./build/tools/make-standalone-toolchain.sh --system=linux-x86_64 --toolchain=arm-linux-androideabi-4.8 --platform=android-8 --install-dir=$HOME/my-android-toolchain
(2)
Thankfully, I found a script that will simplify the ./configure work:
https://gist.github.com/nddrylliog/4688209
and just modified it a bit (put in gperftools-2.4 folder):
#!/bin/sh
export DEV_PREFIX=$HOME
export ANDROID_NDK=${DEV_PREFIX}/crystax-ndk-10.2.1/
export CROSS_COMPILE=arm-linux-androideabi
export ANDROID_PREFIX=$HOME/my-android-toolchain
export SYSROOT=${ANDROID_NDK}/platforms/android-8/arch-arm
export CROSS_PATH=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
export CPP=${CROSS_PATH}-cpp
export AR=${CROSS_PATH}-ar
export AS=${CROSS_PATH}-as
export NM=${CROSS_PATH}-nm
export CC=${CROSS_PATH}-gcc
export CXX=${CROSS_PATH}-g++
export LD=${CROSS_PATH}-ld
export RANLIB=${CROSS_PATH}-ranlib
# export PREFIX=${DEV_PREFIX}/android/prefix
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include -I${DEV_PREFIX}/android/bionic"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} "$#"
(3)
And then I actually do the ./configure and make install:
I put this script in gperftools-2.4 folder and run it:
cd gperftools-2.4
./android_configure.sh --enable-frame-pointers --prefix=$(pwd)
sudo make && make install
cd ..
Result:
The above gives me this error:
src/static_vars.cc: In function 'void tcmalloc::SetupAtForkLocksHandler()':
src/static_vars.cc:119:39: error: 'pthread_atfork' was not declared in this scope
CentralCacheUnlockAll); // child calls after fork
I would appreciate if anyone could leave me some advice on this.
Extra:
I know there is a android-ndk-profiler but since I use CMake for the cross-compilation and I'm not quite sure how to mess with the Android.mk so at the moment I will try to use gperftools which works fine in linux build.
This is because pthread_atfork appeared in Android libc (Bionic) only from Android 5.0. In CrystaX NDK, not all API are replaced by libcrystax, in particular, all pthread_xxx API reside in libc. So the only way as of now to do what you want is either use android-21 as minimal platform, or modify gperftools sources, avoiding usage of pthread_atfork.
BTW, we're working on moving all pthread_xxx API into libcrystax, so I expect all such API will be available soon even for earlier Android versions.
I am trying to import some third party module like pygoogle in my app when i run app in computer using kivy it works fine but when i make apk using buildozer it crashes every time then i find that i have to go in python-for-android and run this command to include module ./distribute.sh -m "pil ffmpeg kivy" but i still get error that
root#kali:~# cd ~/.buildozer/android/platform/python-for-android
root#kali:~/.buildozer/android/platform/python-for-android# ls
COPYING dist docs README.rst src
cythonizer.py distribute.sh LICENSE recipes tools
root#kali:~/.buildozer/android/platform/python-for-android# ./distribute.sh -m "pil ffmpeg kivy"
Check build dependencies for Kali
Avoid check build dependencies, unknow platform Kali
Check environment
No ANDROIDSDK environment set, abort
root#kali:~/.buildozer/android/platform/python-for-android#
I am using KAli Linux and please solve this someone ...it will be very helpfull to me
Try pasting the pygoogle folder in your app's directory, at the same level as main.py. Also, from the error, it looks like you need to set the ANDROIDSDK environment variable. See the docs.
I had a similar problem, and simply setting the ANDROIDSDK environment variable didn't sort it, but the following did.
Try the following and then run the ./distribute.sh -m "pil ffmpeg kivy" command from the same terminal(as the environment vars will only have been set for that terminal and any child processes), or alternatively, add these lines to your ~/.bashrc file for them to be permanent:
export ANDROIDSDK=/path/to/android-sdk
export ANDROIDNDK=/path/to/android-ndk
export ANDROIDNDKVER=rX
export ANDROIDAPI=X
# example
export ANDROIDSDK="/home/tito/code/android/android-sdk-linux_86"
export ANDROIDNDK="/home/tito/code/android/android-ndk-r7"
export ANDROIDNDKVER=r7
export ANDROIDAPI=14
Examples taken from here. I recommend having a look.
I am facing issues in building the android kernel. I tried the following steps from the following link ( http://source.android.com/source/building-kernels.html )
I donot have the AOSP. I am just trying to compile the kernel
Source: git clone https://android.googlesource.com/kernel/goldfish.git
I placed the tool chain in the following directory
/home/chid/goldfish/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6/bin
I set the path as follows
export PATH=$(pwd)/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6/bin:$PATH
pwd: /home/chid/goldfish
set the environment variables as follows.
export ARCH=x86
export SUBARCH=x86
export CROSS_COMPILE=i686-linux-android-
setup the config file as
make arch=x86 goldfish_defconfig
gave make as follows.
make -j6
But it tells me a "cannot find" error.
Error:
/home/chid/goldfish/scripts/gcc-version.sh: line 25: /home/chid/goldfish/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6/bin/i686-linux-android-gcc: No such file or directory
Can you tell me what I am missing? I ensured that the above mentioned file is present and the path is set correctly. Is there something else I need to take care of?
You got the toolchain as the following?
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6
Have you tried to launch gcc directly?
$ /home/chid/goldfish/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6/bin/i686-linux-android-gcc
How about ldd?
$ ldd /home/chid/goldfish/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6/bin/i686-linux-android-gcc
In vagrant precise32 Ubuntu image, no problems at all.
$ ldd i686-linux-android-4.6/bin/i686-linux-android-gcc
linux-gate.so.1 => (0xb77c7000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7619000)
/lib/ld-linux.so.2 (0xb77c8000)
$ i686-linux-android-4.6/bin/i686-linux-android-gcc
i686-linux-android-gcc: fatal error: no input files
compilation terminated.
$ sh goldfish/scripts/gcc-version.sh i686-linux-android-4.6/bin/i686-linux-android-gcc
0406
You might need to have another Linux environment to execute gcc.