mozilla

Revision 66446 of Compiling 32-bit Firefox on a Linux 64-bit OS

  • Revision slug: Compiling_32-bit_Firefox_on_a_Linux_64-bit_OS
  • Revision title: Compiling 32-bit Firefox on a Linux 64-bit OS
  • Revision id: 66446
  • Created:
  • Creator: gps
  • Is current revision? No
  • Comment describe alternative Debootstrap-based method for producing 32-bit binaries on Ubuntu; 309 words added, 2 words removed

Revision Content

The following commands are a recipe bsmedberg uses to compile 32-bit Firefox on an x86-64 Fedora Core 7 system. This is not technically cross-compiling, because the "target" binaries being produced will run on the native system; this means that a lot of the complexities of cross-compiling can be avoided.

Packages

The following extra packages must be installed (using sudo yum install packagename):

  • libXi-devel.i386
  • cairo-devel.i386
  • xorg-x11-proto-devel.i386
  • fontconfig-devel.i386 - Unfortunately, yum refuses to install this package at the same time as fontconfig-devel.x86_64 - I had to download the RPM and install it manually using rpm -i --replacefiles fontconfig-devel-2.4.2-3.fc7.i386.rpm
  • libIDL-devel.i386

The list of additional packages given above requires modifications for Fedora 8:

  • xorg-x11-proto-devel.i386 is no longer present in Fedora 8. The .noarch RPM package is used instead, and it should have been automatically installed. This RPM package (xorg-x11-proto-devel.noarch) has pkg-config files in a different location (/usr/share/pkgconfig).
  • popt-devel.386 - Unfortunately, yum refuses to install this package at the same time as popt-devel.x86_64 - I had to download the RPM and install it manually using rpm -i --replacefiles popt-devel-1.12-3.fc8.i386.rpm
  • dbus-glib-devel.i386 may also need to be installed

Package list for Fedora 12:

  • glibc-devel.i686
  • cairo-devel.i686
  • fontconfig-devel.i686
  • gtk2-devel.i686
  • dbus-glib-devel.i686
  • glib2-devel.i686
  • pango-devel.i686
  • pixman-devel.i686
  • freetype-devel.i686
  • libpng-devel.i686
  • libXrender-devel.i686
  • libX11-devel.i686
  • libxcb-devel.i686
  • libXau-devel.i686
  • atk-devel.i686
  • libnotify-devel.i686
  • dbus-devel.i686
  • alsa-lib-devel.i686
  • libcurl-devel.i686
  • libIDL-devel.i686
  • libXt-devel.i686
  • libXext-devel.i686
  • glibc-static.i686
  • libstdc++-devel.i686

Configuration

To configure by hand in a bash-like shell, use the following command:

PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CC="gcc -m32" CXX="g++ -m32" AR=ar ../mozilla/configure --x-libraries=/usr/lib --target=i686-pc-linux --other-options-here

To do the same thing with a mozconfig file:

export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig
CC="gcc -m32"
CXX="g++ -m32"
AR=ar
ac_add_options --x-libraries=/usr/lib
ac_add_options --target=i686-pc-linux

For Fedora 8 it is necessary to add /usr/share/pkgconfig to PKG_CONFIG_LIBDIR:

export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig


For ubuntu 9, it is also necessary to add /usr/share/pkgconfig to PKG_CONFIG_LIBDIR, and few more work:

  1. export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig
  2. export CROSS_COMPILE=1
  3. 32bit DEV package is name like lib32XXXX.dev, like lib32asound2-dev
  4. need to change 'ac_add_options --x-libraries=/usr/lib' to 'ac_add_options --x-libraries=/usr/lib32'.
  5. need to install  ia32-libs , gcc-multilib and g++-multilib package.

Instructions for Ubuntu

Method 1: True Cross-Compiling

