On Sat, Nov 17, 2007 at 09:29: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).

So, I don't have a cross-compiler installed here, but as a test I ran:

  $ sudo ln -s gcc /usr/bin/x86_64-linux-gnu-gcc
  $ ./configure --build i486-linux-gnu --host x86_64-linux-gnu
  checking for x86_64-linux-gnu-gcc... x86_64-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
  checking for suffix of executables...
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether x86_64-linux-gnu-gcc accepts -g... yes
  checking for x86_64-linux-gnu-gcc option to accept ISO C89... none needed
  checking for a BSD-compatible install... /usr/bin/install -c
  checking for putgrent... yes
  configure: creating ./config.status
  config.status: creating Makefile
  config.status: WARNING:  Makefile.in seems to ignore the --datarootdir setting
  config.status: creating config.h
  config.status: config.h is unchanged
  $ grep CC Makefile
  CC              = x86_64-linux-gnu-gcc
          $(CC) $(LDFLAGS) -o $@ $^

This looks just fine. What am I missing?

> > 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.

When there is no "-" in the version number, that is known as a native
package, which means that the Debian maintainer to whom you are talking
*is* the upstream.

> > 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.

Your source package might do this, but my source package does not set CC
to anything before configure is run.

> The --build and --host settings do NOT make it into the Makefile
> because $(MAKE) has been specifically instructed to use CC=cc.

I don't know where this comes from. base-passwd/Makefile.in sets [EMAIL 
PROTECTED]@
which is substituted (as far as I can see, correctly) by configure.

> 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,

base-passwd does no such thing, unless your changes in 3.5.14em1 do it.

> If base-passwd just ran:
> ./configure ($CROSS)
> (as the autools docs recommend),

Which is what it does do! It overrides CFLAGS, not CC. The only version
of base-passwd that sets CC before running configure is the one in
Emdebian itself.

> 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.

I believe I am also reasonably familiar with the autotools
(notwithstanding that base-passwd used a very old version until
recently; I simply hadn't got around to upgrading it), and I believe
that it is generally incorrect to set CC in debian/rules since configure
is perfectly capable of doing so itself. Given that I *am* the upstream
for this package, there is no justification for hacky workarounds when
they should be fixed in configure.ac and Makefile.in where they belong.

I won't apply the original patch, but am entirely happy to look into
fixing base-passwd's use of the autotools if you can point out further
problems.

> 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.
> :-)

Please take native packages into account when giving recommendations in
future; it feels terribly patronising to be told that it's an upstream
bug when I *am* upstream and am trying to extract the necessary
information I need to fix it. Even for non-native packages, it is better
to fix their use of autotools and contribute those fixes upstream than
to hack around the problems; those hacks may well outlive the original
bugs and cause further problems down the line.

Cheers,

-- 
Colin Watson                                       [EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to