Source: gcc-8
Version: 8.3.0-2
Tags: patch upstream
User: helm...@debian.org
Usertags: rebootstrap

gcc-8 fails to cross build from source.

http://crossqa.subdivi.de/build/gcc-8_8.3.0-2_ppc64el_20190301030546.log
| powerpc64le-linux-gnu-g++-8 -fno-PIE -c -g -O2 -DIN_GCC -fno-exceptions 
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings 
-Wcast-qual -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings 
-DHAVE_CONFIG_H -I. -Id -I../../src/gcc -I../../src/gcc/d 
-I../../src/gcc/../include -I../../src/gcc/../libcpp/include 
-I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/dpd 
-I../libdecnumber -I../../src/gcc/../libbacktrace -o d/idgen.dmdgen.o -MT 
d/idgen.dmdgen.o -MMD -MP -MF d/.deps/idgen.dmdgen.TPo -I../../src/gcc/d 
-I../../src/gcc/d/dfrontend -Id ../../src/gcc/d/dfrontend/idgen.c
| g++    -o d/idgen d/idgen.dmdgen.o
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: Relocations in generic ELF (EM: 21)
| /usr/bin/ld: d/idgen.dmdgen.o: error adding symbols: file in wrong format
| collect2: error: ld returned 1 exit status
| make[4]: *** [../../src/gcc/d/Make-lang.in:312: d/idgen] Error 1
| make[4]: Leaving directory '/<<PKGBUILDDIR>>/build/gcc'
| make[3]: *** [Makefile:4305: all-gcc] Error 2
| make[3]: Leaving directory '/<<PKGBUILDDIR>>/build'
| make[2]: *** [Makefile:907: all] Error 2
| make[2]: Leaving directory '/<<PKGBUILDDIR>>/build'

It uses the host architecture compiler to compile idgen.c and then tries
to link it with the build architecture compiler. It really wants to run
idgen, so using the build architecture compiler is correct. The attached
patch fixes that and makes gcc-8 cross buildable. Please consider
applying it.

Helmut
--- gcc-8-8.2.0.orig/src/gcc/d/Make-lang.in
+++ gcc-8-8.2.0/src/gcc/d/Make-lang.in
@@ -315,7 +315,7 @@
 	+$(LINKER_FOR_BUILD) $(BUILD_LINKER_FLAGS) $(BUILD_LDFLAGS) -o $@ $^
 
 d/idgen.dmdgen.o: d/dfrontend/idgen.c
-	$(filter-out -fprofile-%,$(DMD_COMPILE)) $(D_INCLUDES) $<
+	$(filter-out -fprofile-%,$(DMDGEN_COMPILE)) $(D_INCLUDES) $<
 	$(POSTCOMPILE)
 
 d/impcnvgen.dmdgen.o: $(srcdir)/d/dfrontend/impcnvgen.c

Reply via email to