Problems using cross_compile.

Bug #16060 reported by Misha Gorodnitzky
6
Affects Status Importance Assigned to Milestone
kernel-package (Ubuntu)
Invalid
Wishlist
Adam Conrad

Bug Description

Kernel build fails when cross-compiling a kernel using 'make-pkg --cross-compile
foo ...' using version 8.119ubuntu3 of kernel-package. The kernel version I'm
trying to compile, in case it's relevant, is 2.6.11.

Basically, it appears as if an extra dash ('-') gets added to the end of the
cross-compile value. To take an example, the following make command works and
appears to illustrate how to use the CROSS_COMPILE make variable properly:

 # make ARCH=i386 CROSS_COMPILE=i686-unknown-linux-gnu-

But a similar value passed to make-kpkg results in an error:

 # make-kpkg --arch i386 --cross-compile i686-unknown-linux-gnu- kernel-image
 ...
 make[1]: Leaving directory `/usr/src/linux-2.6.12-rc2'
 /usr/bin/make CROSS_COMPILE=i686-unknown-linux-gnu-- \
                                 ARCH=i386 prepare
 make[1]: i686-unknown-linux-gnu--gcc: Command not found

At first glance it looks like make-kpkg is simply adding an extra dash onto the
end of the cross-compile make-variable, so I tried removing the dash on the
cross-compile value I pass to make-kpkg, but that doesn't work with the target
'clean':

 # make-kpkg --arch i386 --cross-compile i686-unknown-linux-gnu clean
 ...
 make[2]: i686-unknown-linux-gnugcc: Command not found

As well as errors from dpkg-architecture.

I've managed to fix this, so far, by editing debian/rules as necessary. Line 100
contains:

       KERNEL_CROSS:=$(architecture)-$(strip $(DEB_HOST_GNU_SYSTEM))-

Removing the dash at the end of this line appears to allow me to use the same
value for cross_compile as expected by the Makefile.

--Misha

Revision history for this message
Matt Zimmerman (mdz) wrote :

According to the documentation, this should be a target string (i.e., no dash at
the end), so it seems correct for it to add the dash.

perhaps a disagreement between the kernel Makefiles and make-kpkg on the semantics?

Revision history for this message
Misha Gorodnitzky (misaka+ubuntu) wrote :

I just noticed that I presented the wrong line from debian/rules. I said line
100 when in fact I believe I had changed 104:

   KERNEL_CROSS:=$(CROSS_COMPILE)-

removing the dash at the end there. Apologies for any confusion.

Revision history for this message
Adam Conrad (adconrad) wrote :

Can you reproduce this with a more recent version, say the one found here:

http://archive.ubuntu.com/ubuntu/pool/main/k/kernel-package/kernel-package_8.132_all.deb
(or anything 8.132 or newer)

The current versions of kernel-package only set CROSS_ARG once, so it would be
pretty strange to have it differ between targets, and furthermore, it now
appears to try really, really hard to let you do whatever you want.

It will tack a "-" on the end of the string, then checks if the string ends in
"--", if so it replaces that with "-" again.

In effect, this should mean you can use either i686-unknown-linux-gnu- or
i686-unknown-linux-gnu, as the fancy strikes. If the code I just read doesn't
actually match reality, I'd like to know, so I can hunt a bit deeper, but my
prelimiary reading seems to say this bug was fixed long ago.

Revision history for this message
Misha Gorodnitzky (misaka+ubuntu) wrote :

(In reply to comment #3)
> Can you reproduce this with a more recent version, say the one found here:
>
>
http://archive.ubuntu.com/ubuntu/pool/main/k/kernel-package/kernel-package_8.132_all.deb
> (or anything 8.132 or newer)

I just gave this a shot and that version of kernel-package doesn't exhibit the
problem. Thanks!

Revision history for this message
Adam Conrad (adconrad) wrote :

Fixed in breezy.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.