Reputation: 1309
I'm trying to create an amd64 package using:
sudo dpkg-buildpackage -us -uc -aamd64
on an i386 machine.
The error I get is:
Can't exec "x86_64-linux-gnu-strip": no such file or directory at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 215
Any suggestions?
Upvotes: 5
Views: 1385
Reputation: 3060
Building a cross compiler/binutils is often very hard, and it doesn't allow you to test your programs.
Virtual machines are very slow and create a strong separation which make hard to share files between the host an the VM.
The fastest solution and KISS way is Qemu-User-static : system-calls are translated in 32-bits in user mode. A 64-bits kernel does the same for 32-bits apps (but in kernel mode).
Download or extract a rootfs from a 64-bits Debian livecd.
Copy it to a sub-folder of you real root directory.
Copy qemu-user-x86_64 to a folder of $PATH relative to the fresh extracted rootfs.
copy /etc/resolv.conf to /your_path_to_target/etc/resolv.conf Chroot to it by executing /bin/bash.
Launch apt-get for installing the necessary tools.
Use the rootfs as if you were using a real 64-bits machine.
Things became very simple : Many libraries don't compile because of things like hard-coded paths (you'll face many; many problems like the one you have with cross-compiling). Here all happen as if you build packages natively and the executables were IA-32.
If you are using an x86_64 CPU along a 64-bit kernel, you can skip the whole qemu part. Just extract a 64-bits rootfs and chroot to it : it will be the fastest possible solution which can exist and dpkg-buildpackage will always work (no need to use tools like pbuilder).
Don't forget to copy /etc/resolv.conf if you want to use networking inside chroot.
.
If you use a 32-bits kernel on a 64-bits system, you can use qemu-kvm with a modified bios it will be faster than qemu-user because no JIT recompilation is required.
Upvotes: 2
Reputation: 368231
There are a number of ways you could use. Many Debian developers use pbuilder
which operates out of a chroot you can create with speficic tools -- a quick google search lead me to this Ubuntu wiki page but there are also Debian wiki pages on it.
An alternative is to just use a virtual environment, either libkvm, or virtualbox, or vagrant, ... I recently needed a 'backport' of a current package for Ubuntu 12.04 LTS and set up vagrant in no time for it.
Edit: Here are my recent notes from when I needed a 64-bit Ubuntu 12.04 environment to (reb-)build / backport a current package in order to use it from Travis CI / GitHub. My host machine for this exercise was my 32-bit Ubuntu laptop which at the time ran Ubuntu 13.10:
vagrant init hashicorp/precise64
to set up a 64-bit Ubuntu 12.04 instance
(cf the guide at http://docs.vagrantup.com/v2/getting-started/ and
http://docs.vagrantup.com/v2/getting-started/boxes.html)vagrant up
which takes a momentvagrant ssh
and we are now at the prompt.~/vagrant/tmp
which is shared with the Vagrant instancesudo apt-get update; sudo apt-get install dpkg-dev
followed by
dpkg-source -x *.dsc
sudo apt-get install ....build-depends listed....
to install the listed Build-Depenbdsdpkg-buildpackage -us -uc -rfakeroot
to build the package.I have since deployed that binary package I created in a number of Travis builds. So there: creating a 64-bit package on a 32-bit system.
Vagrant is one rather popular tool, and used by a large number of virtual providers.
If you are on 64-bit Linux as a host, you can do even better via docker.io which likely the lighest, fastest, and highest performing method (and hence likely to outperform the Qemu approach -- eg this recent post
Upvotes: 0
Reputation: 3777
You need to install the multiarch
package to get the ability to have both amd64 and i386 tools and libs living on the same system. Of course, the amd64 tools and libs won't work if your host architecture is only i386, so I agree with @user2284570 about the qemu user emulation.
Upvotes: 0