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.
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?
Thanks, Bruce.
Bruce Tulloch wrote 32 lines
Using FPC 2.7.1 I'm cross-compiling from x86_64 to ARM/RPi and have
specified:
-XR/usr/local/opt/chroot/raspbian/rootfs
This produces a link.res file that includes the following:
SEARCH_DIR("/usr/local/opt/chroot/raspbian/rootfs/usr/lib/arm-linux-gnueabihf/")
SEARCH_DIR("/usr/local/opt/chroot/raspbian/rootfs/lib/")
SEARCH_DIR("/usr/local/opt/chroot/raspbian/rootfs/usr/lib/")
but it DOES NOT include this line:
SEARCH_DIR("/usr/local/opt/chroot/raspbian/rootfs/lib/arm-linux-gnueabihf/")
despite the fact the ld.so configuration file:
/usr/local/opt/chroot/raspbian/rootfs/etc/ld.so.conf.d/arm-linux-gnueabihf.conf
specifies both paths as:
# Multiarch support
/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf
What am I doing wrong?
Thanks, Bruce