[fpc-pascal] shared library on arm-linux (raspberry pi)

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Jun 28 14:13:24 CEST 2014

On 27/06/14 16:24, Fabio Luis Girardi wrote:
> The output of "readelf -a" with libraries built in C and FPC...
> The command line used to build the library in fpc is:
> fpc ulib.pas
> fpc -Cg -Xc -CD -CX library1.fpr

FPC does not support PIC code for ARM in 2.6.x. Additionally, if you 
want PIC, then just compiling the library file with -Cg is useless, 
because all code inside the library must be compiled as PIC for it to 
have any effect (including the RTL). It's this lack of PIC that causes 
all the R_ARM_RELATIVE dynamic relocations. Most Linux platforms also 
support libraries without PIC though.

And as the FPC help says, -CD is unsupported (nor needed; it is related 
to the as of yet unimplemented Delphi-style dynamic packages support).

If you want to debug shared library loading issues, a good starting 
point is setting the environment variables LD_VERBOSE=1 and LD_DEBUG=all 
before running the program that loads the library.


More information about the fpc-pascal mailing list