How to cross compile libupnp for android

  • sandy

    sandy - 2010-11-25

    Am working over the cross compilation of libupnp for android but in configuration it gave me some problems but by enabling flags etc its configure working fine but atlast its giving me an error for pthreads handling. Can anyone suggest me how to solve this and ids libupnp having android support…….

  • Marcelo Roberto Jimenez


    I have no android here, but maybe you could post the results of your configuration or compilation to see if we can help.

  • sandy

    sandy - 2010-11-25

    Yeah this is what am doing. First am configuring using these flags
    ./configure -host=arm-eabi CC=arm-eabi-gcc CPPFLAGS="-I/home/pcs/android-ndk-r4b/build/platforms/android-8/arch-arm/usr/include/" CFLAGS="-nostdlib /home/pcs/android-ndk-r4b/build/platforms/android-8/arch-arm/usr/lib/crtbegin_dynamic.o" LDFLAGS="-Wl,-rpath-link=/home/pcs/android-ndk-r4b/build/platforms/android-8/arch-arm/usr/lib/ -L/home/pcs/android-ndk-r4b/build/platforms/android-8/arch-arm/usr/lib/" LIBS="-lc"

    Till the stage of pthread stuff its working fine but after this i found an error like this
    ------------------ pthread stuff -------------------------
    checking for the pthreads library -lpthreads… no
    checking whether pthreads work without any flags… yes
    checking for joinable pthread attribute… PTHREAD_CREATE_JOINABLE
    checking if more special flags are required for pthreads… no
    --------------- pthread_rwlock_t stuff ---------------------
    no, needs to fallback to pthread_mutex
    configure: error: pthread_rwlock_t not available

    In configure log file its showing like this
    error: pthread_rwlock_t not available

    Do you have any idea about  this……………

  • sandy

    sandy - 2010-11-25

    Then rwlock_t functionality is implemented in 1.6.1 version so am trying to compile 1.6.0 version, there the configure step is working fine. But once if i give make error is
    common/upnp_tv_ctrlpt-sample_util.o: In function `SampleUtil_Initialize':
    sample_util.c:(.text+0x9dc): undefined reference to `pthread_mutexattr_setkind_np'

    Its only the problem in sample folder so what i thought is to omit the sample folder and compile it then its working fine and its creating the output binary
    And Robert sorry to dump all my questions on you now the problem is i got an output executable wright so how can i use this in android. Its not something like application to execute it directly. Where i need to copy this library file in(in sense which path) how can i use it from applications

  • Marcelo Roberto Jimenez

    Hi Sandy,

    Sorry for the delay to answer.

    In your configure question, I believe there is a problem with the C library you are using and the pthread implementation. glibc should work, but as you are using an ARM toolchain, you should check with the C library for the pthread implementation.

    For your next question, you have to "make install" the library. If you do not specify an install directory at configure time, it will probably get installed in /usr/local/lib. From there on, you should be able to compile programs. But again, as you are using a cross compiler, you should probably specify an installation directory for the ARM version of the library, something like:

    $ ./configure -prefix=/usr/local/arm/libupnp


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks