At Wed, 31 May 2006 02:31:49 +0200, Yoshinori K. Okuji wrote: > > On Wednesday 31 May 2006 00:00, Hollis Blanchard wrote: > > On Tue, 2006-05-30 at 22:59 -0500, Harley D. Eades III wrote: > > > http://lists.gnu.org/archive/html/grub-devel/2006-05/msg00106.html > > > > "host" and "target" are unclear to me here. For example, grub-emu would > > be compiled for the "host", but grub itself would be for the "target"? > > When would you ever want to build things differently like that? > > This is one of the requested features for GRUB. In GRUB Legacy, some group > developed GRUB on Sparc, but for PC by cross-compiling (actually, this was > Alcatel). It is a good thing that you can install GRUB for an architecture on > another.
It's actually a necessary feature for GRUB on amd64. On amd64 you have 64-bit executables but GRUB will run in 32-bit mode. When trying to compile on amd64 I already ran into some problems related to that. First of all on amd64 all binaries are run in 64-bit mode, so the host CFLAGS variable shouldn't have -m32. Secondly LIBS is for the host only and shouldn't be defined when running target tests. As last we set CFLAGS, CC, etc. to the TARGET_*, then we run some checks and change the TARGET_* flags without updating CC, CFLAGS, etc to the new version. The attached patch should fix those problems. I've tested it on i386-pc and x86_64. 2006-05-31 Jeroen Dekkers <[EMAIL PROTECTED]> * configure.ac: Don't set host_m32 for x86_64. Also reset LIBS for the target-specific tests. Make sure that we also have the up-to-date target variables for those tests. Index: configure.ac =================================================================== RCS file: /cvsroot/grub/grub2/configure.ac,v retrieving revision 1.29 diff -u -p -r1.29 configure.ac --- configure.ac 30 May 2006 00:32:29 -0000 1.29 +++ configure.ac 31 May 2006 19:51:10 -0000 @@ -41,7 +41,6 @@ AC_CANONICAL_HOST AC_CANONICAL_TARGET case "$host_cpu" in - x86_64) host_m32=1 ;; powerpc64) host_m32=1 ;; esac @@ -186,10 +185,12 @@ tmp_CC="$CC" tmp_CFLAGS="$CFLAGS" tmp_LDFLAGS="$LDFLAGS" tmp_CPPFLAGS="$CPPFLAGS" +tmp_LIBS="$LIBS" CC="$TARGET_CC" CFLAGS="$TARGET_CFLAGS" CPPFLAGS="$TARGET_CPPFLAGS" LDFLAGS="$TARGET_LDFLAGS" +LIBS="" if test "x$TARGET_CFLAGS" = x; then # debug flags. @@ -232,6 +233,12 @@ AC_SUBST(TARGET_CFLAGS) AC_SUBST(TARGET_CPPFLAGS) AC_SUBST(TARGET_LDFLAGS) +# Set them to their new values for the tests below. +CC="$TARGET_CC" +CFLAGS="$TARGET_CFLAGS" +CPPFLAGS="$TARGET_CPPFLAGS" +LDFLAGS="$TARGET_LDFLAGS" + # Defined in aclocal.m4. grub_PROG_OBJCOPY_ABSOLUTE grub_ASM_USCORE @@ -252,6 +259,7 @@ CC="$tmp_CC" CFLAGS="$tmp_CFLAGS" CPPFLAGS="$tmp_CPPFLAGS" LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" # Check for options. AC_ARG_ENABLE([mm-debug], _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel