Compiling 32-bit Firefox on an x86-64 OS
How hard is it to compile a 32-bit Firefox on an x86-64 Linux OS (preferably FC7, because that’s what I just installed). A quick google search failed me… I’d love directions, hints, or whatever you can provide. Is the correct way to do this to install all the necessary build dependencies in a chroot jail? And if so, how would I go about doing that?
October 17th, 2007 at 5:01 pm
http://fedoraproject.org/wiki/Projects/Mock
Don’t forget setarch.
October 17th, 2007 at 5:26 pm
I do this all the time, under FC6 though.
It can all be accomplished withing the .mozconfig file. These are the extra lines I include in .mozconfig to do a 32-bit build:
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
export CC=’gcc -m32′
export CXX=’c++ -m32′
ac_add_options –target=i686-pc-linux-gnu
ac_add_options –x-libraries=/usr/lib
These are all rather straightforward except for the last one. For some reason pkg-config is not used to determine the location of the X libraries, so if you don’t do this you end up with /usr/lib64 in the library search path.
Besides the above I also specify a separate objdir for 32 bit builds.
Hope this helps.
October 17th, 2007 at 5:52 pm
I remember now that I glossed over some details that caused me some trouble in doing this.
Having this work depends on you having both the 64-bit and 32-bit versions of all the build prerequisites installed. That done, then the
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
forces it to look in /usr/lib/pkgconfig before /usr/lib64/pkgconfig so it finds the 32 bit versions of everything.
The tricky part (and they may have fixed this in FC7) is that there does not appear to be a good way to install the 32-bit version of a package if the 64-bit version is already installed. The only way to get them both in FC6 seems to be to install them both in the same installer run. If the 64-bit version is installed, you seem to have to uninstall that and then install both versions. This becomes a real pain if the package has a lot of other packages depend on it because they all become uninstalled when you uninstall the 64-bit version and then you have to install all of those again.
These 2 lines:
export CC=’gcc -m32′
export CXX=’c++ -m32′
need explanation as well. You would think that setting CFLAGS and CXXFLAGS to -m32 should work but it does not. I suppose that is a bug, but given that I found a workaround I never got around to filing one.
October 18th, 2007 at 3:10 pm
Last time I did this on Debian/Ubuntu, I used a 32bit chroot (which debootstrap can quickly fetch) and the linux32 utility for faking uname (looks like to be equivalent to the setarch Fedora tool). Then, I used the conventional build options in the chroot.