[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: i386 to amd64



On 2008-11-09 03:51 +0100, Vinicius Massuchetto wrote:

> Sven Joachim escreveu:
>> On 2008-11-08 17:06 +0100, Vinicius Massuchetto wrote:
>>
>>> Is there any way to build amd64 packages from i386?
>>
>> There is probably more than one way, but assuming you have a 64-bit
>> processor (if not, why would you want to build packages for it?), the
>> easiest solution is to boot with a 64-bit kernel and set up an amd64
>> chroot for that task with "debootstrap --arch=amd64 --variant=buildd".
>> You can also set up pbuilder for amd64, look for the --debootstrapopts
>> option in the pbuilder manpage.
>
> Ahmmm...
>
> Thanks for helping me, but I got a little bit confused by this explanation.
>
> I got a package: package_0.0.0_i386.deb
> And I want: samepackage_0.0.0_amd64.deb

Okay, it seems I completely misunderstood you.  I thought you wanted to
build packages from source.

> I know I can install i386 packages by the --force-architecture
> parameter, but what I really need is to build one.
>
> I'm used to build my own packages with checkinstall, but they're not
> providing me the source for this specific package.

Here is a way to just hack the architecture in foobar_i386.deb, with
short comments:

# We want the files in the control.tar.gz to be owned by root, so let's
# pretend we are root; apt-get install fakeroot if necessary.
fakeroot /bin/bash

# extract the files in the control archive into a scratch dir
mkdir scratch
ar x foobar_i386.deb control.tar.gz
tar -C scratch -xzvf control.tar.gz 

# change the Architecture in the control file
sed -i -e 's/Architecture: i386/Architecture: amd64/' scratch/control

# regenerate the control archive
GZIP=-9n tar -C scratch -cvzf control.tar.gz .

# replace the control archive in the .deb
ar rav debian-binary foobar_i386.deb control.tar.gz

# clean up and exit the fakeroot shell:
rm -rf scratch control.tar.gz
exit


This is a really dirty hack, though.  A better framework for converting
i386 packages is developed in the ia32-libs-tools package, available in
unstable¹.  While this tool is not very mature and barely documented, it is
probably a better way than just changing the Architecture: field in
debian/control.

Sven


¹ http://packages.debian.org/sid/ia32-libs-tools


Reply to: