[zeromq-dev] Issue linking ZMQ static library into shared library for Android

Joe McIlvain joe.eli.mac at gmail.com
Fri Mar 6 19:40:03 CET 2015


Unfortunately, I don't remember the details of the problems I was having
with the Android.mk - based build, but I ended up deciding it was a better
idea (and more compatible with the way Qt apps build) to use a bash script
that simply invokes an autotools-based build with the right flags rather
than trying to duplicate all the relevant information from the
autoconf/automake scripts into the Android.mk script.

Again, you should be able to run the builds/qt-android scripts without
needing any Qt-related tools - it's just an android build system designed
to be *compatible* with a Qt app, rather than a build system that is
actually coupled to the Qt build systems.  So I'd be curious what the
result would be if you tried to use that build system instead.

On Fri, Mar 6, 2015 at 10:25 AM, Matthias Brzezinski <
Matthias.Brzezinski at gmx.de> wrote:

>  Hey Joe,
> thank you for your answer.
> I've looked through your script and it helped me verifying that I did not
> miss a flag, a step or something i was not considering yet.
> Generally it doesn't matter if I compile a static or a shared library -
> The NDK uses its own linker to link the prebuilt libraries.
> Am 06.03.2015 um 18:17 schrieb Joe McIlvain:
>  Matthias,
>  I don't usually compile them as static, but you may be able to get some
> ideas/help from using or looking at the scripts I added under
> `builds/qt-android`of the zeromq repository.  I use these to compile for
> use with Qt on android, but there's nothing really Qt-specific about them.
> I only added them because the android scripts didn't work for me.  They
> didn't seem to be
> The syntax for the android makefiles are a bit different, but I used the
> same flags as far I can see. Hence, I never worked with qt before.
> What exactly didn't work with the android scripts? Did you have problems
> getting the NDK to work generally, or just the NDK in combination with
> ZeroMQ? I hope for the first, because it would be a mess if I wouldn't find
> a way to use ZeroMQ with native code and the NDK where for example the
> protobuf library compiled on the first try.
> With regards,
> Matthias
>  maintained, but I didn't want to clobber something that someone out
> there might be relying on.
>  I don't know a lot about the android toolchain because working with Qt
> hides a lot of the platform-specific stuff from me, but I learned just
> enough about the toolchain to make those scripts work and get them into the
> CI for the repository.
> On Fri, Mar 6, 2015 at 6:30 AM, Matthias Brzezinski <
> Matthias.Brzezinski at gmx.de> wrote:
>>  Hey,
>> I'm having issues linking ZeroMQ into my shared library for Android.
>> I followed the steps on http://zeromq.org/build:android to build the
>> static library. I tried it with the recommended NDKr8 but also tried it
>> with the NDK10d. I've build the static library for arm with the official
>> ndk-toolchain.
>> Afterwards I try to link thoose libraries into my shared library to
>> compile a bunch of cpp files.
>> I've successfully compiled and linked different static libraries into my
>> projects so I'm pretty confused why the linker throws the Error when I work
>> with ZeroMQ. I've omitted the other working libraries.
>> My Android.mk:
>>     http://pastebin.com/N7gueqre
>> My Application.mk:
>>     http://pastebin.com/nNgCYM2F
>> In both code blocks I've ommited everything that is not necessary for
>> solving this issue. The error message stays the same. I've tried to build
>> the shared library under windows and later under debian and ubuntu. The
>> error message is:
>> /tmp/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld:
>> error: ./zmq/lib    /libzmq.a(libzmq_la-zmq.o): incompatible target
>>     collect2: error: ld returned 1 exit status
>>     make: *** [obj/local/armeabi/libzmqTest.so] Error 1
>> (I guess 3 lines are not worth a pastebin)
>> I'm working on Windows 8.1 with Android Studio 1.1. I've compiled the
>> libraries under Linux Mint 16, a up-to-date ubuntu system and an old debian
>> server.
>> I build zeromq3-x and zeromq4-x.
>> Any idea is welcome and appreciated.
>> If this is not the right place to ask such a question, please tell me
>> where to ask it instead.
>> With regards,
>> Matthias
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing listzeromq-dev at lists.zeromq.orghttp://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150306/3673006f/attachment.htm>

More information about the zeromq-dev mailing list