Sign in Join

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

Mailing lists / fpc-devel / 2012-07

Error building branch targetandroid

31 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

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

Felipe Monteiro de Carvalho

Hello,

In Mac OS X, using FPC 2.6.0 as a starting compiler I did:

svn co http://svn.freepascal.org/svn/fpc/branches/targetandroid targetandroid

cd targetandroid

make crossinstall CPU_TARGET=arm OS_TARGET=android OPT="-dFPC_ARMEL" CROSSOPT="-CpARMv6 -CfSoft"
CROSSBINDIR=/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin OPT=-dFPC_ARMEL BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=output

And I got the following strange error:

/Users/felipe/Programas/targetandroid/compiler/ppcrossarm -Ur -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../unix -Fiarm -Fi../linux -Fi../linux/arm -FD/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin -FE. -FU/Users/felipe/Programas/targetandroid/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv6 -CfSoft -Us -Sg ../linux/system.pp
arm.inc(906,2) Error: Unrecognized opcode rev
arm.inc(906,6) Error: Assembler syntax error
arm.inc(921,2) Error: Unrecognized opcode rev
arm.inc(921,6) Error: Assembler syntax error
arm.inc(946,2) Error: Unrecognized opcode rev
arm.inc(946,6) Error: Assembler syntax error
arm.inc(947,2) Error: Unrecognized opcode rev
arm.inc(947,6) Error: Assembler syntax error
arm.inc(973,2) Error: Unrecognized opcode rev
arm.inc(973,6) Error: Assembler syntax error
arm.inc(974,2) Error: Unrecognized opcode rev
arm.inc(974,6) Error: Assembler syntax error
text.inc(1774,14) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString"
text.inc(1998,44) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" system.pp(380) Fatal: There were 12 errors compiling module, stopping Fatal: Compilation aborted
make[4]: *** [system.ppu] Error 1
make[3]: *** [android_all] Error 2
make[2]: *** [rtl_all] Error 2
make[1]: *** [build-stamp.arm-android] Error 2
make: *** [crossinstall] Error 2

any ideas?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Thomas Schatzl
to Felipe Monteiro de Carvalho

Hi,

Felipe Monteiro de Carvalho wrote 30 lines
Hello, In Mac OS X, using FPC 2.6.0 as a starting compiler I did: svn co http://svn.freepascal.org/svn/fpc/branches/targetandroid targetandroid cd targetandroid make crossinstall CPU_TARGET=arm OS_TARGET=android OPT="-dFPC_ARMEL" CROSSOPT="-CpARMv6 -CfSoft" CROSSBINDIR=/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin OPT=-dFPC_ARMEL BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=output And I got the following strange error: /Users/felipe/Programas/targetandroid/compiler/ppcrossarm -Ur -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../unix -Fiarm -Fi../linux -Fi../linux/arm -FD/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin -FE. -FU/Users/felipe/Programas/targetandroid/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv6 -CfSoft -Us -Sg ../linux/system.pp arm.inc(906,2) Error: Unrecognized opcode rev arm.inc(906,6) Error: Assembler syntax error arm.inc(921,2) Error: Unrecognized opcode rev

The revision you have does not support the "rev" instruction when using -CpARMv6. Use -CpARMv5 (or no switch, as it is the default) to create the (cross-)compiler.
That has been fixed in a later revision in trunk.

The generated compiler can then be used to generate ARMv6 code, but of course still does not support the assembler "rev" instruction.

I will look at how much work it is to merge the branch to latest.

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).

Thomas

Reply by email

Felipe Monteiro de Carvalho
to Thomas Schatzl
Thomas Schatzl wrote
The revision you have does not support the "rev" instruction when using -CpARMv6. Use -CpARMv5 (or no switch, as it is the default) to create the (cross-)compiler.

-CpARMv5 will generate instructions which crash many Android devices, including my own HTC Wildfire.

See: http://groups.google.com/group/android-ndk/browse_thread/thread/ba542483f062a828

The generated compiler can then be used to generate ARMv6 code, but of course still does not support the assembler "rev" instruction.

But the RTL and FCL will be compiled using -CpARMv5, correct?

I will look at how much work it is to merge the branch to latest.

thanks =)

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).

This is interresting as a future possibility, but right now all devices which I am interrested at run ARM.

thanks,

Felipe Monteiro de Carvalho

Reply by email

Nico Erfurth
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 7 lines
On Sat, Jul 7, 2012 at 11:42 AM, Thomas Schatzl wrote: > The revision you have does not support the "rev" instruction when using > -CpARMv6. Use -CpARMv5 (or no switch, as it is the default) to create the > (cross-)compiler. -CpARMv5 will generate instructions which crash many Android devices, including my own HTC Wildfire.

Have a look at rtl/arm/arm.inc and look for the SwapEndian functions. If you disable them by putting some bogus ifdef around them, then the generic functions will be used. So far this should be the only place which has the rev instructions.

In theory an ARMv5 binary should not crash (at least not because of invalid instructions) on your android device.

Nico

Reply by email

Thomas Schatzl
to Felipe Monteiro de Carvalho: -CpARMv5 will generate instructions which crash many Android devices, including my own…

Hi,

Felipe Monteiro de Carvalho wrote 5 lines
On Sat, Jul 7, 2012 at 11:42 AM, Thomas Schatzl wrote: > I will look at how much work it is to merge the branch to latest. thanks =)

Updated/rebased the branch with 21814. The sources now compile with -Cparmv6, and I also got cross- and native arm/android compilers. Did not test compiler output though, apart from that that this particular issue only occurs on your device.

Note that you may need to mark your android app as conforming to armeabi-v7 now because the compiler may emit or at least allows armv6 instructions (whatever these are) now.

Actually, I saw that armv5 already supports blx, do not know right now why it isn't generated in the first place. Did you ever try compiling the compiler or your program with -Cparmv5? Maybe it's just that the compiler default is < armv5?

Thomas

Reply by email

Felipe Monteiro de Carvalho
to Thomas Schatzl
Thomas Schatzl wrote
Updated/rebased the branch with 21814. The sources now compile with -Cparmv6, and I also got cross- and native arm/android compilers.

Great! I will test now.

Just to know: Does this compiler contain all the fixes from multiple bug reports including fixes for threading, dynamic library loading, etc?

Note that you may need to mark your android app as conforming to armeabi-v7 now because the compiler may emit or at least allows armv6 instructions (whatever these are) now.

That would be counter-productive because my HTC Wildfire runs ARMv6 so my application would stop working there.

ARMv5 Android devices are virtually inexistent. In my office we have 100+ devices and I am not aware of a single one which uses ARMv5. All low-end devices are ARMv6

Actually, I saw that armv5 already supports blx, do not know right now why it isn't generated in the first place. Did you ever try compiling the compiler or your program with -Cparmv5? Maybe it's just that the compiler default is < armv5?

I never really tested -Cparmv5, only -Cparmv6 and with no options (so default value), I just conected the points based on your assertion that default=v5, but indeed maybe it is v4.

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho

Hello,

Using the same command lines as before, now I get a different error:

