[fpc-devel] Issue with Compiling FPC and MacOS Big Sur

Jonas Maebe jonas at freepascal.org
Sun Nov 15 14:08:29 CET 2020


On 14/11/2020 16:51, Michael Ring via fpc-devel wrote:
> Hi Jonas, thank you for your answer!
> 
> I cannot say if I did see a warning or not when installing fpc-package
> but I did not reinstall commandline tools before or after installing the
> 3.2.0 compiler. They have been on all of my Macs for years.

They usually get removed when you upgrade to a new macOS version.

> What are you doing in the installer that creates that dependency?
> 
> My guess would be that you rewrite /etc/fpc.cfg (I think I saw on one of

That is correct.

> my Macs that the timestamp of that file changed), but this will not help
> for compiling the compiler as the compiler is beeing compiled with the
> flag -n which effectively turns off reading /etc/fpc.cfg.

Indeed, I glossed over the fact that you were rebuilding FPC.

> make clean all
> OPT="-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
> -Ff/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"

You should use the -XR parameter
(-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk) instead of
-Fl/Ff in this situation.

> So I guess the best solution would be to change the compiler Makefiles
> to add the Fl/Ff parameter to the compile when on a Mac. I am currently
> investigating this, what do you think, could that solve the issue once
> and for all? (We have already had this kind of conversation several
> times over the last years, usually on crt1.o
> 
> Fixing the Makefile will make this work for already existing compilers,
> I'd still propose to add this path from within fpc, when the linker
> commands are generated.
> 
> Or am I missing something ?

>From the top of my head:
1) it won't work when cross-compiling on another platform, because xcrun
won't exist there. So it would create (invisible) compiler behaviour
differences depending on whether or not you're cross-compiling.
2) if someone compiles on macOS itself using a non-default SDK (e.g. to
build i386 binaries on 10.15+, or PPC/PPC64 binaries on 10.6+), this
should not be done. I could detect this by looking at whether or not a
-XR parameter is specified, but if someone uses -Fl/Ff instead, I have
no idea what would happen when mixing SDKs like that (and that, again,
could lead to very hard to debug problems).


Jonas


More information about the fpc-devel mailing list