[fpc-pascal] Re: How does FPC calculate linker search paths upon -XP?

Jonas Maebe jonas.maebe at elis.ugent.be
Thu May 23 14:15:18 CEST 2013


On 23 May 2013, at 14:03, Bruce Tulloch wrote:

> So it looks like -XR is not the solution for cross-compiling, at  
> least in
> my case.
>
> The compiler option I used:
>
> -XR/usr/local/opt/chroot/raspbian/rootfs
>
> seems to break when the linker encounters a linker script that  
> specifies a
> new path for the actual library object required; these generated  
> paths are
> not prepended when using -XR.

Under Linux, -XR currently prepends the internal compiler library  
search paths with the path specified to -XR. The compiler does not  
pass --sysroot to the linker because sysroot support is optional in  
GNU ld (and hence always passing it would also break compilation in  
certain scenarios).

The compiler does not (try to) parse ld.so.conf*. The paths you saw  
before are hardcoded in the compiler binary.

> Instead one needs to use --sysroot so I've replaced this one line  
> with:
>
> -Xd
> -k--sysroot=/usr/local/opt/chroot/raspbian/rootfs
> -Fl/usr/local/opt/chroot/raspbian/rootfs/lib/arm-linux-gnueabihf
> -Fl/usr/local/opt/chroot/raspbian/rootfs/usr/lib/arm-linux-gnueabihf
>
> disabling the default paths and making explicit the paths one actually
> requires. I still don't understand how FPC generates the search  
> paths per
> my previous email but at least this alternative, verbose though it is,
> seems to work.
>
> Is this the correct (i.e. "best practice") solution?

Probably, yes.


Jonas



More information about the fpc-pascal mailing list