make rtl_all FPC=/Users/felipe/Programas/targetandroid/compiler/ppcrossarm RELEASE=1
make -C rtl all
make -C android all
/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-as -o /Users/felipe/Programas/targetandroid/rtl/units/arm-android/prt0.o arm/prt0.as
/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-as -o /Users/felipe/Programas/targetandroid/rtl/units/arm-android/dllprt0.o arm/dllprt0.as
/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-as -o /Users/felipe/Programas/targetandroid/rtl/units/arm-android/cprt0.o arm/cprt0.as
/Users/felipe/Programas/targetandroid/compiler/ppcrossarm -Ur -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../unix -Fiarm -Fi../linux -Fi../linux/arm -FD/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin -FE. -FU/Users/felipe/Programas/targetandroid/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv6 -CfSoft -Us -Sg ../linux/system.pp
text.inc(1774,14) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString"
text.inc(1998,44) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" Assembler messages:
Fatal error: invalid listing option `r'
system.pp(380) Error: Error while assembling exitcode 1 system.pp(380) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted
make[4]: *** [system.ppu] Error 1
make[3]: *** [android_all] Error 2
make[2]: *** [rtl_all] Error 2
make[1]: *** [build-stamp.arm-android] Error 2
make: *** [crossinstall] Error 2
user-31-174-84-158:targetandroid felipe$

Maybe it will work with NDK v8, so I am downloading that now.

Felipe Monteiro de Carvalho

Reply by email

Thomas Schatzl
to Felipe Monteiro de Carvalho: Great! I will test now. Just to know: Does this compiler contain all the fixes from…

Hi,

Felipe Monteiro de Carvalho wrote 10 lines
On Sun, Jul 8, 2012 at 1:19 AM, Thomas Schatzl wrote: > Updated/rebased the branch with 21814. The sources now compile with > -Cparmv6, and I also got cross- and native arm/android compilers. Great! I will test now. Just to know: Does this compiler contain all the fixes from multiple bug reports including fixes for threading, dynamic library loading, etc?

Not sure what exactly you're referring too, but it is on the level of yesterday evenings' trunk, and does include some of the android specific changes from the bug tracker, at least those that I deemed correct.

- Libraries are working: note that envp/argc/argv contain nil values. (first import)
- there were some fixes to threading (r21066)
- some other, minor fixes (r21065)

As far as testing goes, I could package a crosscompiled shared library into an Android apk and run it (some sample), and successfully started the compiler natively (displaying the help page); not with the current revision yet though..

Show quoted text 13 lines
> Note that you may need to mark your android app as conforming to > armeabi-v7 > now because the compiler may emit or at least allows armv6 > instructions > (whatever these are) now. That would be counter-productive because my HTC Wildfire runs ARMv6 so my application would stop working there. ARMv5 Android devices are virtually inexistent. In my office we have 100+ devices and I am not aware of a single one which uses ARMv5. All low-end devices are ARMv6

It's Google that defined those ABI levels, not me.

Show quoted text 11 lines
> Actually, I saw that armv5 already supports blx, do not know right > now why > it isn't generated in the first place. Did you ever try compiling > the > compiler or your program with -Cparmv5? Maybe it's just that the > compiler > default is < armv5? I never really tested -Cparmv5, only -Cparmv6 and with no options (so default value), I just conected the points based on your assertion that default=v5, but indeed maybe it is v4.

... or even to some lower common denominator.

Thomas

Reply by email

Thomas Schatzl
to Felipe Monteiro de Carvalho: Using the same command lines as before, now I get a different error: make rtl_all…

Hi,

Felipe Monteiro de Carvalho wrote 39 lines
Hello, Using the same command lines as before, now I get a different error: make rtl_all FPC=/Users/felipe/Programas/targetandroid/compiler/ppcrossarm RELEASE=1 make -C rtl all make -C android all /Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-as -o /Users/felipe/Programas/targetandroid/rtl/units/arm-android/prt0.o arm/prt0.as /Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-as -o /Users/felipe/Programas/targetandroid/rtl/units/arm-android/dllprt0.o arm/dllprt0.as /Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-as -o /Users/felipe/Programas/targetandroid/rtl/units/arm-android/cprt0.o arm/cprt0.as /Users/felipe/Programas/targetandroid/compiler/ppcrossarm -Ur -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../unix -Fiarm -Fi../linux -Fi../linux/arm -FD/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin -FE. -FU/Users/felipe/Programas/targetandroid/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv6 -CfSoft -Us -Sg ../linux/system.pp text.inc(1774,14) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" text.inc(1998,44) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" Assembler messages: Fatal error: invalid listing option `r'

can you check whether the correct assembler is used, e.g. change into the rtl directory, and run the ppcrossarm as above with -al -s appended? And then verify the ppas.sh that the correct assembler is used?

This is, as indicated, an assembler issue.

Maybe it will work with NDK v8, so I am downloading that now.

No, at least in the linux ndk the assemblers are the same in the two ndk version.

Thomas

Reply by email

Felipe Monteiro de Carvalho
to Thomas Schatzl
Thomas Schatzl wrote
can you check whether the correct assembler is used, e.g. change into the rtl directory, and run the ppcrossarm as above with -al -s appended? And then verify the ppas.sh that the correct assembler is used?

Could you be more specific about which command to type? I tryed to deduce by myself and I came up with:

user-31-175-219-83:rtl felipe$ ../compiler/ppcrossarm -FD/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin -FE. -FU/Users/felipe/Programas/targetandroid/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv6 -CfSoft -Us -Sg -al -s -Fiarm -Fiunix -Filinux/arm -Fiinc -Filinux linux/system.pp

which results in a compilation error:

system.pp(102,19) Error: Identifier not found "argc"
system.pp(132,21) Error: Identifier not found "argc"
system.pp(133,27) Error: Identifier not found "argv"
system.pp(164,10) Error: Identifier not found "argc"
system.pp(170,16) Error: Identifier not found "argc"
system.pp(172,22) Error: Identifier not found "argv"
system.pp(177,14) Error: Identifier not found "argv"
system.pp(192,19) Error: Identifier not found "argv"
system.pp(200,16) Error: Identifier not found "argc"
system.pp(380) Fatal: There were 9 errors compiling module, stopping
Fatal: Compilation aborted
Felipe Monteiro de Carvalho

Reply by email

