iains/gcc-12-branch

The directory that should contain system headers does not exist: /usr/include

mbicl opened this issue · 8 comments

mbicl commented

I've tried to install with this commands:
./contrib/download_prerequisites
./configure
make

and getting this error:
The directory that should contain system headers does not exist:
/usr/include
make[3]: *** [stmp-fixinc] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

Now what should I do?

iains commented

for modern macOS the include files are no longer stored in the file system root ( / ) so GCC cannot find them unless you tell it where they are.

If you have the Xcode command line tools installed (the easiest solution for a lot of Open Source stuff):

add --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk to the configure line

If you have only the Xcode app installed - you need to find the path inside Xcode - so add this to the configure line:

--with-sysroot=`xcrun --show-sdk-path`
iains commented

I've tried to install with this commands:
./contrib/download_prerequisites

./configure
make

This will fail even when you fix the sysroot. GCC does not support in-source builds you should make a separate build directory and

cd /path/to/build
/path/to/source/confiigure ... 
make 
mbicl commented

this didn't help

iains commented

this didn't help

there is no new information in this comment to help you - perhaps you could start by recording:

  • what your installation is (version of macOS, version of xcode/command line tools)
  • what (exactly) you are using as a configuration line.
  • what the error output is.

We build the compiler many times a week on versions of macOS from 10.5 to 12. The error you first reported is caused by missing system headers (usually because the sysroot specification is missing).

mbicl commented

this didn't help

there is no new information in this comment to help you - perhaps you could start by recording:

  • what your installation is (version of macOS, version of xcode/command line tools)
  • what (exactly) you are using as a configuration line.
  • what the error output is.

We build the compiler many times a week on versions of macOS from 10.5 to 12. The error you first reported is caused by missing system headers (usually because the sysroot specification is missing).

macOS version 12.6, xcode-select version 2395.

configuration line: ../gcc12/configure --with-sysroot=xcrun --show-sdk-path

error output:
The directory that should contain system headers does not exist:
/usr/include
make[3]: *** [stmp-fixinc] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

xcrun --show-sdk-path output:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

mbicl commented

My directories:

~/Downloads/gcc/gcc12 - source
~/Downloads/gcc/build - build path

I deleted all, download prerequesties and install with this commands:

../gcc12/configure --with-sysroot='xcrun --show-sdk-path'
make

getting error:

ld: Assertion failed: (_file->_atomsArrayCount == computedAtomCount && "more atoms allocated than expected"), function parse, file macho_relocatable_file.cpp, line 2061.
collect2: error: ld returned 1 exit status
make[6]: *** [libstdc++.la] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all] Error 2
make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

I think this error from my clang compiler

iains commented

this is #6

it is not a GCC problem - solutions are described here : #6 (comment)

iains commented

so I think the original reported error is resolved, and the second one reported is a duplicate (and fixed in Xcode 14.1(RC or release).