2007-11-05

Enabling 32-bit executables on Ubuntu 7.10 for AMD64

Forrest Sheng Bao http://forrest.bao.googlepages.com

Preamble: This article will be great help to you, if you having problem running 32-bit only program under 64-bit environment on AMD64 CPU, especially the symptom that you get a "no such file or directory" when you start certain program by its path. (It's weird, isn't? That program is just over there, but the system says can't find it.)

I have just immigrated to AMD 64 platform. Although I have purchased this Athlon X2-64 3600+ CPU in June this year(2007), it ran in 32-bit model until last week. One reason I didn't immigrate before is because some commercial software can work in 64-bit model due to lack of some libraries.

But 64-bit model is too attractive to me, that in most fields I am working on(bioinformtics, logic-based AI, communication network, biomedical signal processing, etc.) many programs execute much faster on 64-bit model than the ones on 32-bit model, such as Python interpreter(with scipy/numpy/pylan libraries), gProlog and smodels, even the GCC compiler. The performance promotes at least 10%, if only considering the time of executing same computational job. My friend Eric told me that the SMP performance of AMD64 is greatly improved on 64-bit model. For instance, if GCC is compiling your program, one core is doing syntax parsing while another core is doing assembling.

So what I do? There is no problem to all open source software, their guys have prepared 64-bit version or I can compile them myself. But I can't drop out all commercial software, especially some of them are really professional, with their own algorithms and stuffs. How can I balance using 64-bit model while being able to run some 32-bit only software?

Today, I figured it out. Ubuntu 7.10 has provided some 32-bit libraries to allow those 32-bit only programs run even in 64-bit model. I found this when I tried to install Adobe/Macromedia Flash Player through Firefox promotion that a plug-in was required to display Flash on the webpage. And I noticed some 32-bit libraries were installed. Later I checked the apt log, and found this:
Setting up libc6 (2.6.1-1ubuntu10) ...
Setting up libc6-dev (2.6.1-1ubuntu10) ...
Setting up libc6-i386 (2.6.1-1ubuntu10) ...
Setting up lib32gcc1 (1:4.2.1-5ubuntu4) ...
Setting up lib32z1 (1:1.2.3.3.dfsg-5ubuntu2) ...
Setting up lib32stdc++6 (4.2.1-5ubuntu4) ...
Setting up lib32asound2 (1.0.14-1ubuntu8) ...
Setting up lib32ncurses5 (5.6+20070716-1ubuntu3) ...
Setting up ia32-libs (2.1ubuntu3) ...
So you just need to install all those stuffs.

Yup, in Ubuntu 7.04 I found that Adobe/Macromedia Flash Player can't work in 64-bit model but the open source GNASH player is too poor working with Youtube. Now, this problem is solved. Thanks to Ubuntu team's that I can watch Flash animation inside webpages out-of-the-box, with only less than 3 times mouse click.

Later I checked Adobe PDF reader, it also works well this time. But to render PDF inside browser, you need to do a bit configuration, as mentioned on Adobe website.
http://blogs.adobe.com/acroread/2007/09/adobe_reader_811_faqs.html But personally, I don't think this is useful. By the way, it is more important to enable PDF reader plugin in Firefox.
Browser plugin doesn't load on Linux
If SELinux security is turned on, the browser plugin (nppdf.so) as well as PPKLite plugin (PPKLite.api) doesn't load because these are not SELinux compliant. To fix this you can run the patch for SELinux which is shipped along with Adobe Reader 8.1.1 kept at acroread_install_dir/Adobe/Reader8/Reader/Patch/selinux_patch.

Run this patch script as follows:

./selinux_patch acroread_install_dir/Adobe/Reader8

with root privileges.
Note of caution: This will disable SELINUX enforcement for all the libraries of Adobe Reader 8.1.1
You might need to install "policycoreutils" before run that script. And if you have some problem related to shell interpreter, try to edit the first linke of selinux_patch script into proper interpreter.

1 comment:

Wei Hu said...

This is nothing new. The 32-bit libs for amd64 have been there for a long time.

The safest way to run 32-bit programs is build a complete chroot environment.