Thomas Schatzl
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 15 lines
On Sun, Jul 8, 2012 at 5:15 PM, Thomas Schatzl wrote: > can you check whether the correct assembler is used, e.g. change into the > rtl directory, and run the ppcrossarm as above with -al -s appended? And > then verify the ppas.sh that the correct assembler is used? Could you be more specific about which command to type? I tryed to deduce by myself and I came up with: user-31-175-219-83:rtl felipe$ ../compiler/ppcrossarm -FD/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin -FE. -FU/Users/felipe/Programas/targetandroid/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv6 -CfSoft -Us -Sg -al -s -Fiarm -Fiunix -Filinux/arm -Fiinc -Filinux linux/system.pp which results in a compilation error:

Run

/Users/felipe/Programas/targetandroid/compiler/ppcrossarm -Ur -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../unix -Fiarm -Fi../linux -Fi../linux/arm -FD/Users/felipe/Programas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin -FE. -FU/Users/felipe/Programas/targetandroid/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv6 -CfSoft -Us -Sg -al -s

(I.e. the command line that failed, including "-al -s")

in the "/Users/felipe/Programas/targetandroid/rtl/android" directory (this is where make was when the error occurred), and have a look at the generated ppas.sh file which contains the calls to the assembler and linker. They should refer to correct cross-assembler and linker.

Btw, I had some time to have a look at what method exit code fpc generates when using -Cparmv5. It generates bx instructions then. I.e. the default code generator uses something less than armv5.

Thomas

Reply by email

Felipe Monteiro de Carvalho
to Thomas Schatzl
Thomas Schatzl wrote
Run ... (I.e. the command line that failed, including "-al -s")

That results in:

Fatal: No source file name in command line
Fatal: Compilation aborted

Felipe Monteiro de Carvalho

Reply by email

Thomas Schatzl
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 10 lines
On Mon, Jul 9, 2012 at 9:42 AM, Thomas Schatzl wrote: > Run >... > (I.e. the command line that failed, including "-al -s") That results in: Fatal: No source file name in command line Fatal: Compilation aborted

The whole shebang again, with "../linux/system.pp" at the end. Forgot to copy that line in the given output.

Thomas

Reply by email

Jeppe Græsdal Johansen
to Thomas Schatzl: Not sure what exactly you're referring too, but it is on the level of yesterday evenings'…
Thomas Schatzl wrote 18 lines
>> Actually, I saw that armv5 already supports blx, do not know right >> now why >> it isn't generated in the first place. Did you ever try compiling the >> compiler or your program with -Cparmv5? Maybe it's just that the >> compiler >> default is < armv5? > > I never really tested -Cparmv5, only -Cparmv6 and with no options (so > default value), I just conected the points based on your assertion > that default=v5, but indeed maybe it is v4. ... or even to some lower common denominator. Thomas _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

You should be using -Cparmv5t if you want armv5 and blx. The t indicates that the device has thumb support, which most have, but armv5 is usually safer, hence it's the default.

Reply by email

Felipe Monteiro de Carvalho
to Jeppe Græsdal Johansen

In Windows I also have strange issues:

D:\targetandroid>PATH=C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32

D:\targetandroid>make crossinstall CPU_TARGET=arm OS_TARGET=android OPT="-dFPC_A RMEL" CROSSOPT="-CpARMv6 -CfSoft" CROSSBINDIR=C:\Programas\android-ndk-r8\toolch ains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin OPT=-dFPC_ARMEL BINUTILSPR EFIX=arm-linux-androideabi- INSTALL_PREFIX=output
makefile:29: *** You need the GNU utils package to use this Makefile. Stop.

Any ideas?

This same kind of method worked fine for building Lazarus...

thanks,

Felipe Monteiro de Carvalho

Reply by email

Jeppe Græsdal Johansen
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
makefile:29: *** You need the GNU utils package to use this Makefile. Stop.

Looks like it can't find a proper strip binary. Is your binutils prefix correct? Maybe you have problems with the backslashes? A silly suggestion: try changing them from \ to \\ :)

Reply by email

Thomas Schatzl
to Jeppe Græsdal Johansen: You should be using -Cparmv5t if you want armv5 and blx. The t indicates that the device…

Hi,

Jeppe Græsdal Johansen wrote 20 lines
Den 08-07-2012 14:42, Thomas Schatzl skrev: >>> Actually, I saw that armv5 already supports blx, do not know right >>> now why >>> it isn't generated in the first place. Did you ever try compiling the >>> compiler or your program with -Cparmv5? Maybe it's just that the >>> compiler >>> default is < armv5? >> >> I never really tested -Cparmv5, only -Cparmv6 and with no options (so >> default value), I just conected the points based on your assertion >> that default=v5, but indeed maybe it is v4. > > ... or even to some lower common denominator. > > Thomas > You should be using -Cparmv5t if you want armv5 and blx. The t indicates that the device has thumb support, which most have, but armv5 is usually safer, hence it's the default.

