[fpc-devel] Arm cross compiler

Carsten Bager carsten at beas.dk
Fri Sep 8 12:36:24 CEST 2006


I have downloaded the 204 source code and compiled a Arm cross 
compiler to run on a Windows PC  ("make clean all FPCTARGET= 
OS_TARGET=linux CPU_TARGET=arm BINUTILSPREFIX=arm-linux-")

When compiling some code that has worked with the 2.0.2 (Windows) 
compiler I get this error:

--------------------------------------------
Free Pascal Compiler version 2.0.4 [2006/08/30] for arm
Copyright (c) 1993-2006 by Florian Klaempfl
Target OS: Linux for ARM
Compiling ptest.pas
Compiling utest.pas
Assembling utest
Assembling with smartlinking utest
J:\FPC\ARMBIN\AR.EXE: creating libputest.a
Wrong command or filename
Assembling ptest
Linking ptest
libputest.a: could not read symbols: Archive has no index; run ranlib to add 
one
--------------------------------------------

I have found out that the file that the compiler are looking fore is "ar"
for some reason the compiler dos not know where to find "ar" the second
time it looks fore it. If I place an "ar.exe" in the same folder where I am
compiling the error " Wrong command or filename " Disappears, but the 
linker error remains.

If I remove the {$SMARTLINK ON} directive in the "utest.pas file", the linker 
stops complaining.

I build the same compiler on a Linux PC and that is working.
(make clean all cycle OS_TARGET=linux CPU_TARGET=arm  
PP=/pp/bin/fpc BINUTILSPREFIX=arm-linux-)


Here is an example program that can show the error.
If you compile the unit (utest) with the Windows cross compiler and then 
compile the program with the Linux cross compiler the same error 
shows (the Linux cross compiler uses the compiled unit (utest) from the 
windows cross compiler). If I do it the other way around the Windows 
compiler can compile the program (the Windows cross compiler uses the 
compiled unit (utest) from the Linux cross compiler).

My conclusion is: the Windows 2.0.4 cross compiler have a problem when 
creating "smart link" modules.

Carsten

------------------------------
unit utest;

{$SMARTLINK ON}

interface

Procedure Test;


implementation

Procedure Test;
Begin
  WriteLn('Test');
End;

end.
----------------------------
program ptest;

uses utest;

begin
  Test;
end.
------------------------------
ppcrossarm -gl -XX ptest.pas




More information about the fpc-devel mailing list