[fpc-pascal] FPC on ARM (eg Zaurus)

Den Jean geeken at pandora.be
Fri Nov 5 07:20:20 CET 2004


Hi, 


On Sunday 31 October 2004 06:14 pm, Marco van de Voort wrote:
> 
> Try to add -Xd
> 

Thanks, it does what I need. Did not find this in the manual nor in fpc -h.

*************
uses Dl;
*************

I managed to compile my qt binding for arm (the library is C/C++ code)
but to test fpc's capability of using it on arm I'd like to do stuff like
    Handle := dlopen(PChar(LibraryName), RTLD_NOW or RTLD_GLOBAL);
    Addr := dlsym (Handle, PChar(LibQteIntfFunctions [i]));
    if Addr = nil then writeln ('Function ''' + LibQteIntfFunctions[i] + ''' not found in library');

so I need to have a  "USES dl"  but a simple program like the following does not compile

==============
program small;
uses SysUtils,Dl;
begin
writeln ('Hello World');
end.
==============

ppcarm -Xd -Sd -XParm-linux- -Fl/opt/Embedix/tools/arm-linux/lib* -Fl/opt/Embedix/tools/lib/gcc-lib/arm-linux/2.95.2 small.pas
Free Pascal Compiler version 1.9.3 [2004/04/05] for arm
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Linux for ARM
Compiling small.pas
Assembling small
Linking small
/usr/bin/arm-linux-ld: cannot find /lib/ld.so.1
small.pas(7) Error: Error while linking
Closing script ppas.sh


if I omit the linking stage (-Cn) Link.res contains 
========
....
INPUT(
-ldl
/lib/ld.so.1
)
========
So I fix this by replacing /lib/ld.so.1 with /opt/Embedix/tools/arm-linux/lib/ld-2.2.2.so
and compile with arm-linux-ld -o small link.res
The resulting program gives the following strange error

--------------------------------------------
./small[enter]
bash:./small: No such or directory
-------------------------------------------

But ./small really is there.

strace ./small gives:

-----------------------------------------------------------
strace: exec: No such file or directory
execve("./small",["./small"],[/* 30 vars */]) = 0
-----------------------------------------------------------

Some any ideas ?

*************
uses Libc;
*************
I also need Libc.
But when compiling

----------------------------
program small;
uses SysUtils,libc;
begin
writeln ('Hello World');
end.
----------------------------

I get 

----------------------------------------------------------------------------------------------------------------------------
arm-linux-ld: warning: cannot find entry symbol _start; defaulting to 000084c8
/usr/lib/fpc/1.9.3/cross/arm-linux/units/rtl/system.o: In function `SYSTEM_SYSTEM_EXIT':
/usr/lib/fpc/1.9.3/cross/arm-linux/units/rtl/system.o(.text+0x147a8): undefined reference to `_haltproc'
-----------------------------------------------------------------------------------------------------------------------------

So I add /usr/lib/fpc/1.9.3/cross/arm-linux/units/rtl/prt0.o to link.res (thank you Jose Pascual for this idea)   
Again this compiles but the resulting executable give the same ... "No such file or directory"...error as above.



Anyone any ideas left ???


kind regards,

Den Jean










More information about the fpc-pascal mailing list