Sign in Join

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

Mailing lists / fpc-pascal / 2014-06

where to set the binutils-path

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Lukas Gradl

I'm trying to compile fpc for arm-android using the following script:

FPCBIN=/usr/lib/fpc/2.6.2/ppcx64
SRCDIR=/space/projekte/Sourcen/fpc27
ANDROIDBINDIR="~/Software/Android_Development/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin" export PATH=$ANDROIDBINDIR:$PATH

make crossall CPU_TARGET=arm OS_TARGET=android FPC=$FPCBIN CROSSOPT=-CfVFPV3 CROSSBINDIR=$ANDROIDBINDIR
BINUTILSPREFIX=arm-linux-androideabi-

The script stops with:

/bin/mkdir -p /space/projekte/Sourcen/fpc27/rtl/units/arm-android ~/Software/Android_Development/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as -o /space/projekte/Sourcen/fpc27/rtl/units/arm-android/prt0.o arm/prt0.as
~/Software/Android_Development/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as -o /space/projekte/Sourcen/fpc27/rtl/units/arm-android/dllprt0.o arm/dllprt0.as
/space/projekte/Sourcen/fpc27/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~/Software/Android_Development/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin -FE. -FU/space/projekte/Sourcen/fpc27/rtl/units/arm-android -darm -dRELEASE -CfVFPV3 -Us -Sg ../linux/system.pp
system.inc(1804,8) Warning: Implicit string type conversion from "RawByteString" to "UnicodeString"
system.pp(376) Error: Assembler arm-linux-androideabi-as not found, switching to external assembling
system.pp(376) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted

So, prt0.o is built, dllprt0.o as well, but for system.pp it fails.

So - where do I have to set the path to the arm-android binutils as well?

Any help appreciated...

regards
Lukas

Jonas Maebe
to Lukas Gradl
Lukas Gradl wrote 35 lines
ANDROIDBINDIR="~/Software/Android_Development/android-ndk-r9d/ toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin" export PATH=$ANDROIDBINDIR:$PATH make crossall CPU_TARGET=arm OS_TARGET=android FPC=$FPCBIN CROSSOPT=- CfVFPV3 CROSSBINDIR=$ANDROIDBINDIR BINUTILSPREFIX=arm-linux- androideabi- The script stops with: /bin/mkdir -p /space/projekte/Sourcen/fpc27/rtl/units/arm-android ~/Software/Android_Development/android-ndk-r9d/toolchains/arm-linux- androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as - o /space/projekte/Sourcen/fpc27/rtl/units/arm-android/prt0.o arm/ prt0.as ~/Software/Android_Development/android-ndk-r9d/toolchains/arm-linux- androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as - o /space/projekte/Sourcen/fpc27/rtl/units/arm-android/dllprt0.o arm/ dllprt0.as /space/projekte/Sourcen/fpc27/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~/Software/ Android_Development/android-ndk-r9d/toolchains/arm-linux- androideabi-4.8/prebuilt/linux-x86_64/bin -FE. -FU/space/projekte/ Sourcen/fpc27/rtl/units/arm-android -darm -dRELEASE -CfVFPV3 -Us - Sg ../linux/system.pp system.inc(1804,8) Warning: Implicit string type conversion from "RawByteString" to "UnicodeString" system.pp(376) Error: Assembler arm-linux-androideabi-as not found, switching to external assembling system.pp(376) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted So, prt0.o is built, dllprt0.o as well, but for system.pp it fails.

It's because your ANDROIDBINDIR/CROSSBINDIR setting is wrong. You are using the "~" character to denote your home directory, but a) you are quoting the string that you assign to ANDROIDBINDIR, so you are telling the shell that it must not perform certain substitutions. One of those it doesn't perform, is changing "~" into the full path to your home directory. This is a very important point: the equivalence of "~" and your home directory is a *unix shell convention* (just like ";" means "separator between two separate commands"), it is not (or at least should not be) interpreted in a special way by any other program b) "make" uses a shell for external invocations, so you're just lucky there that the shell is invoked a second time (without a quoted version of that environment variable), so it can substitute the ~ at that point
c) FPC directly executes programs and hence no ~-substitution will happen

FPC cannot be modified to substitute ~ with the value of $HOME, because apart from the fact that it's not a shell, a literal "~" is also a valid directory name.

The proper alternative is to use $HOME instead (as long as you don't use single quotes).

Jonas

Lukas Gradl
to Jonas Maebe
The proper alternative is to use $HOME instead (as long as you don't use single quotes).

Hmpf - I could have seen that myself.

Thanks for your help - it works.

regards
Lukas