[fpc-devel] Crosscompiling win towards darwin

Sven Barth pascaldragon at googlemail.com
Mon Nov 21 14:39:43 CET 2016

Am 21.11.2016 11:40 schrieb "Alfred" <alfred at consulab.nl>:
> Well.
> All files that are needed by the linker, have to be found by the linker.
> The osxcrosstools use a findfile process that is a bit peculiar. And not
fully understood by me. Perhaps you can help.
> c++ code.
> findFile(path):
> Options::FileInfo Options::findFile(const std::string &path) const
> calls:
> if ( findFile(path, {".tbd"}, result) )
> return result;
> findFile(path,{...},result):
> bool Options::findFile(const std::string &path, const
std::vector<std::string> &tbdExtensions, FileInfo& result) const
> calls
> for ( const auto &ext : tbdExtensions ) {
> auto newPath = replace_extension(path, ext);
> bool found = tbdInfo.checkFileExists(*this, newPath.c_str());
> }
> So, as far as I understand correctly, if a fpc abc.o file is presented
towards the linker, it replaces the extension with tbd and goes looking for
> I checked: if I add a dummy abc.tbd in the same location, all goes well.
> That why I patched the search-process. But this very rude patch only took
care of .o files.
> I forgot about the .or files.
> Trying new patches at the moment to no avail unfortunately.

IMHO they should first try to match the file as-is and only then use their
own extension.
So your patch of Options::findFile should first check the passed on file
name path and if that's found fill the result information as is done when
the loop sets result to true. Only if that fails it should loop.
If that works you might want to present the patch to the developers.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20161121/8b52f174/attachment.html>

More information about the fpc-devel mailing list