Need a 32-bit libssl-dev for crosscompile?

Colin Watson cjwatson at ubuntu.com
Tue Feb 4 11:15:40 UTC 2014


On Mon, Feb 03, 2014 at 12:55:01PM -0500, Nathan Dorfman wrote:
> Does anyone know if it's possible to easily build a 32-bit x86 program
> that uses OpenSSL on a 64-bit machine?
> 
> After installing a few packages like libc6-dev-i386, lib32stdc++-dev,
> gcc-multilib and g++-multilib, I can easily build C/C++ sources with
> the -m32 option. Until, that is, I try to build something that uses
> OpenSSL. I'm missing a 32-bit analog of the following file:
> 
> libssl-dev:amd64: /usr/include/x86_64-linux-gnu/
> openssl/opensslconf.h
> 
> There's no lib32ssl-dev package, or anything seemingly like it,

You want "libssl-dev:i386"; it's Multi-Arch: same, so you can coinstall
it with libssl-dev:amd64.  This works as of Ubuntu 13.10, though not in
earlier releases.

I'd also generally recommend replacing the old-style biarch packages you
installed with their multiarch equivalents:

  libc6-dev-i386 -> libc6-dev:i386
  lib32stdc++-4.8-dev -> libstdc++-4.8-dev:i386

The biarch approach (lib32foo, etc.) is still around for some
specialised use cases, but multiarch is generally a more scalable
approach.

If you're stuck on a release of Ubuntu older than 13.10, then I would
recommend building an i386 chroot and building your 32-bit programs in
that (this approach will also work on 13.10 and newer if you prefer).
You can use the mk-sbuild program from ubuntu-dev-tools to help with
this, or build a chroot manually using debootstrap and configure schroot
to use it.

> I don't think I should just install the 32-bit libssl-dev, since some
> of the filenames will overlap with the normal package.

Multiarch has special rules for this, provided that the packages in
question obey some particular restrictions and are appropriately
annotated.  If you're interested in the details, see:

  https://wiki.ubuntu.com/MultiarchSpec

Cheers,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list