Hello,

Quite a number of people already reported having problems with this in
the lazarus forum when cross-compiling for Android and yesterday it
was my turn to hit this. I searched quite a bit in old threads but I
haven't seen any satisfactory resolution, and it seams that the
problem isnt so common outside fpc.

Basically I have 2 computers, which AFAIK have nearly the same set of tools:
1> FPC 2.6 RC1
2> My snapshot FPC 2.5.1 cross-compiler x86-linux -> arm-linux
3> Lazarus from SVN
4> Mageia Linux 1
5> Building the project lazarus-ccr/examples/androidlclv2
6> Android NDK r5

I think they have cross-binutils from the same rpm too, but I still
have to recheck this.

The first computer is a real desktop and there everything works fine.
I can built the application normally linking against the NDK

The second one is a virtual machine running in Parallels Desktop, but
Parallels is nearly perfect ... I am yet to find a bug which is caused
due to the virtual machine. And a lot of people have been reporting
this in the forum, so it seams a common problem which affects real
computers too.

In my case even the directory structure in both machines is the same,
so I pass my library -Fl path in both like this:

/home/felipe/Programas/android-ndk-r5/platforms/android-9/arch-arm/usr/lib/

There are no changes here in anything of my source project and lazarus
source, I checked with "svn diff", but in virtual machine I get the
infamous errors from arm-linux-ld:

Compiling resource
/home/felipe/Programas/lazarus-ccr/examples/androidlclv2/lib/arm-linux/androidlcltest.or
Linking 
/home/felipe/Programas/lazarus-ccr/examples/androidlclv2/android/libs/armeabi/libmain.so
/usr/bin/arm-linux-ld: warning:
/home/felipe/Programas/lazarus-ccr/examples/androidlclv2/android/libs/armeabi/link.res
contains output sections; did you forget -T?
/usr/bin/arm-linux-ld: skipping incompatible /usr/lib//libc.so when
searching for -lc
/usr/bin/arm-linux-ld: skipping incompatible /usr/lib/crtn.o when
searching for /usr/lib/crtn.o
/usr/bin/arm-linux-ld: cannot find /usr/lib/crtn.o
androidlcltest.lpr(24) Error: Error while linking
androidlcltest.lpr(24) Fatal: There were 1 errors compiling module, stopping

arm-linux-ld seams to have a fixed idea about where to find libc and
it refuses to search in my path from -Fl, but it finds libandroid.so
correctly in the provided path, which is even more confusing.

I have trying all of the following things to try to fix it:

1> First I tryed to change that -Fl to
/home/felipe/Programas/android-ndk-r5/platforms/android-9/arch-arm/usr/
(with lib/)

Now it will complain that it can't find libandroid.so, so this shows
that the previously utilized path is valid and recognized

2> I tryed to change /etc/ld.conf (or something like that). Didn't
help, so I restored it back

3> I tryed:
export 
PATH=/home/felipe/Programas/android-ndk-r5/platforms/android-9/arch-arm/usr/lib:$PATH
didn't help

4> I tryed to change the NDK between v5 and v7 to no help

5> I tryed both FPC 2.4.4 and FPC 2.6 as the x86-linux compiler in
case the fpc binary was eating parameters or something like that (the
arm-linux one never changes, and cannot be changed and is precisely
the same in both cases, it was built in the real computer, but since
the time it was built I have formatted my / partition and installed a
newer version of my Linux)

6> I tryed:
export 
LIBPATH=/home/felipe/Programas/android-ndk-r5/platforms/android-9/arch-arm/usr/lib
didn't help

7> Google didn't bring anything useful also, threads from C users seam
to solve the issue with gcc options. example:
http://stackoverflow.com/questions/1964880/cannot-find-lib-libc-so-6

Points to using "-sysroot" from gcc

-- 
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to