Compilling Pidroid for Android.

293 views
Skip to first unread message

Krzysztof Klinikowski

unread,
Nov 27, 2010, 12:29:16 PM11/27/10
to android-ndk, dtba...@csclub.uwaterloo.ca
Okay. I want to start writting UI for Pidroid (http://
csclub.uwaterloo.ca/~dtbartle/pidroid/) but I have problem with
compilling it properly. So how I'm doing it? Simply:

1. First I define new PATH to use arm-eabi-gcc and scripts for pidroid
from ./pidroid/cmds (mydroid is a compiled android platform, version
2.2)

export PATH=$PATH:/home/kkszysiu/Pobrane/pidgin_android/pidroid/cmds/:/
home/kkszysiu/Pobrane/android-sdk-linux_86/tools/:/home/kkszysiu/
mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/

Later I just type make in the pidroid dir and it compiled well, I just
made one small change in ./pidroid/libpidroid/libpidroid.h, changing:

#include <utils/IBinder.h>
#include <utils/IServiceManager.h>
#include <utils/Parcel.h>

To:

#include <binder/IBinder.h>
#include <binder/IServiceManager.h>
#include <binder/Parcel.h>

Because binder is a standalone library now.

Now in ./pidroid/assets I have libtarxz.so and pidroid.tar.xz.
I got apk file too but when I upload it into emulator/phone I always
got in adb logcat:

D/PidroidApp( 374): [BuddyList.onCreate]
D/PidroidApp( 374): [PidroidApp.connectPidroidService]
D/PidroidApp( 374): [PidroidApp.connectService]: about to bind
D/PidroidApp( 374): [BuddyList.refreshProgressIcon]
D/PidroidService( 374): [onBind]
E/PidroidService( 374): [installAssets]
D/PidroidApp( 374):
[PidroidApp.mPidroidServiceConn.onServiceConnected]
D/dalvikvm( 374): Trying to load lib /data/data/org.pidroid/
app_assets/libtarxz.so 0x43e379f8
I/dalvikvm( 374): Unable to dlopen(/data/data/org.pidroid/app_assets/
libtarxz.so): Cannot load library: find_library[1188]: 33
'libtarxz.so' failed to load previously
E/PidroidService( 374): [installAssets]: failed to load libtarxz.so
I/ActivityManager( 59): Displayed activity
org.pidroid/.app.BuddyList: 831 ms (total 831 ms)
D/PidroidApp( 374): [PidroidApp.mBroadcastReceiver.onReceive]:
org.pidroid.intent.action.CREATE_PURPLE_FAILED
D/PidroidApp( 374): [BuddyList.mBroadcastReceiver.onReceive]:
org.pidroid.intent.action.CREATE_PURPLE_FAILED
D/dalvikvm( 123): GC_EXPLICIT freed 232 objects / 14016 bytes in
118ms
D/SntpClient( 59): request time failed: java.net.SocketException:
Address family not supported by protocol
D/PidroidApp( 374): [BuddyList.onDestroy]
D/PidroidApp( 374): [PidroidApp.disconnectPidroidService]
D/PidroidApp( 374): [PidroidApp.disconnectService]: unbinding
D/PidroidService( 374): [onUnbind]
D/PidroidApp( 374): [PidroidApp.mBroadcastReceiver.onReceive]:
org.pidroid.intent.action.PIDROID_SERVICE_STOPPED

Question is why? And how to make it work. Theres some debug messages:

arm-eabi-objdump -x libtarxz.so | grep NEEDED
NEEDED libc.so
NEEDED libm.so

arm-eabi-ld libtarxz.so -rpath=/home/kkszysiu/mydroid/out/target/
product/generic/system/lib/
arm-eabi-ld: warning: cannot find entry symbol _start; defaulting to
0000829c


arm-eabi-objdump -x libtarxz.so

libtarxz.so: file format elf32-littlearm
libtarxz.so
architecture: arm, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x00001f44

Program Header:
LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align
2**12
filesz 0x0000ae78 memsz 0x0000ae78 flags r-x
LOAD off 0x0000b000 vaddr 0x0000b000 paddr 0x0000b000 align
2**12
filesz 0x0000020c memsz 0x0004263c flags rw-
DYNAMIC off 0x0000b00c vaddr 0x0000b00c paddr 0x0000b00c align
2**2
filesz 0x000000a8 memsz 0x000000a8 flags rw-

