Hello Rainer,
thanks for the patch, but I think it’s only a work-around to part of the
problem and there are alternate strategies for the “usual case” on
MacOS/Darwin.
Keller, Rainer <rainer.kel...@hs-esslingen.de> wrote:
the following is required to allow bootstrap in libcc1 during stage3 on
MacOS Catalina (10.15). libcc1 invokes g++ with —nostdinc++
MacOS Catalina doesn’t provide /usr/include anymore, instead one builds
with:
OSX_SDK_VERSION=`xcodebuild -showsdks | grep 'macOS\ 10' | cut -f2- -d'-'
| cut -f2 -d' '`
OSX_SDK_PATH=`xcodebuild -sdk $OSX_SDK_VERSION -version | grep -E '^Path:
' | cut -f2 -d' '`
configure … --with-build-sysroot=$OSX_SDK_PATH
—with-build-sysroot= is known to have some problems;
see, for example, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
There is also a current series of patches on the topic from Maciej Rozicki.
I’m not sure what the intent is in using it in the MacOS builds - since I
expect you will be using the same sysroot (SDK) at run time as you are at
build time?
====
—with-sysroot= does, however, work (we also now honour SDKROOT in trunk,
open branches and gcc-7, but not on gcc-6 or gcc-5 [I will probably do some
Darwin-specific extra patches for the closed branches at some point])
I have sucessfully bootstrapped and tested on Catalina see (for example):
https://gcc.gnu.org/ml/gcc-testresults/2019-11/msg01492.html
Usually, I am using the command line tools, so the installation is not
going to move….
… however, if you configure with “—with-sysroot=$OSX_SDK_PATH” and then the
path moves (e.g. you relocate XCode) then you would have to supply the SDK
position at runtime anyway (either by setting SDKROOT or by passing
—sysroot=$NEW_SDK_POSITION for each compilation line)
GMP however is installed elsewhere (by Homebrew, MacPorts etc), so ignore
any -nostdinc
it also works to symlink the sources for gmp, mpfr, mpc (and isl, if you
use it) into the source tree - those then get boostrapped along with the
compiler and there are no resulting external dependencies (which I find
preferable).
However, —with-gmp= etc should also work with it (I’ll take a look at that
case).
Please note, I am not subscribed to the list.
HTH,
Iain
Best regards,
Rainer Keller
gcc/Changelog:
* Have gmp.h be found outside of sysroot
--
Index: gcc/system.h
===================================================================
--- gcc/system.h (revision 278783)
+++ gcc/system.h (working copy)
@@ -684,7 +684,7 @@
/* Do not introduce a gmp.h dependency on the build system. */
#ifndef GENERATOR_FILE
-#include <gmp.h>
+#include "gmp.h"
#endif
/* Get libiberty declarations. */