Recent

Author Topic: -XP issue while testing the ARM cross compiler  (Read 5654 times)

chronozphere

  • New Member
  • *
  • Posts: 41
-XP issue while testing the ARM cross compiler
« on: October 28, 2011, 12:57:38 am »
Hey everyone,

I seem to have managed to build a crosscompiler for ARM.. yeah  :D

However, when testing the following source:

Code: [Select]
program test;
begin
  writeln('DATE ',{$i %DATE%});
  writeln('FPCTARGET ',{$i %FPCTARGET%});
  writeln('FPCTARGETCPU ',{$i %FPCTARGETCPU%});
  writeln('FPCTARGETOS ',{$i %FPCTARGETOS%});
  writeln('FPCVERSION ',{$i %FPCVERSION%});
end.

using the command:

Code: [Select]
fpc -Tlinux -Parm -va test.pas

I got:

Code: [Select]
[0.159] Searching file /usr/lib/fpc/2.7.1/bin/arm-linux//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /usr/lib/fpc/2.7.1/bin/arm-linux//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /usr/lib/fpc/2.7.1//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /usr/lib/fpc/2.7.1//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /usr/local/maven/bin//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /usr/local/maven/bin//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /usr/local/sbin//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /usr/local/sbin//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /usr/local/bin//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /usr/local/bin//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /usr/sbin//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /usr/sbin//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /usr/bin//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /usr/bin//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /sbin//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /sbin//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /bin//home/user/lazarus/fpc/binutils/as... not found
[0.159] Searching file /bin//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.159] Searching file /usr/games//home/user/lazarus/fpc/binutils/as... not found
[0.160] Searching file /usr/games//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.160] Searching file /home/nathan/android/android-sdk-linux_x86/platform-tools//home/user/lazarus/fpc/binutils/as... not found
[0.160] Searching file /home/nathan/android/android-sdk-linux_x86/platform-tools//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.160] Searching file /home/nathan/android/android-sdk-linux_x86/tools//home/user/lazarus/fpc/binutils/as... not found
[0.160] Searching file /home/nathan/android/android-sdk-linux_x86/tools//HOME/USER/LAZARUS/FPC/BINUTILS/AS... not found
[0.160] Assembler /home/user/lazarus/fpc/binutils/as not found, switching to external assembling
[0.160] There were 1 errors compiling module, stopping
[0.182] Compilation aborted
Error: /usr/local/bin/ppcarm returned an error exitcode (normal if you did not specify a source file to be compiled)

So the string "/home/user/lazarus/fpc/binutils/as" is concatenated with each of the strings in $PATH, which is not good. The tutorial:

http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM

told me to put:

Code: [Select]
-XP/home/user/lazarus/fpc/binutils/

in my .fpc.cfg. So i looked up this -XP option and it says:

Code: [Select]
-XP<x>     Prepend the binutils names with the prefix <x>

Seems to me that this should only be used if you have your binutils prefixed, not for setting the path. If I remove that line from fpc.cfg, it finds
"/usr/local/bin/arm-linux-ld", so everything seems to work now.

So, is this an error in the article? Perhaps there is a better option for this.

Sorry, I'm a newbie and I don't know whether I'm doing this right, so I didn't feel, nor didn't know how, to edit the wiki page. Just thought i should post this.

Thanks.

P.S: The arm cross compiler was build from FPC 2.7.1 sources.
« Last Edit: October 28, 2011, 01:56:49 am by chronozphere »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: -XP issue while testing the ARM cross compiler
« Reply #1 on: October 28, 2011, 03:47:30 am »
Quote
So the string "/home/user/lazarus/fpc/binutils/as" is concatenated with each of the strings in $PATH, which is not good
That's actually how the compiler looks for assembler and linker, but... see below
Quote
The tutorial:

http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM

told me to put:

-XP/home/user/lazarus/fpc/binutils/

in my .fpc.cfg
I haven't read the article again, but I guess that "user" is actually your username. Anyway, if you install the cross-binutils somewhere in PATH (I have mine in /usr/bin, along with the standard binutils), -XP$FPCTARGET- should be enough and very portable. The article seems to have a bug by saying this -XP parameter, since it should only contains binutils prefix, while for specifying directory where the binutils are one should use -FD instead.

chronozphere

  • New Member
  • *
  • Posts: 41
Re: -XP issue while testing the ARM cross compiler
« Reply #2 on: October 29, 2011, 10:20:44 am »
Oops yeah... I should've replaced "user".

Looks like -XParm-linux- has been added to the command in the article. Just tested it and it works fine. Should also work when other crosscompilers are installed, i guess. Thanks for that. :)


 

TinyPortal © 2005-2018