How to setup Facebook Redex in order to optimize Android Bytecodes? - android

There is a very good instruction in Redex page at http://fbredex.com/.
I follow the instruction but I have problem in two steps.
1.I have no problem with run of first command (my OS is Ubuntu)
sudo apt-get install \
g++ \
automake \
autoconf \
autoconf-archive \
libtool \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
libgflags-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
libiberty-dev
I clone folly repo somewhere on my laptop
I go to the directory by $ cd android/projects/folly/folly/
I run git submodule update --init but nothing happens. I even run this command in $ cd android/projects/folly/ but nothing happens either.
I run autoreconf -ivf && ./configure && make && make install. Seems works as I see process takes around a minute or two and there are a lot og messages print out.
I copy/paste a sample .apk file to my Desktop and run redex ~/Desktop/my_android_app.apk -o ~/Desktop/my_android_app-redexed.apk. However, I'm getting this message on terminal.
No command 'redex' found, did you mean: Command 'redet' from package
'redet' (universe) redex: command not found
I ran above command when I am in /home/hesam/android/projects/folly/folly or /home/hesam/android/projects/folly/. But I get same output.
Update
I cloned Redex repo and followed Bert's Instruction. It works and I could see something is happening by running git submodule update --init. So thanks to Bert. However, I got error at the end of autoreconf -ivf && ./configure && make && make install command.
Please have a look at following output:
Making all in unit
make[3]: Entering directory `/home/hesam/android/projects/redex/test/unit'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/hesam/android/projects/redex/test/unit'
make[2]: Leaving directory `/home/hesam/android/projects/redex/test'
make[1]: Leaving directory `/home/hesam/android/projects/redex'
Making install in third-party/folly/folly
make[1]: Entering directory `/home/hesam/android/projects/redex/third-party/folly/folly'
Making install in .
make[2]: Entering directory `/home/hesam/android/projects/redex/third-party/folly/folly'
make[3]: Entering directory `/home/hesam/android/projects/redex/third-party/folly/folly'
/bin/mkdir -p '/usr/local/lib'
/bin/bash ./libtool --mode=install /usr/bin/install -c libfolly.la libfollybenchmark.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libfolly.so.57.0.0 /usr/local/lib/libfolly.so.57.0.0
/usr/bin/install: cannot create regular file '/usr/local/lib/libfolly.so.57.0.0': Permission denied
make[3]: *** [install-libLTLIBRARIES] Error 1
make[3]: Leaving directory `/home/hesam/android/projects/redex/third-party/folly/folly'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/hesam/android/projects/redex/third-party/folly/folly'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/hesam/android/projects/redex/third-party/folly/folly'
make: *** [install-recursive] Error 1
hesam: redex (master) $ redex ~/Desktop/my_android_app.apk -o ~/Desktop/my_android_app-redexed.apk
No command 'redex' found, did you mean:
Command 'redet' from package 'redet' (universe)
redex: command not found
hesam: redex (master) $

You don't need to separately clone folly; it's included as a submodule of redex. Just do:
git clone https://github.com/facebook/redex.git
cd redex
git submodule update --init
and then configure/make according to the instructions.

there is a difference regard instructions you see in fbredex and what you see in Github redex page. Please follow what Github page says for make and install.
autoreconf -ivf && ./configure && make
sudo make install
Regard my above problem, A developer from Redex team called me and after few minutes he found and solved the problem. He has updated FAQ section on Redex page that you can see at here. Since there is no explanation there I copy/paste what he said on chat.
So, as an optimization, the runtime linker doesn't actually go
trawling through everything to look for libs anymore It uses the cache
file, which is generated by ldconfig
Update
I forgot to mention that you must have ANDROID_SDK in your PATH. I have following paths in my .profile. Don't forget to source it after making change in it. ~/android/sdk is path to my Android SDK directory.
export ANDROID_HOME=~/android/sdk
export ANDROID_SDK=${ANDROID_HOME}
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Related

ubuntu 15.10 64bit build Android source 5.0 version

How can I fix this problem?When I was building the Android source of 5.0 with
'make -j4', it was causing a problem.
This is the error log:
Install: out/host/linux-x86/bin/acp
Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y
prebuilts/misc/linux-x86/bison/bison -d -o out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/EventLogTags.java <= frameworks/base/core/java/android/content/EventLogTags.logtags
prebuilts/misc/linux-x86/bison/bison: m4 子进程失败
build/core/binary.mk:539: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp' failed
make: *** [out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 1
make: *** 正在等待未完成的任务....
frameworks/base/tools/aidl/aidl_language_l.l:55: warning, 无法匹配规则
flex-2.5.39: fatal internal error, exec of /usr/bin/m4 failed
build/core/binary.mk:576: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp' failed
make: *** [out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 1
make: *** Deleting file 'out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp'
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/speech/tts/EventLogTags.java <= frameworks/base/core/java/android/speech/tts/EventLogTags.logtags
In my case, I get similar error when build Marshmallow 6.0.1_r1 in Ubuntu 18.04.
If you get similar errors like this:
build/core/binary.mk:646: recipe for target 'out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp' failed
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Aborted (core dumped)
Look at the line carefully, it's a core dumped, so I use coredumpctl list, navigate to the end of list with G, then figure out the core dump executed path (right column) is prebuilts/misc/linux-x86/flex/flex-2.5.39
And the PREBUILT file shows:
xb#dnxb:~/my_android_src/prebuilts/misc/linux-x86/flex$ cat PREBUILT
The objects in this prebuilt directory can be rebuilt
using the source archive hosted at
http://sourceforge.net/projects/flex/files/
Commands:
./configure
make CFLAGS="-static" LDFLAGS="-static"
# (Disregard the errors at the end of the build)
rm flex
make CFLAGS="-static" LDFLAGS="-static" flex
# Copy the linker command line, replace it with static libm.a
gcc -static -static -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o /usr/lib/x86_64-linux-gnu/libm.a
xb#dnxb:~/my_android_src/prebuilts/misc/linux-x86/flex$
That's it, the first 2 lines said that you probably need to rebuild yourself if something went wrong since this flex-2.5.39 binary is prebuilt in another platform.
So simply untar the flex-2.5.39.tar.gz of this directory, go to the extracted flex-2.5.39 directory, then follows the PREBUILT instruction above.
In short, you need to do the following steps:
cd <ANDROID_TREE_DIR>/prebuilts/misc/linux-x86/flex
tar -zxvf flex-2.5.39.tar.gz
cd flex-2.5.39
make CFLAGS="-static" LDFLAGS="-static"
rm flex
make CFLAGS="-static" LDFLAGS="-static" flex
/bin/bash ./libtool --tag=CC --mode=link gcc -static -static -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o lib/libcompat.la /usr/lib/x86_64-linux-gnu/libm.a
cd ..
cp flex-2.5.39/flex .
mv flex flex-2.5.39
ls -la
flex-2.5.39 #### <<- YOUR new generated file
flex-2.5.39.tar.gz
MODULE_LICENSE_BSD_LIKE
NOTICE
PREBUILT
Now try to do make <module> -j4 again, no longer abort on such error.
p/s: Alternative way will be LANG=C make pm -j4 if you see something like LC_* error message.
p/s2: I also need symlink ld as below to fixed 'out/host/linux-x86/obj/lib/libart.so' failed and error: unsupported reloc 42:
xb#dnxb:~/my_android_src$ cp prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8//x86_64-linux/bin/ld ../ld_bk #backup android source's ld first
xb#dnxb:~/my_android_src$ rm prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8//x86_64-linux/bin/ld #remove android source's ld
xb#dnxb:~/my_android_src$ ln -s /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8//x86_64-linux/bin/ld #create symlink for android source's ld to system's ld.gold
Check carefully you have all the required packages installed https://source.android.com/source/initializing.html

Creating APK from Kivy on Mac OS X fails after compile

My background is in HTML/JS, so compiling is new for me. While attempting to build my python project in Kivy to an Android .apk, I am getting an error I do not understand:
Command failed: ./distribute.sh -m "kivy"
Here is a portion of the tail end of the debug output...
Compiling /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/xmllib.py ...
Compiling /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/xmlrpclib.py ...
Compiling /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/zipfile.py ...
make: [libinstall] Error 1 (ignored)
PYTHONPATH=/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7 LD_LIBRARY_PATH=/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python/Python-2.7.2: \
/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python/Python-2.7.2/hostpython -Wi -t /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/compileall.py \
-d /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages -f \
-x badsyntax /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages
Listing /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages ...
PYTHONPATH=/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7 LD_LIBRARY_PATH=/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python/Python-2.7.2: \
/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python/Python-2.7.2/hostpython -Wi -t -O /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/compileall.py \
-d /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages -f \
-x badsyntax /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages
Listing /Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages ...
PYTHONPATH=/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7 LD_LIBRARY_PATH=/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python/Python-2.7.2: \
/Users/Travis/buildozer/.buildozer/android/platform/python-for-android/build/python/Python-2.7.2/hostpython -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
Leaving ARM environment
cp: build/lib.linux-x86_64-2.7/_ctypes*.so: No such file or directory
# Command failed: ./distribute.sh -m "kivy" -d "myapp"
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
Here is the full debug, for those who want it...
https://www.dropbox.com/s/45lgdhk5y4uj8eg/KivyDebug.txt?dl=1
Also, my buildozer.spec file...
https://www.dropbox.com/s/g5p43jjts49rzza/buildozer.spec?dl=1
EDIT: Downgrading Cython per the advice HERE did not help.
EDIT2: Tried changing requirements to kivy==master. No luck.
EDIT3: Tried chmod -R 777 on both source and buildozer folders. No luck.
OK, I came across the answer to my own problem a while ago and I'm posting it here in case someone else makes the same boneheaded mistake. Basically, I did not read the instructions carefully enough in the documentation. The instructions clearly state "navigate to your project directory and run: buildozer init". I did not navigate to the project folder. I was building in my user directory, hence "/Users/Travis/". Hence the "No such file or directory" error.
You may be asking "How do you expect buildozer to know where your project is?"
Well, the next step says to configure "buildozer.spec", and in there, there is a place to put your path to the main.py, which by default is ".", so I changed that. It actually worked up to the point that it has to write any files.
So, if you're having the same issue as me, you might just need to read more carefully.

Building PJSIP: "Make dep" command giving error on Windows7

I have followed all the steps written in the pjsip-startup guide.
But the last step (make dep && make clean && make) is giving me the following errors. I am on Windows 7.
$ make dep && make clean && make
for dir in pjlib/build pjlib-util/build pjnath/build third_party/build pjmedia/b uild pjsip/build pjsip-apps/build ; do \
if make -C $dir dep; then \
true; \
else \
exit 1; \
fi; \
done
make[1]: Entering directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
make -f /cygdrive/d/android/pjproject-2.2.1/build/rules.mak APP=PJLIB app=pjlib depend
make[2]: Entering directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
.pjlib-arm-unknown-linux-androideabi.depend:1: *** multiple target patterns. St op.
make[2]: Leaving directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
Makefile:88: recipe for target 'depend' failed
make[1]: *** [depend] Error 2
make[1]: Leaving directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
Makefile:14: recipe for target 'dep' failed
make: *** [dep] Error 1
Can someone help me to resolve these errors? Thanks!
After some research I come to know that don't use WINDOWS for building the PJSIP v2.x version. Now I am going to install Ubuntu on my system.
The build system is known to work on the following hosts:
Linux, many types of distributions.
MacOS X 10.2 mingw (Win2K, XP)
FreeBSD (must use gmake instead of make)
Building Win32 applications with Cygwin is currently not supported by the autoconf script (there are some conflicts with Windows headers), but one can still use the old configure script by calling ./configure-legacy. More over, cross-compilations might also work with Cygwin using this build system.
See the link for details.

How to compile clk, the Android bootloader?

https://github.com/n0d3/lk – this is the repository holding source code for clk 1.5, which is a bootloader for Android and which I am trying to compile. Compiled packages can be found; however, I need to customize it. How can I compile it?
Running make returns the following:
$ make
makefile:22: *** No project specified. Use "make projectname" or put "PROJECT := projectname" in local.mk. Stop.
Running make htcleo returns the following:
$ make htcleo
make[1]: Entering directory '/cygdrive/c/Users/Domas/lk'
make[1]: arm-eabi-gcc: Command not found
LIBGCC =
CFLAGS = -O2 -g -fno-builtin -finline -W -Wall -Wno-multichar -Wno-unused-parameter -Wno-unused-function -include ./build-htcleo/config.h -ffunction-sections -fdata-sections -mlittle-endian -mfpu=neon -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mthumb -D__thumb__
including app/aboot dev/battery dev/fbcon dev/keys lib/debug lib/devinfo lib/heap lib/libc lib/ptable
generating build-htcleo/config.h
compiling arch/arm/start.S
make[1]: arm-eabi-gcc: Command not found
arch/arm/compile.mk:30: recipe for target 'build-htcleo/arch/arm/start.o' failed
make[1]: *** [build-htcleo/arch/arm/start.o] Error 127
make[1]: Leaving directory '/cygdrive/c/Users/Domas/lk'
makefile:15: recipe for target 'make-make' failed
make: *** [make-make] Error 2
As you can see the make breaks on make[1]: arm-eabi-gcc: Command not found. I was able to compile an older version (which had a different compilation process) by using a CodeSourcery toolchain, which has arm-none-eabi-gcc.exe, but not arm-eabi-gcc.exe, which seems to be needed to compile this version.
Note:
I appreciate that this might not be a popular type of question here on SO; however, I've been banging my head on this one the whole day, and could really use some guidance.
I managed to compile it. What I did was find a git repository that had a compilation script and some additional files for compilation along side the source code, but it was the old source code. So I downloaded this project, and replaced the source code with a recent one, and the compilation script worked. Below instructions, most of it is copy paste from xda forums:
Download this zip archive here: https://github.com/cedesmith/cLK/archive/master.zip
It's the old source code, but it has the necessary scripts to make compilation easy.
Unzip the archive so that the compile script's path is ~/cLK/compile
Delete the ~/cLK/lk subdirectory (this is the old source code).
Download the new source code: git clone https://github.com/n0d3/lk
Now you should have the new source code in ~/cLK/lk. On to the actual compilation: this will depend on whether you're on Linux or Windows:
Linux
on Debian:
sudo apt-get update
sudo apt-get install gcc make git wget unzip zip libc6-dev-amd64 libc6-dev
on Fedora:
yum install gcc make git wget unzip zip
Now download the CodeSourcery toolchain:
wget http://www.codesourcery.com/sgpp/lite/arm/portal/package5353/public/arm-none-eabi/arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
tar xvfj arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
export PATH=$HOME/clk/arm-2009q3/bin:$PATH
Finally, compile:
cd ~/cLK
./compile clean
If everything goes well, you'll find the RUU_signed in this folder: bin/RUU_signed.nbh
Windows
You'll need Cygwin:
Download, the following file, and execute it http://www.cygwin.com/setup.exe
Click Next
Click "Install from internet" and click Next
Click Next (to accept the default directory to install)
Click Next (to accept the default directory for local Package directory)
Click "Direct Connection", and click Next
Select a "local mirror", and click Next
Now in the search bar, you need to search for the following things to install
gcc
make
git
wget
zip
unzip
Once selected click Next to continue, and Finish
Fire up the cygwin terminal (mintty); the following commands probably don't work in cmd.exe.
Now download CodeSourcery toolchain and yang:
wget http://www.codesourcery.com/sgpp/lite/arm/portal/package5354/public/arm-none-eabi/arm-2009q3-68-arm-none-eabi-i686-mingw32.tar.bz2
tar xvfj arm-2009q3-68-arm-none-eabi-i686-mingw32.tar.bz2
wget http://htc-flasher.googlecode.com/files/yang-1.1_win32.zip
cd cLK/bin
rm -rf yang
mkdir yang
unzip ../../yang-1.1_win32.zip yang/yang.exe
mv yang/yang.exe .
cd ..
sed -i s/yang/yang.exe/g compile
And finally, compile:
export PATH=$HOME/arm-2009q3/bin:$PATH
cd ~/cLK
./compile clean
Now your RUU_signed.nbh will be located in the following folder bin/RUU_signed.nbh

Cross Compiling libevent for Android

I'm stuck trying to cross-compile libevent to Android and I'd like to know what I'm doing wrong and get some assistance.
The version I'm trying to build is libevent-2.0.19-stable
I started following the steps described at http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/ and how to rewrite the Makefile into android.mk?
The Target Device is a Samsung Galaxy S2 running cyanogenMod 7
After several attempts, the best I did was by running the following steps:
1) Install android NDK and download libevent source code
2) Android NDK downloaded and running in ~/android-ndk/android-ndk-r8b
3) Execute:
export ANDROID_ROOT=~/android-ndk/android-ndk-r8b
export PATH=$PATH:$ANDROID_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/
You need to export the ABI for your device. armeabi-v7a is for devices with ARMv7 or above, any other device uses armeabi.
4) Execute ./configure with the appropriate parameters:
./configure \
--host=arm-linux-androideabi \
CC=arm-linux-androideabi-gcc \
LD=arm-linux-androideabi-ld \
CPPFLAGS="-I$ANDROID_ROOT/platforms/android-8/arch-arm/usr/include/" \
CFLAGS="-nostdlib" \
LDFLAGS="-Wl,-rpath-link=$ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/ -L$ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/" \
LIBS="-lc"
There was a warning in the meantime:
configure: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used
(I assume it's fine)
As it didn't recognise arm-linux-androideabi as a host, I got a new config.guess and config.sub from http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree (indicated in the previous thread in Stack Overflow)
At this point, when building the source code running "make", it still crashes:
/home/narseo/android-ndk/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: crtbegin_so.o: No such file: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [libevent.la] Error 1
make[2]: se sale del directorio «/home/narseo/libevent-source/libevent-2.0.19-stable»
make[1]: *** [all-recursive] Error 1
make[1]: se sale del directorio «/home/narseo/libevent-source/libevent-2.0.19-stable»
make: *** [all] Error 2
However, the file seems to be there:
~/android-ndk$ ls $ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib
crtbegin_dynamic.o libc.a libjnigraphics.so libstdc++.so
crtbegin_so.o libc.so liblog.so libthread_db.so
crtbegin_static.o libdl.so libm.a libz.so
crtend_android.o libGLESv1_CM.so libm.so
crtend_so.o libGLESv2.so libstdc++.a
Is there anything I'm doing wrong when running ./configure? Something else I didn't understand even looking at Android's NDK documentation was whether it was mandatory to create an Android.mk or if Makefile was sufficient
Any help will be very welcome!
Cheers
N
Note
This is how I managed to solve it in the end:
Initial PATH:
export ANDROID_ROOT=~/android-ndk/android-ndk-r8b
export PATH=$PATH:$ANDROID_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/
export PATH=$PATH:$ANDROID_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/include/
The errors seem to occur in the linking phase so as it cannot find crtend_so.o and crtbegin_so.o. Following crtbegin_so.o missing for android toolchain (custom build), we add a sym link to them in the source folder
cd source && ln -s $ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/crtbegin_so.o
ln -s $ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/crtend_so.o
The ./configure command:
./configure \
--host=arm-linux-androideabi \
CC=arm-linux-androideabi-gcc \
LD=arm-linux-androideabi-ld \
CPPFLAGS="-I$ANDROID_ROOT/platforms/android-8/arch-arm/usr/include/" \
CFLAGS="-nostdlib" \
LDFLAGS="-Wl,-rpath-link=$ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/ -L$ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/" \
LIBS="-lc"
If it fails as it does not recognize system androideabi, try to get newer versions of config.sub and config.guess
It used to crash in the linking phase. Including -lgcc on the CFLAGS solved the issue.
This project builds libevent as a static library on Android here: https://github.com/ventureresearch/libevent
It includes the Android.mk and generated config files to build it cleanly.
Note that we are building it for inclusion into an Android device image, and NOT building through the NDK. It would probably still be a good place to start.
Try this
./configure --host=arm-linux-androideabi CC="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=$SYSROOT" CFLAGS='-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16'
It works for me.
Try with below configurations:
ANDROID_SYSROOT=$ANDROID_ROOT/platforms/android-8/arch-arm/
./configure --host=arm-linux-androideabi CFLAGS=--sysroot=$ANDROID_SYSROOT LDFLAGS=--sysroot=$ANDROID_SYSROOT

Categories

Resources