{{ outdated("

This section is maintained for historical reference; it might not work for more recent versions of Ubuntu. It was last tested in Ubuntu 10.10

") }}

This method is actually cross-compiling: you take a 64-bit toolchain and produce 32-bit binaries. This is ideally how you cross-compile.

  1. sudo apt-get install ia32-libs gcc-multilib g++-multilib lib32*
  2. (I had to open Synaptic afterwards, search for package names beginning with lib32, and install the ones that apt-get missed)
  3. Use a mozconfig like below.
  4. make -f client.mk build
export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig
export CROSS_COMPILE=1
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-dbg32
mk_add_options MOZ_MAKE_FLAGS="-s -j4"
ac_add_options --enable-application=browser

CC="gcc -m32"
CXX="g++ -m32"
AR=ar
ac_add_options --x-libraries=/usr/lib32
ac_add_options --target=i686-pc-linux

ac_add_options --disable-crashreporter # needed because I couldn't find a 32-bit curl-dev lib
ac_add_options --disable-libnotify     # needed because I couldn't find a 32-bit libinotify-dev
ac_add_options --disable-gnomevfs      # needed because I couldn't find a 32-bit libgnomevfs-dev

Method 2: Create a 32-bit chroot Environment

In this method, we effectively create a wholly-contained 32-bit operating system within a 64-bit operating system using chroot. This isn't technically cross-compiling, but it yields the same result: 32-bit binaries.

This method is arguably more reliable than true cross-compiling because the newly-created environment is completely isolated from the 64-bit operating system and it won't be susceptible to common issues with cross-compiling, such as unavailability of 32-bit libraries/packages when running in 64-bit mode. Additionally, since your 32-bit environment is completely isolated, to clean up from it, you just rm -rf the tree. Contrast this with removing dozens of 32-bit packages from your primary operating system.

The downside to this method is size and complexity. Since you will be effectively creating a whole operating system within your primary operating system, there will be lots of redundant files. You'll probably need 1 or 2 GB for all the files. Additionally, the steps for initially creating the 32-bit environment are more involved.

To create a 32-bit chroot Ubuntu environment, follow the DebootstrapChroot instructions. When you have entered your newly-created environment with schroot, follow the regular build instructions to set up your build environment.

See Also

Revision Source

<p>The following commands are a recipe bsmedberg uses to compile 32-bit Firefox on an x86-64 Fedora Core 7 system. This is not technically cross-compiling, because the "target" binaries being produced will run on the native system; this means that a lot of the complexities of cross-compiling can be avoided.</p>
<h3 name="Packages">Packages</h3>
<p>The following extra packages must be installed (using <code>sudo yum install <var>packagename</var></code>):</p>
<ul> <li>libXi-devel.i386</li> <li>cairo-devel.i386</li> <li>xorg-x11-proto-devel.i386</li> <li>fontconfig-devel.i386 - Unfortunately, <code>yum</code> refuses to install this package at the same time as fontconfig-devel.x86_64 - I had to download the RPM and install it manually using <code>rpm -i --replacefiles fontconfig-devel-2.4.2-3.fc7.i386.rpm</code></li> <li>libIDL-devel.i386</li>
</ul>
<p>The list of additional packages given above requires modifications for Fedora 8:</p>
<ul> <li>xorg-x11-proto-devel.i386 is no longer present in Fedora 8. The .noarch RPM package is used instead, and it should have been automatically installed. This RPM package (xorg-x11-proto-devel.noarch) has pkg-config files in a different location (/usr/share/pkgconfig).</li> <li>popt-devel.386 - Unfortunately, <code>yum</code> refuses to install this package at the same time as popt-devel.x86_64 - I had to download the RPM and install it manually using <code>rpm -i --replacefiles popt-devel-1.12-3.fc8.i386.rpm</code></li> <li>dbus-glib-devel.i386 may also need to be installed</li>
</ul>
<h4>Package list for Fedora 12:</h4>
<ul> <li>glibc-devel.i686</li> <li>cairo-devel.i686</li> <li>fontconfig-devel.i686</li> <li>gtk2-devel.i686</li> <li>dbus-glib-devel.i686</li> <li>glib2-devel.i686</li> <li>pango-devel.i686</li> <li>pixman-devel.i686</li> <li>freetype-devel.i686</li> <li>libpng-devel.i686</li> <li>libXrender-devel.i686</li> <li>libX11-devel.i686</li> <li>libxcb-devel.i686</li> <li>libXau-devel.i686</li> <li>atk-devel.i686</li> <li>libnotify-devel.i686</li> <li>dbus-devel.i686</li> <li>alsa-lib-devel.i686</li> <li>libcurl-devel.i686</li> <li>libIDL-devel.i686</li> <li>libXt-devel.i686</li> <li>libXext-devel.i686</li> <li>glibc-static.i686</li> <li>libstdc++-devel.i686</li>
</ul>
<h3 name="Configuration">Configuration</h3>
<p>To configure by hand in a bash-like shell, use the following command:</p>
<p>PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CC="gcc -m32" CXX="g++ -m32" AR=ar ../mozilla/configure --x-libraries=/usr/lib --target=i686-pc-linux <var>--other-options-here</var></p>
<p>To do the same thing with a mozconfig file:</p>
<pre>export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig
CC="gcc -m32"
CXX="g++ -m32"
AR=ar
ac_add_options --x-libraries=/usr/lib
ac_add_options --target=i686-pc-linux</pre>
<p>For Fedora 8 it is necessary to add /usr/share/pkgconfig to PKG_CONFIG_LIBDIR:</p>
<p>export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig</p>
<p><br> For ubuntu 9, it is also necessary to add /usr/share/pkgconfig to PKG_CONFIG_LIBDIR, and few more work:</p>
<ol> <li>export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig</li> <li>export CROSS_COMPILE=1</li> <li>32bit DEV package is name like lib32XXXX.dev, like lib32asound2-dev</li> <li>need to change 'ac_add_options --x-libraries=/usr/lib' to 'ac_add_options --x-libraries=/usr/lib32'.</li> <li>need to install  ia32-libs , gcc-multilib and g++-multilib package.</li>
</ol>
<h3>Instructions for Ubuntu</h3>
<h4>Method 1: True Cross-Compiling</h4>
<p>{{ outdated("<p>This section is maintained for historical reference; it might not work for more recent versions of Ubuntu. It was last tested in Ubuntu 10.10</p>") }}</p>
<p>This method is actually cross-compiling: you take a 64-bit toolchain and produce 32-bit binaries. This is ideally how you cross-compile.</p>
<ol> <li>sudo apt-get install ia32-libs gcc-multilib g++-multilib lib32*</li> <li>(I had to open Synaptic afterwards, search for package names beginning with lib32, and install the ones that apt-get missed)</li> <li>Use a mozconfig like below.</li> <li>make -f client.mk build</li>
</ol>
<pre>export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig
export CROSS_COMPILE=1
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-dbg32
mk_add_options MOZ_MAKE_FLAGS="-s -j4"
ac_add_options --enable-application=browser

CC="gcc -m32"
CXX="g++ -m32"
AR=ar
ac_add_options --x-libraries=/usr/lib32
ac_add_options --target=i686-pc-linux

ac_add_options --disable-crashreporter # needed because I couldn't find a 32-bit curl-dev lib
ac_add_options --disable-libnotify     # needed because I couldn't find a 32-bit libinotify-dev
ac_add_options --disable-gnomevfs      # needed because I couldn't find a 32-bit libgnomevfs-dev
</pre>
<h4>Method 2: Create a 32-bit chroot Environment</h4>
<p>In this method, we effectively create a wholly-contained 32-bit operating system within a 64-bit operating system using chroot. This isn't technically cross-compiling, but it yields the same result: 32-bit binaries.</p>
<p>This method is arguably more reliable than true cross-compiling because the newly-created environment is completely isolated from the 64-bit operating system and it won't be susceptible to common issues with cross-compiling, such as unavailability of 32-bit libraries/packages when running in 64-bit mode. Additionally, since your 32-bit environment is completely isolated, to clean up from it, you just <code>rm -rf</code> the tree. Contrast this with removing dozens of 32-bit packages from your primary operating system.</p>
<p>The downside to this method is size and complexity. Since you will be effectively creating a whole operating system within your primary operating system, there will be lots of redundant files. You'll probably need 1 or 2 GB for all the files. Additionally, the steps for initially creating the 32-bit environment are more involved.</p>
<p>To create a 32-bit chroot Ubuntu environment, follow the <a class=" link-https" href="https://help.ubuntu.com/community/DebootstrapChroot" title="https://help.ubuntu.com/community/DebootstrapChroot">DebootstrapChroot</a> instructions. When you have entered your newly-created environment with <code>schroot</code>, follow the regular <a href="/En/Developer_Guide/Build_Instructions" title="Build Instructions">build instructions</a> to set up your build environment.</p>
<h3 name="See_Also">See Also</h3>
<ul> <li><a href="/en/Cross-Compiling_Mozilla" title="en/Cross-Compiling_Mozilla">Cross-Compiling Mozilla</a></li>
</ul>
Revert to this revision