Dynamic Section:
NEEDED libc.so
NEEDED libm.so
SYMBOLIC 0x00000000
HASH 0x00000094
STRTAB 0x0000107c
SYMTAB 0x0000056c
STRSZ 0x0000091a
SYMENT 0x00000010
PLTGOT 0x0000b0b4
PLTRELSZ 0x000001f0
PLTREL 0x00000011
JMPREL 0x00001a58
REL 0x00001998
RELSZ 0x000000c0
RELENT 0x00000008
RELCOUNT 0x0000000f
private flags = 4000002: [Version4 EABI] [has entry point]

Sections:
Idx Name Size VMA LMA File off Algn
0 .hash 000004d8 00000094 00000094 00000094 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .dynsym 00000b10 0000056c 0000056c 0000056c 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .dynstr 0000091a 0000107c 0000107c 0000107c 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .rel.dyn 000000c0 00001998 00001998 00001998 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .rel.plt 000001f0 00001a58 00001a58 00001a58 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .plt 000002fc 00001c48 00001c48 00001c48 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
6 .text 00008968 00001f44 00001f44 00001f44 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
7 .rodata 000005c8 0000a8b0 0000a8b0 0000a8b0 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .data.rel.ro 0000000c 0000b000 0000b000 0000b000 2**2
CONTENTS, ALLOC, LOAD, DATA
9 .dynamic 000000a8 0000b00c 0000b00c 0000b00c 2**2
CONTENTS, ALLOC, LOAD, DATA
10 .got 00000148 0000b0b4 0000b0b4 0000b0b4 2**2
CONTENTS, ALLOC, LOAD, DATA
11 .data 00000010 0000b1fc 0000b1fc 0000b1fc 2**2
CONTENTS, ALLOC, LOAD, DATA
12 .bss 00042430 0000b20c 0000b20c 0000b20c 2**2
ALLOC
13 .comment 00000168 00000000 00000000 0000b20c 2**0
CONTENTS, READONLY
14 .ARM.attributes 0000002b 00000000 00000000 0000b374 2**0
CONTENTS, READONLY
SYMBOL TABLE:
no symbols



file libtarxz.so
libtarxz.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV),
dynamically linked, stripped


Any idea what's wrong?


Message has been deleted
Message has been deleted

Doug Kwan (關振德)

unread,
Dec 7, 2010, 7:20:53 PM12/7/10
to andro...@googlegroups.com
You need to install libicuuc somewhere that is visible to the
toolchain. The configuration failed becasue the linker cannot find
the iccuc library.

-Doug

