rth at gcc dot gnu.org <gcc-bugzilla <at> gcc.gnu.org> writes: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61201 > > Bug ID: 61201 > Summary: Cross compile fails with SPARK_05 undefined > Product: gcc > Version: unknown > Status: UNCONFIRMED > Severity: normal > Priority: P3 > Component: ada > Assignee: unassigned at gcc dot gnu.org > Reporter: rth at gcc dot gnu.org > > restrict.ads:145:07: "SPARK_05" is undefined (more references follow) > gnatmake: "/home/rth/work/gcc/git-4.9/gcc/ada/ali-util.adb" compilation error > make[3]: *** [gnatmake-re] Error 4 > make[3]: Leaving directory `/home/rth/work/gcc/bld-arm/gcc/ada/tools' > make[2]: *** [gnattools-cross] Error 2 > make[2]: Leaving directory `/home/rth/work/gcc/bld-arm/gnattools' > make[1]: *** [all-gnattools] Error 2 > make[1]: Leaving directory `/home/rth/work/gcc/bld-arm' > make: *** [all] Error 2 > > While this specific case is x86_64 cross arm, it happens with several > other cross-compilation targets as well. > >
In template file gcc-x.x.x/gcc/gnattools\Makefile.in, there are some variables showing: # Variables for gnattools, native TOOLS_FLAGS_TO_PASS_NATIVE= \ "CC=../../xgcc -B../../" \ "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "ADAFLAGS=$(ADAFLAGS)" \ "ADA_CFLAGS=$(ADA_CFLAGS)" \ "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ "exeext=$(exeext)" \ "fsrcdir=$(fsrcdir)" \ "srcdir=$(fsrcdir)" \ "GNATMAKE=../../gnatmake" \ "GNATLINK=../../gnatlink" \ "GNATBIND=../../gnatbind" \ "TOOLSCASE=native" # Variables for regnattools TOOLS_FLAGS_TO_PASS_RE= \ "CC=../../xgcc -B../../" \ "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ "CFLAGS=$(CFLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "ADAFLAGS=$(ADAFLAGS)" \ "ADA_CFLAGS=$(ADA_CFLAGS)" \ "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ "exeext=$(exeext)" \ "fsrcdir=$(fsrcdir)" \ "srcdir=$(fsrcdir)" \ "GNATMAKE=../../gnatmake" \ "GNATLINK=../../gnatlink" \ "GNATBIND=../../gnatbind" \ "TOOLSCASE=cross" ...... TOOLS_FLAGS_TO_PASS_CROSS= \ "CC=$(CC)" \ "CXX=$(CXX)" \ "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "ADAFLAGS=$(ADAFLAGS)" \ "ADA_CFLAGS=$(ADA_CFLAGS)" \ "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ "ADA_INCLUDES=-I$(RTS_DIR)/../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \ "exeext=$(exeext)" \ "fsrcdir=$(fsrcdir)" \ "srcdir=$(fsrcdir)" \ "GNATMAKE=$(GNATMAKE_FOR_HOST)" \ "GNATLINK=$(GNATLINK_FOR_HOST)" \ "GNATBIND=$(GNATBIND_FOR_HOST)" \ "TOOLSCASE=cross" \ "LIBGNAT=" . Notice environment variable "ADA_INCLUDES" sent to Makfile in subdirectory, for native building, it is assigned to the ada include directory of source files, but for cross building it is assigned to the ada include directory of build toolchain. So for cross building, if the version of the source is different from the version of the toolchain, there may be some conflicts, such as constants declaration changes like "SPARK"-->"SPARK_05". Therefore, for cross building new toolchain, it is better to build a piece of native toolchain of the target version(upgrade or download) first, then using the new native toolchain of the same version to build the target cross toolchain. This will avoid the potential conflicts.