You are right although fpc seems to generate bx with -Cparmv5 too.

The point is how google defines its ABIs. As for Android, google mentions about "armeabi":

"This is the name of an ABI for ARM-based CPUs that support *at* *least* the ARMv5TE instruction set. [...]"

So, at least for compiling for Android, either is fine, although -Cparmv5t is certainly better.

Thomas

Reply by email

Felipe Monteiro de Carvalho
to Jeppe Græsdal Johansen: Looks like it can't find a proper strip binary. Is your binutils prefix correct? Maybe…
Jeppe Græsdal Johansen wrote
Looks like it can't find a proper strip binary. Is your binutils prefix correct?

Yes, the prefix is correct

Is it complaining about general binutils, like strip.exe, or about the cross-binutils?

Anyway, these 2 files do exist:

C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin\arm-linux-androideabi-strip.exe

C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32\strip.exe

Maybe you have problems with the backslashes? A silly suggestion: try changing them from \ to \\ :)

Didn't change anything.

Felipe Monteiro de Carvalho

Reply by email

Thomas Schatzl
to Thomas Schatzl: You are right although fpc seems to generate bx with -Cparmv5 too. The point is how…

Hi again,

Thomas Schatzl wrote 7 lines
> > You should be using -Cparmv5t if you want armv5 and blx. The t indicates > that the device has thumb support, which most have, but armv5 is usually > safer, hence it's the default. You are right although fpc seems to generate bx with -Cparmv5 too.

Because it is correct, non-T armv5 supports the "bx" instruction without the Thumb bit set.

Show quoted text 6 lines
The point is how google defines its ABIs. As for Android, google mentions about "armeabi": "This is the name of an ABI for ARM-based CPUs that support *at* *least* the ARMv5TE instruction set. [...]"

... which means that this is a non-issue because android ABI requires a -T variant anyway.

Thomas

Reply by email

Jonas Maebe
to Felipe Monteiro de Carvalho: On Mon, Jul 9, 2012 at 11:24 AM, Jeppe Græsdal Johansen Yes, the prefix is correct Is it…

Felipe Monteiro de Carvalho wrote on Mon, 09 Jul 2012:

Is it complaining about general binutils, like strip.exe, or about the cross-binutils?

That error is only printed if the Makefile cannot find pwd.exe in the PATH. It should be part of a default FPC 2.6.0 install.

Note that pwd.exe is not only utility the Makefile requires, it's just a quick sanity check. You must have all GNU utilities shipped with latest FPC release install in your PATH at all times when using the Makefiles. Otherwise you will get random errors all the time, as you seem to be getting based on your previous mails.

Jonas

Reply by email

Felipe Monteiro de Carvalho
to Jonas Maebe
Jonas Maebe wrote
That error is only printed if the Makefile cannot find pwd.exe in the PATH. It should be part of a default FPC 2.6.0 install.

but I have:

SET PATH=C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32

And the file C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32\pwd.exe does exist

Show quoted text 5 lines
Note that pwd.exe is not only utility the Makefile requires, it's just a quick sanity check. You must have all GNU utilities shipped with latest FPC release install in your PATH at all times when using the Makefiles. Otherwise you will get random errors all the time, as you seem to be getting based on your previous mails.

I don't think that this problem is related at all to the previous e-mails. Previously I was trying to build in Mac OS I am trying at work in Windows.

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 5 lines
but I have: SET PATH=C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32 And the file C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32\pwd.exe does exist

I think I found the problem. It seams that building fails if my source code is not on the same drive as the FPC installation.

Very wierd. Does anyone have an idea why?

Felipe Monteiro de Carvalho

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho

In our previous episode, Felipe Monteiro de Carvalho said:

Show quoted text 11 lines
wrote: > but I have: > > SET PATH=C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32 > > And the file C:\Programas\lazarus31\fpc\2.6.1\bin\i386-win32\pwd.exe does exist I think I found the problem. It seams that building fails if my source code is not on the same drive as the FPC installation. Very wierd. Does anyone have an idea why?

Afaik there was some comment later in that thread that the makefiles sometimes detect windows by the semicomma's in the PATH.

Try to add ;c:\windows\system or so to your path line.

Reply by email

Felipe Monteiro de Carvalho
to Marco van de Voort
Marco van de Voort wrote
Afaik there was some comment later in that thread that the makefiles sometimes detect windows by the semicomma's in the PATH. Try to add ;c:\windows\system or so to your path line.

Nice, that fixes the problem too =) Strange that both solution works: copying my binutils&fpc binary to the same drive as the source code or putting a useless ; in the PATH

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho

Ok, so that error was fixed, but now it just fails elsewhere further down =(

In Windows I try to build targetandroid with this batch script:

SET PATH=;C:\Programas\lazarus31_fpc260\fpc\2.6.0\bin\i386-win32;C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin make crossinstall CPU_TARGET=arm OS_TARGET=android OPT="-dFPC_ARMEL" CROSSOPT="-CpARMv6 -CfSoft"
CROSSBINDIR=C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin\ BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=output pause

And get this error:

make[2]: Leaving directory `D:/targetandroid'
make packages_all FPC=D:/targetandroid/compiler/ppcrossarm.exe RELEASE=1 make[2]: Entering directory `D:/targetandroid'
make -C packages all
make[3]: Entering directory `D:/targetandroid/packages' make -C fpmkunit bootstrap
make[4]: Entering directory `D:/targetandroid/packages/fpmkunit' D:/targetandroid/compiler/ppc.exe src/fpmkunit.pp -n -FuD:/targetandroid/rtl/uni ts/i386-win32 -FuD:/targetandroid/packages/paszlib -FuD:/targetandroid/packages/ fcl-process -FuD:/targetandroid/packages/hash -FUunits_bs/i386-win32 -Fu../paszl ib/src -Fu../hash/src -Fi../paszlib/src -Fi../fcl-process/src/win -Fu../fcl-pro cess/src -Fi../fcl-process/src/win32 -Fi../fcl-process/src/dummy make[4]: Leaving directory `D:/targetandroid/packages/fpmkunit' D:/targetandroid/compiler/ppc.exe fpmake.pp -n -FuD:/targetandroid/packages/fpmk unit/units_bs/i386-win32 -FuD:/targetandroid/rtl/units/i386-win32 .\fpmake.exe compile --localunitdir=.. --os=android --cpu=arm -o -Tandroid -o -P arm -o -XParm-linux-androideabi- -o -Xr -o -Ur -o -Xs -o -O2 -o -n -o -FuD:/targ etandroid/rtl/units/arm-android -o -FDC:\Programas\android-ndk-r8\toolchains\arm -linux-androideabi-4.4.3\prebuilt\windows\bin\ -o -dFPC_ARMEL -o -darm -o -dRELE ASE -o -CpARMv6 -o -CfSoft --compiler=D:/targetandroid/compiler/ppcrossarm.exe - bu
Invalid command-line argument at position 25: -dFPC_ARMEL Usage: D:\targetandroid\packages\fpmake.exe command [options] Where command is one of the following:
compile Compile all units in the package(s).
build Build all units in the package(s).
install Install all units in the package(s).
clean Clean (remove) all units in the package(s). archive Create archive (zip) with all units in the package(s). manifest Create a manifest suitable for import in repository. Where options is one or more of the following:
-h --help This message.
-l --list-commands list commands instead of actually executing them. -n --nofpccfg Compiler will not use fpc.cfg -v --verbose Be verbose when working.
-e --useenv Use environment to pass options to compiler. -ie --installexamples Install the example-sources. -bu --buildunit Compile package in Build-unit mode. -C --cpu=Value Compile for indicated CPU. -O --os=Value Compile for indicated OS -t --target=Value Compile for indicated target -P --prefix=Value Use indicated prefix directory for all commands. -B --baseinstalldir=Value Use indicated directory as base install dir. -UL --localunitdir=Value Use indicated directory as local (user) unit dir. -UG --globalunitdir=Value Use indicated directory as global unit dir. -U --unitinstalldir=Value Use indicated directory to install units into. -r --compiler=Value Use indicated binary as compiler -f --config=Value Use indicated config file when compiling. -o --options=Value Pass extra options to the compiler. -io --ignoreinvalidoption=Value Ignore further invalid options. -d --doc-folder=Value Use indicated directory as fpdoc output folder. -T --threads=Value Enable the indicated amount of worker threads.

make[3]: *** [all] Error 1
make[3]: Leaving directory `D:/targetandroid/packages' make[2]: *** [packages_all] Error 2
make[2]: Leaving directory `D:/targetandroid'
make[1]: *** [build-stamp.arm-android] Error 2

Felipe Monteiro de Carvalho

Reply by email

Pierre Free Pascal
to Felipe Monteiro de Carvalho
Show quoted text 20 lines
-----Message d'origine----- De : [mailto:fpc-devel- De la part de Felipe Monteiro de Carvalho Envoyé : jeudi 13 septembre 2012 16:35 À : FPC developers' list Objet : Re: [fpc-devel] Error building branch targetandroid Ok, so that error was fixed, but now it just fails elsewhere further down =( In Windows I try to build targetandroid with this batch script: SET PATH=;C:\Programas\lazarus31_fpc260\fpc\2.6.0\bin\i386- win32;C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi- 4.4.3\prebuilt\windows\bin make crossinstall CPU_TARGET=arm OS_TARGET=android OPT="-dFPC_ARMEL" CROSSOPT="-CpARMv6 -CfSoft" CROSSBINDIR=C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi- 4.4.3\prebuilt\windows\bin\ BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=output pause

Try using forward slashes instead
CROSSBINDIRT=C:/Programas/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/

I suspect that some shell sees ...bin\ -o as only one parameter because it believes there is an escaped space '\ ' that make ' -o' still part of the previous parameter for fpmake.

Pierre Muller

Reply by email

Felipe Monteiro de Carvalho
to Pierre Free Pascal

Hello,

Ok, I removed the CROSSBINDIR because the binutils are now in the path anyway and it goes a bit forward, but then fails again:

Start compiling package fppkg-util for target arm-android. Compiling fppkg.pp
Linking bin\arm-android\fppkg
The installer encountered the following error:
External command "D:/targetandroid/compiler/ppcrossarm.exe -Tandroid -FEbin\arm- android -FUunits\arm-android -FuD:\targetandroid\rtl\units\arm-android -FuD:\tar getandroid\packages\fcl-base\units\arm-android -FuD:\targetandroid\packages\fcl- xml\units\arm-android -FuD:\targetandroid\packages\fcl-process\units\arm-android -FuD:\targetandroid\packages\fcl-net\units\arm-android -FuD:\targetandroid\pack ages\fcl-passrc\units\arm-android -FuD:\targetandroid\packages\paszlib\units\arm -android -FuD:\targetandroid\packages\hash\units\arm-android -FuD:\targetandroid \packages\fppkg\units\arm-android -FuD:\targetandroid\packages\fpmkunit\units\ar m-android -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -FuD:/tar getandroid/rtl/units/arm-android -FuD:/targetandroid/packages/paszlib/units/arm- android -FuD:/targetandroid/packages/fcl-process/units/arm-android -FuD:/targeta ndroid/packages/hash/units/arm-android -FuD:/targetandroid/packages/fpmkunit/uni ts/arm-android -darm -dRELEASE -CpARMv6 -CfSoft -viq fppkg.pp" failed with exit code 1. Console output:
Target OS: Android for ARMEL
Compiling fppkg.pp
Assembling fppkg
Linking bin\arm-android\fppkg
fppkg.pp(398) Error: Error while linking
fppkg.pp(398) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted

make[4]: *** [all] Error 1
make[4]: Leaving directory `D:/targetandroid/utils/fppkg' make[3]: *** [fppkg_all] Error 2
make[3]: Leaving directory `D:/targetandroid/utils' make[2]: *** [utils_all] Error 2
make[2]: Leaving directory `D:/targetandroid'
make[1]: *** [build-stamp.arm-android] Error 2
make[1]: Leaving directory `D:/targetandroid'
make: *** [crossinstall] Error 2

Any ideas which option will show a more complete error message for the linking error?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Jonas Maebe
to Felipe Monteiro de Carvalho

Felipe Monteiro de Carvalho wrote on Fri, 14 Sep 2012:

Show quoted text 51 lines
Start compiling package fppkg-util for target arm-android. Compiling fppkg.pp Linking bin\arm-android\fppkg The installer encountered the following error: External command "D:/targetandroid/compiler/ppcrossarm.exe -Tandroid -FEbin\arm- android -FUunits\arm-android -FuD:\targetandroid\rtl\units\arm-android -FuD:\tar getandroid\packages\fcl-base\units\arm-android -FuD:\targetandroid\packages\fcl- xml\units\arm-android -FuD:\targetandroid\packages\fcl-process\units\arm-android -FuD:\targetandroid\packages\fcl-net\units\arm-android -FuD:\targetandroid\pack ages\fcl-passrc\units\arm-android -FuD:\targetandroid\packages\paszlib\units\arm -android -FuD:\targetandroid\packages\hash\units\arm-android -FuD:\targetandroid \packages\fppkg\units\arm-android -FuD:\targetandroid\packages\fpmkunit\units\ar m-android -Tandroid -Parm -XParm-linux-androideabi- -Xr -Ur -Xs -O2 -n -FuD:/tar getandroid/rtl/units/arm-android -FuD:/targetandroid/packages/paszlib/units/arm- android -FuD:/targetandroid/packages/fcl-process/units/arm-android -FuD:/targeta ndroid/packages/hash/units/arm-android -FuD:/targetandroid/packages/fpmkunit/uni ts/arm-android -darm -dRELEASE -CpARMv6 -CfSoft -viq fppkg.pp" failed with exit code 1. Console output: Target OS: Android for ARMEL Compiling fppkg.pp Assembling fppkg Linking bin\arm-android\fppkg fppkg.pp(398) Error: Error while linking fppkg.pp(398) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted make[4]: *** [all] Error 1 make[4]: Leaving directory `D:/targetandroid/utils/fppkg' make[3]: *** [fppkg_all] Error 2 make[3]: Leaving directory `D:/targetandroid/utils' make[2]: *** [utils_all] Error 2 make[2]: Leaving directory `D:/targetandroid' make[1]: *** [build-stamp.arm-android] Error 2 make[1]: Leaving directory `D:/targetandroid' make: *** [crossinstall] Error 2 Any ideas which option will show a more complete error message for the linking error?

Re-execute the command you show above inside the utils/fppkg directory, but with an additional -Cn parameter. Then execute the generated ppas.bat

Jonas

Reply by email

Felipe Monteiro de Carvalho
to Jonas Maebe

Thanks,

Some strange things happen. It generates the ppas.bat file as utils/fppkg/bin/arm-android/ppas.bat, but running the file in this position causes all kinds of errors because the paths inside the file seam to suppose that it is located in utils/fppkg/

So I copied the file to utils/fppkg/ and ran it there, which in turn results in an error about not finding -lc:

Linking bin\arm-android\fppkg
C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi-4.4.3\prebuilt\wind ows\bin\arm-linux-androideabi-ld.exe: cannot find -lc An error occured while linking bin\arm-android\fppkg Aby kontynuować, naciśnij dowolny klawisz . . .

So I though that maybe -Fl is missing, so now I changed my script to:

SET PATH=;C:\Programas\lazarus31_fpc260\fpc\2.6.0\bin\i386-win32;C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin make crossinstall CPU_TARGET=arm OS_TARGET=android OPT="-FlC:/Programas/android-ndk-r7b/platforms/android-8/arch-arm/usr/lib/" CROSSOPT="-CpARMv6 -CfSoft" BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=output
pause

Note that due to some kind of hellish issue I indeed needed to write C:/ instead of C:\ (arggg!!!)

But even after doing that, the result seams to be the same. I get the same linking error, and ppas.bat did not change:

@echo off
SET THEFILE=bin\arm-android\fppkg
echo Linking %THEFILE%
C:\Programas\android-ndk-r8\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin\arm-linux-androideabi-ld.exe --dynamic-linker=/system/bin/linker --gc-sections -s -L. -o bin\arm-android\fppkg bin\arm-android\link.res
if errorlevel 1 goto linkend
goto end
:asmend
echo An error occured while assembling %THEFILE%
goto end
:linkend
echo An error occured while linking %THEFILE%
:end

Felipe Monteiro de Carvalho

Reply by email

Jonas Maebe
to Felipe Monteiro de Carvalho

Felipe Monteiro de Carvalho wrote on Fri, 14 Sep 2012:

Show quoted text 7 lines
make crossinstall CPU_TARGET=arm OS_TARGET=android OPT="-FlC:/Programas/android-ndk-r7b/platforms/android-8/arch-arm/usr/lib/" CROSSOPT="-CpARMv6 -CfSoft" BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=output pause Note that due to some kind of hellish issue I indeed needed to write C:/ instead of C:\ (arggg!!!)

The "some kind of hellish" issue is that \ means "escape the next character". So simply never put a backslash at the end of an option passed to make, because then it escapes quotes or spaces. This should work fine:
-FlC:\Programas\android-ndk-r7b\platforms\android-8\arch-arm\usr\lib

But even after doing that, the result seams to be the same. I get the same linking error, and ppas.bat did not change:

That's because you added it to OPT instead of to CROSSOPT. The fppkg program is compiled for android/arm, and hence the CROSSOPT options are used.

Jonas

Reply by email