Re: Building GCC on arm macOS

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

 



On Wed, Feb 17, 2021 at 01:50:26PM +0000, Iain Sandoe wrote:
> Roman Bolshakov <r.bolshakov@xxxxxxxxx> wrote:
> 
> > On Wed, Feb 17, 2021 at 10:35:59AM +0000, Iain Sandoe wrote:
> > > Roman Bolshakov <r.bolshakov@xxxxxxxxx> wrote:
> > > 
> > > > stage1 of GCC build (master branch as of yesterday) fails with the error:
> > > > 
> > > > *** Configuration aarch64-apple-darwin20.3.0 not supported
> > > > make[2]: *** [configure-stage1-gcc] Error 1
> > > > make[1]: *** [stage1-bubble] Error 2
> > > > make: *** [all] Error 2
> > > > 
> > > > Is it expected issue?
> > > 
> > > Yes, that’s expected (it is not a bug).
> > > 
> > > > I had impression that GCC works on Apple Silicon
> > > > macs.
> > > 
> > > There is an experimental branch here :
> > > https://github.com/iains/gcc-darwin-arm64
> > > 
> > > but it is not yet ready for inclusion in GCC master,
> 
> > Thanks for the reference.
> > I'm trying to build from your master-wip-apple-si branch and it doesn't
> > build too:
> > 
> > The directory that should contain system headers does not exist:
> >  /usr/include
> 
> (this is not specific to Arm64 - it applies to building for x86_64 on modern
> macOS).
> 
> These days (on macOS) there are no headers installed in /usr/include even
> when the developer tools are installed.
> 
> So, you have to configure a path to the SDK [which contains the headers and
> the library stubs] (from, say, an installation of the command line tools -
> or from Xcode).
> 
> Two approaches:
> 
> 1) [this is what I tend to use]
> 
> Install the command line tools.
> Now there will be an SDK at
> /Library/Developer/CommandLineTools/SDKs/MacOS.sdk
> 
> so you can configure with…
> /path/to/source/configure —prefix=….
> —with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOS.sdk ….
> 
> 2) You can ask where the SDK is for an installation with Xcode only.
> 
> /path/to/source/configure —prefix=…. —with-sysroot=`xcrun —show-sdk-path`  ….
> 
> ====
> 
> In general, it is best not to add configuration options unles you know *why*
> you’re adding them - but for modern macOS, it is a good idea to avoid the
> default install path /usr/local … most people install now into /opt/…..
> 
> You can find general information on building GCC here :
> https://gcc.gnu.org/install/
> 
> =====
> 
> My configure lines look like this:
> 
> /src-local/gcc-master/configure
> --prefix=/opt/iains/aarch64-apple-darwin20/gcc-11-0-0
> --build=aarch64-apple-darwin20
> --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
> --disable-libstdcxx-pch --enable-languages=all
> 

Thanks, Iain!

--with-sysroot helped. That's my config:

./configure --with-gmp=$(brew --prefix gmp) \
            --with-mpfr=$(brew --prefix mpfr) \
            --with-mpc=$(brew --prefix libmpc) \
            --with-sysroot=$(xcrun -show-sdk-path)

I wonder if we should set --with-sysroot implicitly on modern macOS?

> and you can see some test results here:
> 
> https://github.com/iains/gcc-darwin-arm64/issues/30
> 

I see, there're test failures that should be fixed before merging the
port.

Regards,
Roman



[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