A change made earlier this year[1] is causing troubles on the MacPorts build of GCC. MacPorts sets `--includedir=` to a directory that does not exist until after the build is complete. Since `@includedir@` is not `$(prefix)/include` and `$(prefix)/include` does not exist during the build, the Makefile exits[2]. [1] https://gcc.gnu.org/g:59e4c98173a79fcaa2c33253261409f38856c384 [2] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/Makefile.in;h=6001c9e3b559a90291b4d571c2410db6da4ede94;hb=59e4c98173a79fcaa2c33253261409f38856c384#l3273
I think we've hit this too in Gentoo but I hadn't reported it yet as I hadn't investigated, so I just worked around it.
Can you give me the configure command, so that I can have a test.
Since it doesn't exist, why use --includedir with it? Anyway, so, maybe we should detect the existence of this dir. Can you have a try of this patch? --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -560,10 +560,11 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h # Default native SYSTEM_HEADER_DIR, to be overridden by targets. NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. -ifeq (@includedir@,$(prefix)/include) - CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ -else - CROSS_SYSTEM_HEADER_DIR = @includedir@ +CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ +ifneq (@includedir@,$(prefix)/include) + ifneq (,$(wildcard @includedir@)) + CROSS_SYSTEM_HEADER_DIR = @includedir@ + endif endif
(In reply to YunQiang Su from comment #2) > Can you give me the configure command, so that I can have a test. The pertinent part of the configure command is `configure --prefix=/opt/local --includedir=/opt/local/include/gcc --libdir=/opt/local/lib/libgcc`
(In reply to YunQiang Su from comment #3) > Since it doesn't exist, why use --includedir with it? /opt/local/include/gcc is where the header files will be installed after the build, so there is no reason for it to exist before the build. > Anyway, so, maybe we should detect the existence of this dir. > Can you have a try of this patch? > > --- a/gcc/Makefile.in > +++ b/gcc/Makefile.in > @@ -560,10 +560,11 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h > # Default native SYSTEM_HEADER_DIR, to be overridden by targets. > NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ > # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. > -ifeq (@includedir@,$(prefix)/include) > - CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ > -else > - CROSS_SYSTEM_HEADER_DIR = @includedir@ > +CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ > +ifneq (@includedir@,$(prefix)/include) > + ifneq (,$(wildcard @includedir@)) > + CROSS_SYSTEM_HEADER_DIR = @includedir@ > + endif > endif Yes, this seems to work. Thank you very much.
(In reply to Marcus Calhoun-Lopez from comment #5) > (In reply to YunQiang Su from comment #3) > > Since it doesn't exist, why use --includedir with it? > > /opt/local/include/gcc is where the header files will be installed after the > build, so there is no reason for it to exist before the build. > Normally, we build gcc for 1st stage with/without --includedir, and then build libc with 1st stage gcc, and install the libc into the destination. Then we build gcc stage2 with --includedir. Ohh, in fact that I am worrying that both you and I have a mistake: the --includedir may be used for host instead of target. Should we introduce a new build-time option? Background: I add this patch due to Debian's cross toolchain install headers into /usr/<triple>/include instead of /usr/<triple>/sys-include
Maybe this patch is better --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -560,11 +560,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h # Default native SYSTEM_HEADER_DIR, to be overridden by targets. NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. -ifeq (@includedir@,$(prefix)/include) - CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ -else - CROSS_SYSTEM_HEADER_DIR = @includedir@ -endif +CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ # autoconf sets SYSTEM_HEADER_DIR to one of the above. # Purge it of unnecessary internal relative paths @@ -581,7 +577,10 @@ BUILD_SYSTEM_HEADER_DIR = `echo @BUILD_SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/] STMP_FIXINC = @STMP_FIXINC@ # Test to see whether <limits.h> exists in the system header files. -LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ] +LIMITS_H_TEST = headdir=$(BUILD_SYSTEM_HEADER_DIR) && \ + headdir_sys=`echo $$headdir | grep '/sys-include$$'` && \ + headdir_nosys=`echo $$headdir | sed 's/sys-include/include/'` && \ + [ -f $$headdir/limits.h -o -n $$headdir_sys -a -f "$$headdir_nosys/limits.h" ] # Directory for prefix to system directories, for # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc. Background: For cross/no-with-sysroot, the BUILD_SYSTEM_HEADER_DIR value will be `$(gcc_tooldir)/sys-include`. Here, `sys-include` is used by `--with-headers` option. So let's detect $(gcc_tooldir)/include too.