Building a 64bit Debian package on 32bit Ubuntu

639 views Asked by At

I am trying to build a .deb package for an application my company (and me) have been developing. I'm trying to create a 64bit package on my 32bit ubuntu (12.04 LTS) using dpkg-buildpackage and I get the following warnings/errors:

dpkg-shlibdeps: warning/error: couldn't find library X needed by Y.so (ELF format: 'elf64-x86-64'; RPATH: 'some/path/that/does/not/exist')

When X is one of our compiled shared libraries, we get a warning. When it's a system library (like libgcc_s.so.1 and libstdc++.so.6) we get an error.

Why is the RPATH refers to a path that does not exist?

By the way, when I make a 32bit package (on our files that were compiled for 32bit of course) it only shows warnings (only about our proprietary .so files) but creates the .deb file.

If I could, I would have posted my debian folder content but I cant take files out of our network. I can type the relevant parts if its needed.

2

There are 2 answers

8
Braiam On

You need to install the 64-bits version of the library with apt-get (actually anything do, but this is the most easy):

sudo apt-get install libyouneed-dev:amd64

The trick here is the :amd64, which tells the package manager to install the 64-bit version of that package. The same applies for 32-bits libraries in 64-bit systems. It's called multiarch.

The package is looking at that path because that is where the libraries of 64-bits (or 32-bits) gets stored, but since you don't have it installed the path do not exist.

0
Sigi On

Install an amd64 chroot environment and build your package in there. This way you avoid the various multi-arch pitfalls, with the added benefit of having a clean, reproducible build.

There is a tool that makes this very easy: mk-sbuild.

You need to install ubuntu-dev-tools and sbuild.

Then, run mk-sbuild --arch=amd64 precise, which will setup the build environment for you.

Add yourself to the sbuild group: adduser <your user name> sbuild

Log out and log back in so your group membership will be reflected.

You can then build your package in the chroot:

 sbuild -d precise --arch=amd64 name_of_package.dsc

This assumes you've already build the source package with debuild -S or similar.