Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8934921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:53:01+00:00 2026-06-15T09:53:01+00:00

I’m stuck trying to cross-compile libevent to Android and I’d like to know what

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:53:02+00:00Added an answer on June 15, 2026 at 9:53 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.