Colin Watson wrote:
> On Sat, Nov 17, 2007 at 08:28:35PM +0000, Neil Williams wrote:
>> Colin Watson wrote:
> Please explain in detail.

Despite any changes made in 3.5.14, passing --build and --host does not
cause base-passwd to set $(CC) correctly, instead it insists on using cc
which is a symlink to gcc. The build log ends with:

Running build checks ....
        debian/tmp/usr/sbin/update-passwd
ERROR: 1 of 1 files found for the wrong architecture: x86-64!
0 of 1 files found for: arm
FAIL: /usr/bin or /bin/ contain files for the wrong architecture!

This after only changing:
-+CC=$(DEB_HOST_GNU_TYPE)-gcc
++#CC=$(DEB_HOST_GNU_TYPE)-gcc

in the emdebian patch files (from which the patch in this report is
derived).

> I'm not somebody who applies any patch he's
> given without explanation of why it is required; given that as far as I
> can see they ought to work fine,

Then base-passwd has upstream bugs because it does not work.

> I need a specific rationale for why
> autotools-dev's recommendations don't work in this case before I make
> further changes.

OK.

dpkg-source: warning: source directory './base-passwd-3.5.14' is not
<sourcepackage>-<upstreamversion> 'base-passwd-3.5.14em1'
dpkg-source: building base-passwd in base-passwd_3.5.14em1.tar.gz
dpkg-source: building base-passwd in base-passwd_3.5.14em1.dsc
 debian/rules build
CC=cc CFLAGS="-g -O2 -Wall" ./configure --build x86_64-linux-gnu --host
arm-linux-gnu
configure: loading site script /etc/dpkg-cross/cross-config.arm
checking for arm-linux-gnu-gcc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes

You can see here that CC is being set BEFORE configure is run, therefore
the effect of --build and --host is limited only to values interpreted
by ./configure and stored in config.h. The --build and --host settings
do NOT make it into the Makefile because $(MAKE) has been specifically
instructed to use CC=cc.

Therefore I have to reset the value of $(CC) in debian/rules so that the
correct build does:

dpkg-source: warning: source directory './base-passwd-3.5.14' is not
<sourcepackage>-<upstreamversion> 'base-passwd-3.5.14em1'
dpkg-source: building base-passwd in base-passwd_3.5.14em1.tar.gz
dpkg-source: building base-passwd in base-passwd_3.5.14em1.dsc
 debian/rules build
CC=arm-linux-gnu-gcc CFLAGS="-g -O2 -Wall" ./configure --build
x86_64-linux-gnu --host arm-linux-gnu
configure: loading site script /etc/dpkg-cross/cross-config.arm
checking for arm-linux-gnu-gcc... arm-linux-gnu-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes

..

make[1]: Entering directory
`/opt/emdebian/trunk/b/base-passwd/trunk/base-passwd-3.5.14'
arm-linux-gnu-gcc -g -O2 -Wall -DHAVE_CONFIG_H -I.   -c -o
update-passwd.o update-passwd.c
arm-linux-gnu-gcc  -o update-passwd update-passwd.o

Note that in BOTH cases, ./configure still believes that we are cross
compiling but the package fails to obey ./configure because $(CC) has
been overridden in the call to $(MAKE).

If base-passwd is going to continue setting $(CC) in advance of running
./configure, Emdebian has no alternative but to require that the value
of $(CC) is overridden to $(DEB_HOST_GNU_TYPE)-gcc when cross compiling
and left as cc when building natively.

If base-passwd just ran:
./configure ($CROSS)
(as the autools docs recommend), then CC would not be needed as it
would, indeed, be actually set where you currently expect it to be set -
by configure and dependent on --build and --host.

> Bear in mind that the version against which you filed your bug used
> Autoconf 2.13; however, the version I had just uploaded the previous day
> upgraded to Autoconf 2.61.

I always build against the latest available Debian source because
emsource (part of emdebian-tools) runs apt-get source and cron-apt runs
apt-get update daily for each of my boxes running sid. After filing the
bug, I refreshed the Emdebian build for 3.5.14 - standard practice now
so that Emdebian can progress towards a genuine cross-building
autobuilder. (emtargetcmp from the emdebian-tools package handles the
comparison so it is trivial to identify the packages that have been
updated since the last Emdebian build.)

With CC reset to the cross compiler, my build checks give:

Running build checks ....
        debian/tmp/usr/sbin/update-passwd
Architecture check successful. One file for arm.
Checking debian/postinst ....
locale check successful for base-passwd 3.5.14em1
4 checks successful.
Changes file:
/opt/emdebian/trunk/b/base-passwd/trunk/base-passwd_3.5.14em1_arm.changes
Format: 1.7
Date: Tue, 13 Nov 2007 11:47:52 +0000
Source: base-passwd
Binary: base-passwd
Architecture: source arm
Version: 3.5.14em1
Distribution: unstable
Urgency: low
Maintainer: Colin Watson <[EMAIL PROTECTED]>
Changed-By: Neil Williams <[EMAIL PROTECTED]>
Description:
 base-passwd - Debian base system master password and group files
Changes:
 base-passwd (3.5.14em1) unstable; urgency=low
 .
   * New emdebian release.
Files:
 29f020d24ca528478c68e3aab8d5507b 279 admin required
base-passwd_3.5.14em1.dsc
 8ef0a218081ad393fc9e45842e3ccc34 68952 admin required
base-passwd_3.5.14em1.tar.gz
 74a8da23f9fc8dbd20384aa9a06cfe0c 11064 admin required
base-passwd_3.5.14em1_arm.deb

Successful build.

Please apply the original patch - I do take great care to ensure that
the patches only deviate from the standard recommendations in specific
cases where the particular package requires such a diversion. In all
such cases, I ensure that the build does actually fail with the standard
amendments before considering further changes.

Sadly, out of 90 packages so far built, less than 10 actually implement
the autools in such a manner that the "standard" recommendation from the
autotools documentation actually works for that package. Fewer still
cross build without any patches. If everyone followed the complete
autotools documentation, most autotools packages would cross build
already. (Emdebian is principally concerned with autotools packages
because we only support C/C++ and Emdebian has ditched both perl and the
entire concept of "Essential: yes" in debian/control. There is no room
for interpreted languages on our target devices, even bash has been
dropped in favour of dash.)

I've rewritten ~75% of the cross building support in Debian since
DebConf7, specifically to bring the cross building toolset into line
with "standard" autotools practice. I am not unfamiliar with the
autotools docs and I don't deviate from them without due cause.
Honest.
:-)

-- 


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


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to