Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-07

targetandroid - x86 as target cpu

19 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis Spreen

Thomas wrote:
"Note that if you want to try, some time ago android/x86 compiler support has been added (must add -Cfsse3 though to get valid executables)."

But one has to specifiy OS_TARGET=linux instead of OS_TARGET=android? Is this correct?

Regards,
Dennis

Dennis Spreen
to Dennis Spreen

Thomas wrote:
"Note that if you want to try, some time ago android/x86 compiler support has been added (must add -Cfsse3 though to get valid executables)."

But one has to specifiy OS_TARGET=linux instead of OS_TARGET=android? Is this correct?

make crossinstall OS_TARGET=linux CPU_TARGET=i386 OPT="-Cfsse3" CROSSOPT="-Cfsse3" CROSSBINDIR=%ANDROID_BIN_X86%
BINUTILSPREFIX=i686-android-linux-

Regards,
Dennis

Thomas Schatzl
to Dennis Spreen: "Note that if you want to try, some time ago android/x86 compiler support has been added…

Hi,

Dennis Spreen wrote 7 lines
Thomas wrote: "Note that if you want to try, some time ago android/x86 compiler support has been added (must add -Cfsse3 though to get valid executables)." But one has to specifiy OS_TARGET=linux instead of OS_TARGET=android? Is this correct?

No, OS_TARGET=android should be specified, although I believe that actually a regular linux compiler (i.e. compiled with OS_TARGET=linux) should work too as long as the rtl is compiled with -Cfvsse3 too.

E.g.

make crossinstall OS_TARGET=android CPU_TARGET=x86 CROSSOPT="-Cfsse3" CROSSBINDIR=%whatever%
BINUTILSPREFIX=i686-linux-androideabi-

I saw that I forgot to add and commit the rtl/android/i386 directory. As temporary measure just copy over the files from rtl/linux/i386... :)

I will fix that.

The x86 android compiler support mostly concerns registration of the target in the compiler and tools, and some modifications to default libraries and fpc.cfg (the latter which I didn't really get around).

Thomas

Thomas Schatzl
to Thomas Schatzl

Hi,

Thomas Schatzl wrote 10 lines
Hi, On Tue, 2012-07-31 at 14:20 +0200, Dennis Spreen wrote: > Thomas wrote: > But one has to specifiy OS_TARGET=linux instead of OS_TARGET=android? > Is this correct? No, OS_TARGET=android should be specified, although I believe that actually a regular linux compiler (i.e. compiled with OS_TARGET=linux) should work too as long as the rtl is compiled with -Cfvsse3 too.

"Work" in that context means something that runs on an android-x86 device, not necessarily being set up correctly.

The x86 android compiler support mostly concerns registration of the target in the compiler and tools, and some modifications to default libraries and fpc.cfg (the latter which I didn't really get around).

And setting the correct global defines (e.g. ANDROID instead of LINUX) which is important in some cases.

Thomas

Dennis Spreen
to Dennis Spreen
I saw that I forgot to add and commit the rtl/android/i386 directory. As temporary measure just copy over the files from rtl/linux/i386... :)

That was the reason for asking: the android/ dir was missing, so I thought the target=android was wrong there

Dennis Spreen
to Thomas Schatzl: No, OS_TARGET=android should be specified, although I believe that actually a regular…
Show quoted text 6 lines
make crossinstall OS_TARGET=android CPU_TARGET=x86 CROSSOPT="-Cfsse3" CROSSBINDIR=%whatever% BINUTILSPREFIX=i686-linux-androideabi- I saw that I forgot to add and commit the rtl/android/i386 directory. As temporary measure just copy over the files from rtl/linux/i386... :)

done, and I've put the "new" fpcmake in path, but:

Makefile:203: *** The Makefile doesn't support target x86-android, please run fpcmake first. Stop.
Thomas Schatzl
to Dennis Spreen

Hi,

Dennis Spreen wrote 10 lines
> make crossinstall OS_TARGET=android CPU_TARGET=x86 CROSSOPT="-Cfsse3" > CROSSBINDIR=%whatever% > BINUTILSPREFIX=i686-linux-androideabi- > I saw that I forgot to add and commit the rtl/android/i386 directory. As > temporary measure just copy over the files from rtl/linux/i386... :) done, and I've put the "new" fpcmake in path, but: > Makefile:203: *** The Makefile doesn't support target x86-android, > please run fpcmake first. Stop.

did you try what was written? I.e. run the new fpcmake with "-r -Tall" parameters in the main directory?

If that does not work, try some upper level directory where you got the error. Sometimes fpcmake does not pick up all directories which may have happened here.

Thomas

Dennis Spreen
to Thomas Schatzl
Show quoted text 17 lines
>> make crossinstall OS_TARGET=android CPU_TARGET=x86 CROSSOPT="-Cfsse3" >> CROSSBINDIR=%whatever% >> BINUTILSPREFIX=i686-linux-androideabi- >> I saw that I forgot to add and commit the rtl/android/i386 directory. As >> temporary measure just copy over the files from rtl/linux/i386... :) > done, and I've put the "new" fpcmake in path, but: > >> Makefile:203: *** The Makefile doesn't support target x86-android, >> please run fpcmake first. Stop. > did you try what was written? I.e. run the new fpcmake with "-r -Tall" parameters in the main directory? If that does not work, try some upper level directory where you got the error. Sometimes fpcmake does not pick up all directories which may have happened here.

I did, still same error. the fpcmake with -r -Tall states nothing about x86, but i386-android? shouldn't it be
OS_TARGET=android CPU_TARGET=i386 ?

Dennis

Dennis Spreen
to Dennis Spreen

ok, with CPU_TARGET_i386 it works (not need for fpcmake -r), but then fails before linking, because the link.res file contains illegal characters:

...
INPUT(
/home/dennis/fpc/targetandroid/2.7.1/units/i386-android/rtl/dllprt0.o build/ndkopengltest.o)
INPUT(?????????????????????????Android/libs/x86/ndkopengltest.def????)

whereas ?? are some illegal characters, thus ld complains:

Android/libs/x86/link.res: file not recognized: File format not recognized

I'm using
GNU ld (GNU Binutils for Ubuntu) 2.22.90.20120731

Any help is welcome ,-)

Regards,
Dennis

Thomas Schatzl
to Dennis Spreen

Hi,

Dennis Spreen wrote 17 lines
ok, with CPU_TARGET_i386 it works (not need for fpcmake -r), but then fails before linking, because the link.res file contains illegal characters: ... INPUT( /home/dennis/fpc/targetandroid/2.7.1/units/i386-android/rtl/dllprt0.o build/ndkopengltest.o) INPUT(?????????????????????????Android/libs/x86/ndkopengltest.def????) whereas ?? are some illegal characters, thus ld complains: Android/libs/x86/link.res: file not recognized: File format not recognized I'm using GNU ld (GNU Binutils for Ubuntu) 2.22.90.20120731 Any help is welcome ,-)

Fixed in latest revision (that particular bug in r22045). Also added the missing rtl/android/i386 files. Additionally merged with r22040 from trunk.

I only checked whether you can build linux/i386 crosscompilers (i386-android and arm-android). I did not do basic functional checks.

Note that executables linked with libc/bionic likely do not work, I had to patch them to make them at least link correctly; not sure why it worked previously for arm/android. This should not affect shared libraries using libc (I think :). I.e. what you want for an android application.

Thomas

Dennis Spreen
to Thomas Schatzl

thanks, but still does not compile / link:

[0.201] (9017) Using util
/home/dennis/android/android-ndk-r8b/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-linux-android-ld [0.228] fppkg.pp(396,1) Error: Error while linking [0.228] fppkg.pp(396,1) Fatal: There were 1 errors compiling module, stopping
[0.233] Fatal: Compilation aborted

which ndk version do you use?

Thomas Schatzl
to Dennis Spreen

Hi,

Dennis Spreen wrote 10 lines
thanks, but still does not compile / link: [0.201] (9017) Using util /home/dennis/android/android-ndk-r8b/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-linux-android-ld [0.228] fppkg.pp(396,1) Error: Error while linking [0.228] fppkg.pp(396,1) Fatal: There were 1 errors compiling module, stopping [0.233] Fatal: Compilation aborted which ndk version do you use?

r8, but that's likely not the problem.

Can you retry the failing command? Can you give exact steps to reproduce?

E.g. change into that last directory make reports (most likely fppkg, at least it has always been that one at my place) and retry the failing command as reported by fpmake.

Here, it looks like the following:
<path_to_source_install>/compiler/ppcrossarm -Tandroid -FEbin/arm-android -FUunits/arm-android
-Fu<path_to_source_install>/rtl/units/arm-android
-Fu<path_to_source_install>/packages/fcl-base/units/arm-android -Fu<path_to_source_install>/packages/fcl-xml/units/arm-android -Fu<path_to_source_install>/packages/fcl-process/units/arm-android -Fu<path_to_source_install>/packages/fcl-net/units/arm-android -Fu<path_to_source_install>/packages/fcl-passrc/units/arm-android -Fu<path_to_source_install>/packages/paszlib/units/arm-android -Fu<path_to_source_install>/packages/hash/units/arm-android -Fu<path_to_source_install>/packages/fppkg/units/arm-android -Fu<path_to_source_install>/packages/fpmkunit/units/arm-android -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -Fu<path_to_source_install>/rtl/units/arm-android
-Fu<path_to_source_install>/packages/paszlib/units/arm-android -Fu<path_to_source_install>/packages/fcl-process/units/arm-android -Fu<path_to_source_install>/packages/hash/units/arm-android -Fu<path_to_source_install>/packages/fpmkunit/units/arm-android "-Fl<path_to_source_install>/ndklib" -darm -dRELEASE -viq fppkg.pp

and show me the results.

Otherwise, provide me with exact steps to reproduce, and the compilation logs (e.g. compressed here, or best via pastebin). I cannot diagnose without a more exact failure message. Just "it does not work" is too little.

Also please give the command line you use to build again.

The one I use is:

make clean crosszipinstall PP=i386-linux-ppc386
CROSSOPT=-Fl<path_to_source_install>/ndklib OS_TARGET=android CPU_TARGET=i386 BINUTILSPREFIX=arm-linux-androideabi-

This results in a fpc-2.7.1.i386-android.tar.gz.

Note that I have all tools, e.g. i386-linux-ppc386 executable and the binutils in the path. Further I copied the ndk libs into the local "ndklib" directory. (Just to save typing).

(You may want to add CROSSOPT=-Cfsse3 if you actually want to use the output then though, but these should be fine for testing compilation)

Thomas

Thomas Schatzl
to Thomas Schatzl

Hi again,

Thomas Schatzl wrote 5 lines
The one I use is: make clean crosszipinstall PP=i386-linux-ppc386 CROSSOPT=-Fl<path_to_source_install>/ndklib OS_TARGET=android CPU_TARGET=i386 BINUTILSPREFIX=arm-linux-androideabi-

make that

make clean crosszipinstall PP=i386-linux-ppc386
CROSSOPT=-Fl<path_to_source_install>/ndklib OS_TARGET=android CPU_TARGET=i386 BINUTILSPREFIX=i686-android-linux- CROSSOPT=-Cfsse3

(that was a copy&paste from android-arm build, I missed to change to the correct binutilsprefix).

That "i386-linux-ppc386" is the 2.6.0 bootstrap i386/linux compiler executable from the ftp.

Thomas

Dennis Spreen
to Thomas Schatzl

sorry for the simple "it does not work" statement. I've redone the command:

~/fpc/targetandroid/trunk/utils/fppkg$
/home/dennis/fpc/targetandroid/trunk/compiler/ppcross386 -Tandroid -FEbin/i386-android -FUunits/i386-android
-Fu/home/dennis/fpc/targetandroid/trunk/rtl/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-base/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-xml/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-process/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-net/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-passrc/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/paszlib/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/hash/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fppkg/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fpmkunit/units/i386-android -Tandroid -XPi686-linux-android- -Xr -Ur -Xs -O2 -n -Fu/home/dennis/fpc/targetandroid/trunk/rtl/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/paszlib/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-process/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/hash/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fpmkunit/units/i386-android -di386 -dRELEASE -Cfsse3 -viq fppkg.pp
(1002) Target OS: Android for i386
(3104) Compiling fppkg.pp
(9015) Linking bin/i386-android/fppkg
/home/dennis/android/android-ndk-r8b/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-linux-android-ld: cannot find -lc
fppkg.pp(396,1) Error: (9013) Error while linking
fppkg.pp(396,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted

it shows "cannot find -lc" ? well, I'll try r8. Ok, with r8 it's the same.

I'm using Free Pascal Compiler version 2.6.0-4 [2012/07/13] for i386 with

make clean crosszipinstall PP=i386-linux-ppc386 CROSSOPT=-Fl<path_to_source_install>/ndklib OS_TARGET=android CPU_TARGET=i386 BINUTILSPREFIX=i686-android-linux- CROSSOPT=-Cfsse3

in r8b they've changed from "i686-android-linux" to "i686-linux-android", thus I've made (for the r8b)

make clean crosszipinstall
CROSSOPT=-Fl~/android/android-ndk-r8b/platforms/android-9/arch-x86/usr/lib OS_TARGET=android CPU_TARGET=i386 BINUTILSPREFIX=i686-linux-android- CROSSOPT=-Cfsse3

whereas ~/android/android-ndk-r8b the android nkd and ~/fpc/ragetandroid/trunk the targetandroid-branch is.

I'll take a close look at it tomorrow.

Regards,
Dennis

Thomas Schatzl
to Dennis Spreen

Hi,

Dennis Spreen wrote 35 lines
sorry for the simple "it does not work" statement. I've redone the command: [...] ~/fpc/targetandroid/trunk/utils/fppkg$ /home/dennis/fpc/targetandroid/trunk/compiler/ppcross386 -Tandroid -FEbin/i386-android -FUunits/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/rtl/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-base/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-xml/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-process/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-net/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-passrc/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/paszlib/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/hash/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fppkg/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fpmkunit/units/i386-android -Tandroid -XPi686-linux-android- -Xr -Ur -Xs -O2 -n -Fu/home/dennis/fpc/targetandroid/trunk/rtl/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/paszlib/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fcl-process/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/hash/units/i386-android -Fu/home/dennis/fpc/targetandroid/trunk/packages/fpmkunit/units/i386-android -di386 -dRELEASE -Cfsse3 -viq fppkg.pp (1002) Target OS: Android for i386 (3104) Compiling fppkg.pp (9015) Linking bin/i386-android/fppkg /home/dennis/android/android-ndk-r8b/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-linux-android-ld: cannot find -lc fppkg.pp(396,1) Error: (9013) Error while linking fppkg.pp(396,1) Fatal: (10026) There were 1 errors compiling module, stopping Fatal: (1018) Compilation aborted it shows "cannot find -lc" ? well, I'll try r8. Ok, with r8 it's the same.

The linker cannot find libc. There is not -Fl command in that parameter. Multiple CROSSOPT probably overwrite each other, not append to the command line.

Show quoted text 7 lines
I'm using Free Pascal Compiler version 2.6.0-4 [2012/07/13] for i386 with make clean crosszipinstall CROSSOPT=-Fl~/android/android-ndk-r8b/platforms/android-9/arch-x86/usr/lib OS_TARGET=android CPU_TARGET=i386 BINUTILSPREFIX=i686-linux-android- CROSSOPT=-Cfsse3
Try

make clean crosszipinstall
CROSSOPT="-Fl~/android/android-ndk-r8b/platforms/android-9/arch-x86/usr/lib -Cfsse3" OS_TARGET=android CPU_TARGET=i386 BINUTILSPREFIX=i686-linux-android-

That should make it work.

Thomas

Dennis Spreen
to Thomas Schatzl
> it shows "cannot find -lc" ? well, I'll try r8. Ok, with r8 it's the same. The linker cannot find libc. There is not -Fl command in that parameter. Multiple CROSSOPT probably overwrite each other, not append to the command line.

oh, they indeed overwrite each other - haven't noticed that; by merging into one statement

CROSSOPT="-Fl~/android/android-ndk-r8b/platforms/android-9/arch-x86/usr/lib -Cfsse3"

it works. thanks!

Dennis