On Tue, Dec 7, 2010 at 3:49 PM, DanielH <googl...@dani.cswpro.de> wrote:
> Well, I didn't get as far as you yet, as compiling stops with this
> error:
>
> configure:3807: checking whether the C compiler works
> configure:3829: arm-none-linux-gnueabi-gcc -I/tmp/org.pidroid/include -
> I/home/dani/mydroid/external/icu4c/common -O2  -L/tmp/org.pidroid/lib -
> Wl,-rpath-link=/tmp/org.pidroid/lib -licuuc conftest.c  >&5
> /home/dani/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/../
> lib/gcc/arm-eabi/4.3.1/../../../../arm-eabi/bin/ld: cannot find -
> licuuc
> collect2: ld returned 1 exit status
> configure:3833: $? = 1
> configure:3871: result: no
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "glib"
> | #define PACKAGE_TARNAME "glib"
> | #define PACKAGE_VERSION "2.27.4"
> | #define PACKAGE_STRING "glib 2.27.4"
> | #define PACKAGE_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?
> product=glib"
> | #define PACKAGE_URL ""
> | #define GLIB_MAJOR_VERSION 2
> | #define GLIB_MINOR_VERSION 27
> | #define GLIB_MICRO_VERSION 4
> | #define GLIB_INTERFACE_AGE 0
> | #define GLIB_BINARY_AGE 2704
> | /* end confdefs.h.  */
> |
> | int
> | main ()
> | {
> |
> |   ;
> |   return 0;
> | }
> configure:3876: error: in `/home/dani/pidroid/third_party/
> glib-2.27.4':
> configure:3878: error: C compiler cannot create executables
>
> How did you avoid this?
>
> By the way, I also had to change the files
> arm-none-linux-gnueabi-g++ and
> arm-none-linux-gnueabi-gcc
> in pidroid/cmds/ like this:
>
> - my $ALIB = "$DROID/out/target/product/generic/obj/lib";
> + my $ALIB = "$DROID/ndk/build/platforms/android-8/arch-arm/usr/lib";
> my $TOOLCHAIN = "$DROID/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1";
>
> Without this, compiling stopped even earlier.
>
> Perhaps you can help me to reach your status.
>
> Krzysztof Klinikowski schrieb:

> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
>
>

Krzysztof Klinikowski

unread,
Dec 8, 2010, 1:22:35 AM12/8/10
to andro...@googlegroups.com
export PATH=$PATH:/home/kkszysiu/Pobrane/pidgin_android/pidroid/cmds/:/
home/kkszysiu/Pobrane/android-sdk-linux_86/tools/:/home/kkszysiu/
mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/

That's really important. You need to know that mydroid is a downloaded
and compiled android platform from where I got a lot of other
libaries.


2010/12/8 Doug Kwan (關振德) <doug...@google.com>:

Krzysztof Klinikowski

unread,
Dec 8, 2010, 4:18:17 AM12/8/10
to andro...@googlegroups.com
I figured out how to make it work too. Propably Android 2.2 version
has changed somthing and backward compatibility beetween 2.1 and 2.2
is just theoretically ;) On Android 2.1 I runned it successfully after
some changes in code but I got some problems beetween C/Java binder
connection ;) "Bad magic number" error or something. Soon I will post
somewhere how to do that and some instructions/howtos and maybe we
find some developers then we made good Android IM that's just suck
less ;)

Regards,
Krzysztof

2010/12/8 Krzysztof Klinikowski <kksz...@gmail.com>:

David Turner

unread,
Dec 8, 2010, 8:06:03 AM12/8/10
to andro...@googlegroups.com
On Wed, Dec 8, 2010 at 7:22 AM, Krzysztof Klinikowski <kksz...@gmail.com> wrote:
export PATH=$PATH:/home/kkszysiu/Pobrane/pidgin_android/pidroid/cmds/:/
home/kkszysiu/Pobrane/android-sdk-linux_86/tools/:/home/kkszysiu/
mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/

That's really important. You need to know that mydroid is a downloaded
and compiled android platform from where I got a lot of other
libaries.

Which means you're probably linking against unstable system libraries. Don't be surprised if things don't work consistently between platforms if you don't use the NDK-provided libraries for linking. 

2010/12/8 Doug Kwan (關振德) <doug...@google.com>:
> You need to install libicuuc somewhere that is visible to the
> toolchain.  The configuration failed becasue the linker cannot find
> the iccuc library.
>
> -Doug
>

Krzysztof Klinikowski

unread,
Dec 8, 2010, 8:15:43 AM12/8/10
to andro...@googlegroups.com
I don't have libraries like MPFR and GMP in NDK so that's pretty hard
to link that from NDK ;)

2010/12/8 David Turner <di...@android.com>:


>
>
> On Wed, Dec 8, 2010 at 7:22 AM, Krzysztof Klinikowski <kksz...@gmail.com>
> wrote:
>>
>> export PATH=$PATH:/home/kkszysiu/Pobrane/pidgin_android/pidroid/cmds/:/
>> home/kkszysiu/Pobrane/android-sdk-linux_86/tools/:/home/kkszysiu/
>> mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/
>>
>> That's really important. You need to know that mydroid is a downloaded
>> and compiled android platform from where I got a lot of other
>> libaries.
>>
> Which means you're probably linking against unstable system libraries. Don't
> be surprised if things don't work consistently between platforms if you
> don't use the NDK-provided libraries for linking.
>>
>> 2010/12/8 Doug Kwan (關振德) <doug...@google.com>:
>> > You need to install libicuuc somewhere that is visible to the
>> > toolchain.  The configuration failed becasue the linker cannot find
>> > the iccuc library.
>> >
>> > -Doug
>> >

>> > On Tue, Dec 7, 2010 at 3:49 PM, DanielH <googl...@dani.cswpro.de>

Message has been deleted

David Turner

unread,
Dec 8, 2010, 9:24:16 AM12/8/10
to andro...@googlegroups.com
On Wed, Dec 8, 2010 at 2:15 PM, Krzysztof Klinikowski <kksz...@gmail.com> wrote:
I don't have libraries like MPFR and GMP in NDK so that's pretty hard
to link that from NDK ;)

You should be able to rebuild them with the standalone toolchain in r5, then expose them as prebuilt static library modules though.
These libraries are not provided by the platform though, so as long as you statically link to them, or include them in your .apk, you should be good.
Sorry for the over-reaction :-)
 
2010/12/8 David Turner <di...@android.com>:
>
>
> On Wed, Dec 8, 2010 at 7:22 AM, Krzysztof Klinikowski <kksz...@gmail.com>
> wrote:
>>
>> export PATH=$PATH:/home/kkszysiu/Pobrane/pidgin_android/pidroid/cmds/:/
>> home/kkszysiu/Pobrane/android-sdk-linux_86/tools/:/home/kkszysiu/
>> mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/
>>
>> That's really important. You need to know that mydroid is a downloaded
>> and compiled android platform from where I got a lot of other
>> libaries.
>>
> Which means you're probably linking against unstable system libraries. Don't
> be surprised if things don't work consistently between platforms if you
> don't use the NDK-provided libraries for linking.
>>
>> 2010/12/8 Doug Kwan (關振德) <doug...@google.com>:
>> > You need to install libicuuc somewhere that is visible to the
>> > toolchain.  The configuration failed becasue the linker cannot find
>> > the iccuc library.
>> >
>> > -Doug
>> >
>> > On Tue, Dec 7, 2010 at 3:49 PM, DanielH <google.com@dani.cswpro.de>

Krzysztof Klinikowski

unread,
Dec 8, 2010, 9:52:39 AM12/8/10
to andro...@googlegroups.com
Okay. I'll try to do that when I back from work to home then maybe I
will create github repo with my changes :)

Regards,
Krzysztof.

>> >> > On Tue, Dec 7, 2010 at 3:49 PM, DanielH <googl...@dani.cswpro.de>

Message has been deleted

Krzysztof Klinikowski

unread,
Dec 8, 2010, 12:55:28 PM12/8/10
to andro...@googlegroups.com
Hmm,
Looks like you have system restrictions on your enviroment or
something. Do you have root access on that machne? Like for me it
looks like You dont have permissions to execute ant. You could give a
path to tools dir from your SDK directory in your PATH variable :P

Regards,
Krzysztof

2010/12/8, DanielH <googl...@dani.cswpro.de>:
> Compiling nearly finished, but this error came:
>
> /tmp/org.pidroid/native/bin/xz --lzma2=dict=1048576 -Ccrc32 -f assets/
> pidroid.tar
> (cd app; ant debug)
> /bin/sh: ant: Permission denied
> make: *** [debug] Fehler 127
>
> What does it mean?
> I scroogled the error message (I deny Google search due to privacy
> reasons :-)), but didn't find anything of interest.
>
> DanielH schrieb:
>> Ooops, I didn't know that mydroid has to be compiled and that's why
>> there were still some directories and libraries missing. So the
>> changes in the pidroid/cmds/ files were simply not neccessary.
>>
>> I hope it works now, still compiling... ;-)
>>
>> Krzysztof Klinikowski schrieb:

DanielH

unread,
Dec 8, 2010, 1:26:49 PM12/8/10
to android-ndk
Hi

On 8 Dez., 18:55, Krzysztof Klinikowski <kkszy...@gmail.com> wrote:
> Hmm,
> Looks like you have system restrictions on your enviroment or
> something. Do you have root access on that machne? Like for me it
> looks like You dont have permissions to execute ant. You could give a
> path to tools dir from your SDK directory in your PATH variable :P
>


Well, ant wasn't installed yet... x/

Now I am at the status of your first message.

Is the libtarxz.so on the (virtual) device and only fails to load or
is it just not on the device?

Do you know what of Pidroid already works concerning the UI? What
would we see if the libtarxz.so would load? :-)

Krzysztof Klinikowski

unread,
Dec 8, 2010, 2:07:18 PM12/8/10
to andro...@googlegroups.com
NOt just on the device. I removed all that libtarxz.so stuff from my
version and I'm using pure libpidroid.so ;P UI is not writen now. For
now we see just buddylist concept with progressbar ;P

2010/12/8 DanielH <googl...@dani.cswpro.de>:

Reply all
Reply to author
Forward
0 new messages