On 07/25/2010 02:48 PM, Wookey wrote:
+++ Dechesne, Nicolas [2010-07-23 14:46 +0200]:
How about cross compilation of packages, is that working? e.g. can I create an ARM .deb from my x86 machine (assuming my upstream can be cross compiled?).
You can use "xdeb" tool to cross compile packages. It works most of time and we are working on fixing problems.
Or, in principle, pdebuild-cross which, like pbuilder, has the advantage that you build in a clean environment so you don't fill your normal environment with (cross) -dev packages, and you do get to notice unlisted dependencies. However right now it doesn't work properly on Ubuntu due to Debian-related assumptions. I'm fixing that too.
thanks for this tip. right now I am trying to setup a working cross compilation environment, and I am using a specific VM for testing. it's good to know that pbuilder can work too, because that's what we use natively today already, so we will setup the cross version as well.
I was able to cross compile some of my package with dpkg-buildpackage -aarmel. However I am not able to install the -dev packages that I generated (it contains .h files that are required to build my next set of packages). I have used dpkg -a armel -i foo_armel.deb, and it complains about pkg-config-armel-cross missing.
That doesn't make much sense. dpkg doesn't (yet!) take a -a<arch> option. Do you mean that you ran dpkg-cross -a armel -i foo-dev_armel.deb?
and that complained that pkg-config-armel-cross was missing?
you are right... I meant dpkg-cross ;-)
That is expected: dpkg-cross only knows about the packages you put in front of it. It does not know which dependencies are arch-independent, because the package metadata doesn't say. So if your (armel) package depends on pkg-config then dpkg-cross will generate a native (amd64/i386?) package which depends on pkg-config-armel-cross (as well as foo-armel-cross and -armel-cross version of anything else in the deps list). When it tries to install that generated package it complains about the missing deps.
You can use -X to exclude all the dependencies which are in fact arch-independent so: dpkg-cross -a armel -X pkg-config -i foo-dev_armel.deb will perhaps do the trick for you.
it is now working fine with the -X option. is it an acceptable solution to cross install pkg-config package? I guess it would in turn install pkg-config-armel-cross, right?
aside: [(use dpkg-cross -a armel -b foo-dev_armel.deb) to build the package so you can examine it before installing normally with dpkg -i). (you can set -a armel as a default in /etc/dpkg-cross/cross-compile to save typing if you are always targetting the same arch) ]
Obviously this -X stuff is cumbersome, which is why you don't normally want to use dpkg-cross directly, but wrap it in some smarter tool which will call it with appropriate -X options for you.
i will look into xdev, as recommended in this mailing list as well. thanks a lot for your help.
what is the standard procedure to install build-dep so that I can build all my packages? the package files (.h, .la) have been installed in /usr/arm-linux-gnueabi, but not the .so (which kind of make sense). but should I worry about the pkg-config issue?
The correct installation of cross-dependencies and arch-independent dependencies is an unpleasantly complicated area (despite being superficially dead simple), because it's actually very difficult to know which deps are arch-independent and which aren't, and thus at what point(s) the cross-deps tree should be terminated in the native dependency tree. Better metadata would help a lot here. In the meantime various tools have been created which will make their best guess.
xdeb, apt-cross, pdebuild-cross(xapt) and apt-ma-emu all take different approaches to solving this problem and currently none of them will always get it right.
On ubuntu right now either xdeb or manual use of dpkg-cross and -X, as explained above, is your best bet. Your options should improve very shortly.
Wookey