Andris Pavenis wrote:
Configuring in p/rts fails when host!=build (for example when building native compiler for DJGPP or MINGW under Linux) as newly built xgcc and xgpc cannot be run on build system. In this case we should run corresponding cross-compiler instead.
Yes, I regularly do cross-compilations, including canadian cross. I set GCC_FOR_TARGET and GPC_FOR_TARGET on the command line, then it works for me. Since command line settings take precendence in make, this will override the default `GPC_FOR_TARGET = ./xgpc -B./'.
I'm not sure if that's how it's supposed to be done, but AFAICS, GCC_FOR_TARGET is not set automatically when configuring for a cross-build. Or did I miss this somehow (or is this different in gcc-2.95.x -- I'm using gcc-2.8.1)?
Included patch is tested only for --build=i686-pc-linux-gnu, --host=i586-mingw32msvc --target=i586-mingw32msvc
Andris
--- gpc-20010924/p/Make-lang.in~1 Mon Sep 24 19:59:48 2001 +++ gpc-20010924/p/Make-lang.in Tue Oct 30 17:57:24 2001 @@ -154,8 +154,12 @@ ADD_RTS_PARENT_DIR = sed -e 's,-B([^/][^:]),-B../../\1,g;s,^([^/][^:]),../../\1,'
# The ' ' is there so, e.g., `-B.' will be replaced by ADD_RTS_PARENT_DIR -RTS_COMPILERS = CC="`echo $(GCC_FOR_TARGET)' ' | $(ADD_RTS_PARENT_DIR)`" \
PC="`echo $(GPC_FOR_TARGET)' ' | $(ADD_RTS_PARENT_DIR)`"
+RTS_COMPILERS = CC="`if test "$(build_canonical)" = "$(host_canonical)" ; then \
echo $(GCC_FOR_TARGET)' ' | $(ADD_RTS_PARENT_DIR); \
else echo $(GCC_FOR_TARGET); fi`" \
PC="`if test \"$(build_canonical)\" = \"$(host_canonical)\" ; then \
echo $(GPC_FOR_TARGET)' ' | $(ADD_RTS_PARENT_DIR);\
else echo $(GPC_FOR_TARGET); fi`"
GPC_GENERATED_SRC = \ $(srcdir)/p/parse.c \
I don't quite understand what this patch does. AFAICS, it skips $(ADD_RTS_PARENT_DIR) in a cross-build. But $(ADD_RTS_PARENT_DIR) only adds the necessary ../.. to relative paths (since the configure and make of the RTS change to p/rts), and leaves absolute paths unchanged (at least this is what it's supposed to do, unless there's a mistake in the regex).
So, how should this solve the problem if gpc is `./xgpc -B./'? It would not set GPC_FOR_TARGET to <prefix>/bin/i586-mingw32msvc-gpc, and it would omit the ../../, so it searches for xgpc in the p/rts build directory!?
Since it works for you, I must be missing something ...
Frank