Re: Building gcc on macOS 10.15 Catalina is stage 1 only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Feb 2020 at 21:17, Dan Allen wrote:
>
> As an old retired compiler-writer, I build gcc every few weeks for fun, and I like to benchmark the builds, examine generated code, etc.
>
>    ->  http://dkallen.org/BuildingGCC.htm
>
> This all ended a few months ago, as Apple’s Xcode 11 world on macOS 10.15 Catalina no longer has a /usr/include.  With Xcode 11 one could in 10.14 Mojave install /usr/include, but this no longer works in Catalina.  Apple moved lib and include into a new developer location.  You can determine where /usr is via their xcrun tool, e.g.,
>
> [~] 14:04:01 % xcrun --show-sdk-path
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
>
> [~] 14:06:14 % ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr
> bin/            include/        lib/            libexec/        share/
>
> You cannot create /usr anything, except within /usr/local, due to new read-only file systems around the OS and its folders.  It is supposed to be more secure, but it is really a gigantic pain.
>
> So, with that background, building gcc works, but just for stage-1.  This is because clang (used for the first build) knows all about the new developer tool path.  Once a stage-1 gcc is built, gcc looks for /usr/include and dies, even with using -sysroot, or -isysroot, or a variety of other flags that I have tried.
>
> So gcc gurus, how does one fix this?  I have tried bootstrap-building the latest snapshots of gcc 7, 8, 9, and 10, all with the same result: failure.
>
> Thanks,
>
> Dan Allen
>

>From one of our darwin maintainers:

If one is using xcode installed in /Applications .. and one is not going to
move it ...

/path/to/src/configure --prefix=/where/you/want/it
--with-sysroot=`xcrun --show-sdk-path` --…any other configure stuff

======

there is a second approach.

If one installs the “command line tools” then the SDK is installed in a
Well Known Place:

  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

one can then use

/path/to/src/configure —prefix=/where/you/want/it
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk --…
any other configure stuff

=====

GCC from 7 onwards also supports SDKROOT so one can
export SDKROOT=`xcrun --show-sdk-path`




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux