crosscompiling to Darwin and -Xd causes linkage fail
Original Reporter info from Mantis: koda
-
Reporter name:
Original Reporter info from Mantis: koda
- Reporter name:
Description:
I'm crosscompiling Hedgewars' engine from Ubuntu 12.04 targetting Darwin 10.6.
The cross environment is working fine and it has been used to compile fpc 2.6.0
The fpc help command suggests to use -Xd to perform a crosscompile; however if you do, then linkage will fail, claiming that /usr/lib/crt1.o is not found. That happens because ppaslink.sh contains an hardcoded /usr/lib/crt1.o and no matter which library search path (-XR) you pass, linkage will fail.
However, when you don't add -Xd, then the correct path from the -XR command is computed and the correct path for crt1.o will be added in ppaslink.sh.
The fact that Xd prevents standard library search path should not prevent the possibility of adding a search path, something which is usually done when crosscompiling.
Steps to reproduce:
Install Ubuntu, an Apple cross binutils (such as https://launchpad.net/~flosoft/+archive/cross-apple), compile the latest fpc and then try to crosscompile your software (such as hedgewars engine hedgewars.googlecode.com).
Additional information:
I've had a discussion on this with oliebol, I'm adding more information for future reference.
the linker searches in the librarysearchpath for it [crt1.o]; if it can't find it, it hardcodes startupfile. Under darwin sysroot/usr/lib is added to the libsearchpath.
As far as I can see it should then be found. There was a dontlinkstdlibpath around it, that is -Xd :-) (t_bsd:129 if interested)
Mantis conversion info:
- Mantis ID: 21963
- OS: Ubuntu (host) Darwin (target)
- OS Build: 12.04 / 10.6
- Platform: x86_64
- Version: 2.6.0
- Fixed in revision: 21248 (#64f3ba32)