My favorites | Sign in
Project Home Downloads Wiki Issues Code Search
Search
for
LinuxBuild32On64  
Building 32 bit Chromium on a 64 bit machine
linux
Updated Oct 18, 2012 by [email protected]

If you're looking for building a 64 bit Chromium, try LinuxChromium64

OBSOLETE: Building 32-bit Chromium on 64-bit Linux is no longer officially supported. The "32-bit compatibility libs" instructions probably won't work. The chroot instructions are your best bet, but it is not actively tested or maintained.

Introduction

On at least Ubuntu Hardy, there is poor support for building 32-bit software. It seems it's blocked on "multiarch" support in Debian which is a grand solution to the problem but far off in the future. (See, for example bug 492453.) So in the interim, we have some hacks that seem to work so far.

Even a successful build will likely have issues: see Linux64BitIssues.

What are the Prerequisites

LinuxBuildInstructionsPrerequisites has an up-to-date list of prerequisite packages needed for building chrome, as well as instructions for automatically installing the prerequisites.

The script on that page is based on a script on the Ubuntu forums that helps automate installing 32-bit libs on a 64-bit system.

Manual Setup on Ubuntu/Debian

  1. Go to LinuxBuildInstructionsPrerequisites#Automated_Setup.
  2. Manually run that script.

Manual Setup on openSUSE

(Tested on openSUSE 11.1 x86_64) This can be incomplete list.

Packages

gcc-32bit glibc-devel-32bit libgio-2_0-0-32bit gtk2-32bit libatk-1_0-0-32bit gtk2-32bit pango-32bit pango-32bit pango-32bit gtk2-32bit cairo-32bit freetype2-32bit fontconfig-32bit libstdc++43-32bit xorg-x11-libX11-devel-32bit xorg-x11-libXrender-devel-32bit xorg-x11-libXext-devel-32bit libasound2-32bit

Symlinks

#!/bin/bash
cd /usr/lib
for lib in gio-2.0 gdk-x11-2.0 atk-1.0 gdk_pixbuf-2.0 \
           pangocairo-1.0 pango-1.0 pangoft2-1.0 \
           gobject-2.0 gmodule-2.0 glib-2.0 gtk-x11-2.0; do
  ln -s -f lib$lib.so.0 lib$lib.so
done
ln -s -f libcairo.so.2 libcairo.so
ln -s -f libfreetype.so.6 libfreetype.so
ln -s -f libfontconfig.so.1 libfontconfig.so
ln -s -f libstdc++.so.6 libstdc++.so
ln -s -f libgthread-2.0.so.0.1800.2 libgthread-2.0.so
ln -s -f libgconf-2.so.4.1.5 libgconf-2.so
ln -s -f libasound.so.2 libasound.so

ln -s -f /lib/libz.so.1 /lib/libz.so
ln -s -f /lib/libgcc_s.so.1 /lib/libgcc_s.so

Useful commands

To find libs you need, you can use locate, zypper and rpm, examples:

$locate libgcc.a
/usr/lib64/gcc/x86_64-suse-linux/4.3/libgcc.a

$rpm -q -f /usr/lib64/gcc/x86_64-suse-linux/4.3/libgcc.a
gcc43-4.3.3_20081022-9.8

$sudo zypper se gcc43
...
  | gcc43-32bit         | The GNU C Compiler and Support Files          | package
...

for more info use man

Compiling

To compile using the Linux make build, set GYP_DEFINES=target_arch=ia32 and then (re)build the Makefiles:

gclient runhooks --force

After that, you can use make to compile as described in the Linux Build Instructions.

Ubuntu 32bit chroot on 64bit system

The build/install-build-deps.sh script installs all the 32bit compatibility libraries to build a 32bit binary on a 64bit Ubuntu system. But it is often easier and more reliable to develop in a real 32bit environment, instead of building against compatibility libraries.

This can be done by setting up a 32bit chroot on a machine that is otherwise running a 64bit distribution.

To do so, run the build/install-chroot.sh script. It asks you which environment to install. Pick any recent Ubuntu distribution (e.g. lucid) and select a 32bit installation.

Optionally, change your chrome/src/out directory to be a symbolic link pointing to $HOME/chroot. This way, you can build both 32bit and 64bit versions from the same source tree.

Now, install all build-prerequisites in the 32bit chroot:

  lucid32 build/install-build-deps.sh

Reset your makefiles, if they are still configured for a 64bit build environment:

  lucid32 gclient runhooks

And build Chromium using the development tools in the chroot environment:

  lucid32 make chrome

Run the resulting binary as you would normally do:

   lucid32 out/Debug/chrome

Before building a 64bit version in the same source tree, don't forget to reset your makefiles again

   gclient runhooks && make chrome
Comment by [email protected], Jan 22, 2013

I needed to trick inside the 32bit chroot because "uname -m" still returned "x86_64" system. Before running "gclient runhooks --force" I moved /bin/uname to /bin/uname.orig and created an executable script in /bin/uname

#!/bin/bash

if [ "$@" = "-m" ]; then
 echo "i686"
else
 /bin/uname.orig "$@"
fi

That did the trick!

This also solves issues complaining about register within asm like 'mm0', 'mm1' etc. which belong to the mmx and sse extension...

Comment by [email protected], Feb 26, 2013

I didn't need the uname hack above, precise32 uname -m works for me and prints i686 out of the box, so your mileage may vary. Two things I encountered:

  • Due to memory limitations, gold32 can't link a debug build, so you have to temporarily move src/third_pary/gold32 out of the way and use a symlink to gold64 instead.
  • The resulting executable can be run normally outside the chroot environment, but you may have to unset/clear the UBUNTU_MENUPROXY environment variable, otherwise you might not even be able to start chrome.

Sign in to add a comment
Powered by Google Project Hosting