On Mon, 13 Aug 2007 00:31:35 +0100
Neil Williams <[EMAIL PROTECTED]> wrote:

> On Mon, 13 Aug 2007 00:57:04 +0200
> Julien Cristau <[EMAIL PROTECTED]> wrote:
> 
> > On Sun, Aug 12, 2007 at 23:21:05 +0100, Neil Williams wrote:
> > 
> > > I'm not sure why you thought this would work because the debdiff
> > > contained no changes that would have resulted in the src/utils/Makefile
> > > using gcc in place of arm-linux-gnu-gcc because the critical variables
> > > are defined BEFORE CC_FOR_BUILD is even specified. THAT is why I had to
> > > use override.

I've identified the problem now - it is a bug in the dpkg-cross
diversion of dpkg-buildpackage where $ENV{'MAKEFLAGS'} is overridden to
force CC=arm-linux-gnu-gcc on the make command line, hence the need for
'override' to undo it. Oops.

The current version of libx11-6 in unstable does still fail to
cross-build with the same error, so this bug still applies (for now).

The first patch works "in upstream mode", i.e. if autoconf and automake
are added to debian/rules so that the Makefile.in is refreshed and a
refreshed configure script generated to put those changes into
obj-foo/src/util/Makefile. (AC_SUBST is not needed).

Feel free to commit that first patch upstream (reproduced here unchanged):

>From f438f69ee4246fb27053426a285d1d6ffa7fa60e Mon Sep 17 00:00:00 2001
From: Julien Cristau <[EMAIL PROTECTED]>
Date: Sun, 12 Aug 2007 16:54:48 +0200
Subject: [PATCH] Build makekeys with CC_FOR_BUILD to fix cross-compiling

makekeys is run during the build process, so needs to be built
with a native compiler.
---
 configure.ac         |    6 ++++++
 src/util/Makefile.am |    3 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index f49b9ed..3125dc4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,12 @@ AC_CONFIG_HEADER([include/X11/XlibConf.h])
 AC_PROG_LIBTOOL
 AC_PROG_CC
 
+if test x"$cross_compiling" = xyes; then
+       AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
+else
+       CC_FOR_BUILD="$CC"
+fi
+
 XORG_PROG_RAWCPP
 
 # Build with XCB support?
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 3ff421d..c9e81c0 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -4,8 +4,7 @@ noinst_PROGRAMS=makekeys
 
 makekeys_CFLAGS=$(X11_CFLAGS)
 
-#override CC = gcc
-LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CC = @CC_FOR_BUILD@
 
 EXTRA_DIST = mkks.sh
 
-- 
1.5.2.4

> I think this is a completely different bug.
> Note that the actual values of the variables are NOT taken from the
> Makefile but from dpkg-buildpackage unless 'override' forces the
> reverse handling, as documented in GNU make.

Which turned out to be the dpkg-cross bug.

Sorry to have taken up so much of your time on this one.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

Attachment: pgpIOTxWQzS5T.pgp
Description: PGP signature

Reply via email to