This problem is caused by libgnatprj contains some object files which is for host only, while libgnatprj should be for target.
So, I defined USED_FOR_TARGET for libgnatprj built, and disable link with common-targhooks.o errors.o hooks.o prefix.o targetm.o these objects. I tested this package with native building on i386 and amd64, and cross build on i386 for ppc64el (gcc-6-cross) On Mon, May 16, 2016 at 4:33 PM, Matthias Klose <d...@debian.org> wrote: > On 14.05.2016 08:43, YunQiang Su wrote: >> >> It seems this problem has been solved? > > > no, all these cross compilers are just disabled. > > -- YunQiang Su
diff --git a/debian/patches/ada-gnattools-cross.diff b/debian/patches/ada-gnattools-cross.diff index d1eacec..9e01791 100644 --- a/debian/patches/ada-gnattools-cross.diff +++ b/debian/patches/ada-gnattools-cross.diff @@ -309,7 +309,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in ../stamp-gnatlib-$(RTSDIR): @if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \ then \ -@@ -2701,14 +2592,10 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD +@@ -2700,14 +2591,10 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD # Also install the .dSYM directories if they exist (these directories # contain the debug information for the shared libraries on darwin) for file in gnat gnarl; do \ @@ -326,7 +326,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \ $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \ $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ -@@ -2721,19 +2608,7 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD +@@ -2720,19 +2607,7 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads @@ -347,7 +347,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in $(RMDIR) $(RTSDIR) $(MKDIR) $(RTSDIR) $(CHMOD) u+w $(RTSDIR) -@@ -2798,7 +2673,7 @@ $(RTSDIR)/s-oscons.ads: ../stamp-gnatlib +@@ -2797,7 +2672,7 @@ $(RTSDIR)/s-oscons.ads: ../stamp-gnatlib $(OSCONS_EXTRACT) ; \ ../bldtools/oscons/xoscons s-oscons) @@ -356,7 +356,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in test -f $(RTSDIR)/s-oscons.ads || exit 1 # C files $(MAKE) -C $(RTSDIR) \ -@@ -2836,32 +2711,44 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../ +@@ -2835,32 +2710,44 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../ # Warning: this target assumes that LIBRARY_VERSION has been set correctly. gnatlib-shared-default: @@ -417,7 +417,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in gnatlib-shared-dual: $(MAKE) $(FLAGS_TO_PASS) \ -@@ -2871,9 +2758,8 @@ gnatlib-shared-dual: +@@ -2870,9 +2757,8 @@ gnatlib-shared-dual: GNATLIBLDFLAGS="$(GNATLIBLDFLAGS)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ @@ -429,7 +429,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ -@@ -2881,8 +2767,7 @@ gnatlib-shared-dual: +@@ -2880,8 +2766,7 @@ gnatlib-shared-dual: GNATLIBLDFLAGS="$(GNATLIBLDFLAGS)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ @@ -439,7 +439,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in gnatlib-shared-dual-win32: $(MAKE) $(FLAGS_TO_PASS) \ -@@ -2892,17 +2777,15 @@ gnatlib-shared-dual-win32: +@@ -2891,17 +2776,15 @@ gnatlib-shared-dual-win32: PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ @@ -460,7 +460,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in # ??? we need to add the option to support auto-import of arrays/records to # the GNATLIBFLAGS when this will be supported by GNAT. At this point we will -@@ -3152,6 +3035,68 @@ targext.o : targext.c +@@ -3151,6 +3034,68 @@ targext.o : targext.c $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \ $< $(OUTPUT_OPTION) @@ -542,27 +542,19 @@ Index: b/src/gnattools/Makefile.in # For finding the GCC build dir, which is used far too much GCC_DIR=../gcc -@@ -75,23 +75,159 @@ CXX_LFLAGS = \ - -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ - -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs +@@ -70,28 +70,167 @@ INCLUDES_FOR_SUBDIR = -iquote . -iquote + ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada --# 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" + CXX_LFLAGS = \ +- -B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ +- -B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ +- -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ +- -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs ++ -B../$(target_noncanonical)/libstdc++-v3/src/.libs \ ++ -B../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ ++ -L../$(target_noncanonical)/libstdc++-v3/src/.libs \ ++ -L../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs ++ +CFLAGS=-O2 -Wall +ADA_CFLAGS=-O2 -gnatn +ADA_INCLUDES=-nostdinc -I- -I. -I../gcc/ada/rts \ @@ -578,6 +570,7 @@ Index: b/src/gnattools/Makefile.in + +# We will use the just-built compiler to compile and link everything. +GCC=../gcc/xgcc -B../gcc/ ++GXX=../gcc/xg++ -B../gcc/ + +# File lists +# ---------- @@ -602,7 +595,8 @@ Index: b/src/gnattools/Makefile.in +GNATLINK_OBJS = \ +gnatlink.o \ +indepsw.o \ -+validsw.o ++validsw.o \ ++link.o + +GNATMAKE_OBJS = \ +aspects.o \ @@ -617,6 +611,7 @@ Index: b/src/gnattools/Makefile.in +sem_aux.o \ +usage.o \ +validsw.o \ ++link.o \ +$(EXTRA_GNATMAKE_OBJS) + +EXTRA_TOOLS_OBJS = \ @@ -677,13 +672,13 @@ Index: b/src/gnattools/Makefile.in +# gnatlink + +gnatlink-static: $(GNATLINK_OBJS) b_gnatl.o -+ $(GCC) -o $@ $^ \ ++ $(GXX) -o $@ $^ \ + ../$(target_noncanonical)/libgnatprj/libgnatprj.a \ + ../$(target_noncanonical)/libgnatvsn/libgnatvsn.a \ -+ ../gcc/ada/rts/libgnat.a $(STATIC_GCC_LIBS) $(LDFLAGS) ++ ../gcc/ada/rts/libgnat.a $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) + +gnatlink: $(GNATLINK_OBJS) b_gnatl.o -+ $(GCC) -o $@ $^ $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(LDFLAGS) ++ $(GXX) -o $@ $^ $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) + +b_gnatl.adb: $(GNATLINK_OBJS) + ../gcc/gnatbind -o $@ $(ADA_INCLUDES) gnatlink.ali @@ -691,13 +686,13 @@ Index: b/src/gnattools/Makefile.in +# gnatmake + +gnatmake-static: $(GNATMAKE_OBJS) b_gnatm.o -+ $(GCC) -o $@ $(ADA_CFLAGS) $^ \ ++ $(GXX) -o $@ $(ADA_CFLAGS) $^ \ + ../$(target_noncanonical)/libgnatprj/libgnatprj.a \ + ../$(target_noncanonical)/libgnatvsn/libgnatvsn.a \ -+ $(STATIC_ADA_LIBS) $(STATIC_GCC_LIBS) $(LDFLAGS) ++ $(STATIC_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) + +gnatmake: $(GNATMAKE_OBJS) b_gnatm.o -+ $(GCC) -o $@ $(ADA_CFLAGS) $^ $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(LDFLAGS) ++ $(GXX) -o $@ $(ADA_CFLAGS) $^ $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) + +b_gnatm.adb: $(GNATMAKE_OBJS) + ../gcc/gnatbind -o $@ $(ADA_INCLUDES) gnatmake.ali @@ -707,19 +702,36 @@ Index: b/src/gnattools/Makefile.in + cp -lp $< $@ + +gnatbind gnatchop gnatclean gnatcmd gnatfind gnatkr gnatls gnatname gnatprep \ -+gnatxref: ++gnatxref: link.o + if [ ! -f $@.adb ] ; then $(LN_S) ../../src/gcc/ada/$@.ad[bs] .; fi + ./gnatmake-static -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \ + --GCC="$(GCC)" \ + --GNATBIND=../gcc/gnatbind + ./gnatlink-static -o $@ $@.ali $^ \ -+ $(ADA_INCLUDES) $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(LDFLAGS) \ -+ --GCC="$(GCC) $(ADA_INCLUDES)" -+ ++ $(ADA_INCLUDES) $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) \ ++ --GCC="$(GXX) $(ADA_INCLUDES)" + +-# 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= \ -@@ -184,20 +320,12 @@ $(GCC_DIR)/stamp-tools: +@@ -184,20 +323,12 @@ $(GCC_DIR)/stamp-tools: $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));) touch $(GCC_DIR)/stamp-tools diff --git a/debian/patches/ada-libgnatprj.diff b/debian/patches/ada-libgnatprj.diff index 191f6fe..70043fa 100644 --- a/debian/patches/ada-libgnatprj.diff +++ b/debian/patches/ada-libgnatprj.diff @@ -1,3 +1,4 @@ +t # DP: - Introduce a new shared library named libgnatprj, containing # DP: the GNAT project file manager licensed under the pure GPL, for # DP: use in GNAT tools, GLADE and GPS. Link the GNAT tools against @@ -94,7 +95,7 @@ Index: b/src/libgnatprj/Makefile.in + +# Add some object files compiled from C sources. prefix.o requires +# some objects from libiberty and from gcc. -+OBJECTS += common-targhooks.o errors.o hooks.o link.o prefix.o targetm.o ++# OBJECTS += common-targhooks.o errors.o hooks.o link.o prefix.o targetm.o + +# These object files have already been built, both PIC and non-PIC. +# prefix.o depends on them. @@ -116,19 +117,19 @@ Index: b/src/libgnatprj/Makefile.in +$(addprefix obj-shared/,$(OBJECTS)): | stamp-libgnatprj-sources obj-shared + +obj-shared/%.o: %.adb -+ $(GCC) -c -fPIC $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) $< -o $@ ++ $(GCC) -c -fPIC $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) -DUSED_FOR_TARGET $< -o $@ + +obj-shared/%.o: %.ads -+ $(GCC) -c -fPIC $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) $< -o $@ ++ $(GCC) -c -fPIC $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) -DUSED_FOR_TARGET $< -o $@ + +obj-shared/%.o: %.c -+ $(GPP) -c -fPIC $(CFLAGS) -DHAVE_CONFIG_H -DIN_GCC -pedantic \ -+ -I@srcdir@/../gcc -I@srcdir@/../include -I@srcdir@/../libcpp/include -I../../gcc \ ++ $(GPP) -c -fPIC $(CFLAGS) -DHAVE_CONFIG_H -pedantic \ ++ -I@srcdir@/../gcc -I@srcdir@/../include -I@srcdir@/../libcpp/include -I../../gcc -DUSED_FOR_TARGET \ + $< -o $@ + +obj-shared/prefix.o: @srcdir@/../gcc/prefix.c + $(GPP) -c -fPIC $(CFLAGS) -DPREFIX=\"@prefix@\" -DBASEVER=\"$(BASEVER)\" \ -+ -I@srcdir@/../gcc -I@srcdir@/../include -I../../gcc -I@srcdir@/../libcpp/include \ ++ -I@srcdir@/../gcc -I@srcdir@/../include -I../../gcc -I@srcdir@/../libcpp/include -DUSED_FOR_TARGET \ + $< -o $@ + +obj-shared: @@ -142,19 +143,19 @@ Index: b/src/libgnatprj/Makefile.in +$(addprefix obj-static/,$(OBJECTS)): | stamp-libgnatprj-sources obj-static + +obj-static/%.o: %.adb -+ $(GCC) -c $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) $< -o $@ ++ $(GCC) -c $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) -DUSED_FOR_TARGET $< -o $@ + +obj-static/%.o: %.ads -+ $(GCC) -c $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) $< -o $@ ++ $(GCC) -c $(ADAFLAGS) $(LIBGNAT_JUST_BUILT) $(LIBGNATVSN) -DUSED_FOR_TARGET $< -o $@ + +obj-static/%.o: %.c -+ $(GPP) -c $(CFLAGS) -DHAVE_CONFIG_H -DIN_GCC -pedantic \ -+ -I@srcdir@/../gcc -I@srcdir@/../include -I@srcdir@/../libcpp/include -I../../gcc \ ++ $(GPP) -c $(CFLAGS) -DHAVE_CONFIG_H -pedantic \ ++ -I@srcdir@/../gcc -I@srcdir@/../include -I@srcdir@/../libcpp/include -I../../gcc -DUSED_FOR_TARGET \ + $< -o $@ + +obj-static/prefix.o: @srcdir@/../gcc/prefix.c + $(GPP) -c $(CFLAGS) -DPREFIX=\"@prefix@\" -DBASEVER=\"$(BASEVER)\" \ -+ -I@srcdir@/../gcc -I@srcdir@/../include -I../../gcc -I@srcdir@/../libcpp/include \ ++ -I@srcdir@/../gcc -I@srcdir@/../include -I../../gcc -I@srcdir@/../libcpp/include -DUSED_FOR_TARGET \ + $< -o $@ + +obj-static: