[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vmware-e.x.p.-15576 and Debian/Sarge/amd64



Hi,

Thomas Steffen writes: 
 > Several possible solutions have been discussed here in the past (search for 
 > ia32-libs), but none has been implemented yet. Ubuntu has a package of 
 > ia32-libs with some "hacks" that make some of the plugins work. You can try 
 > that, it might just work. Otherwise, you can also configure most libraries 
 > to look for the plugins in a different, but that is a rather tedious 
 > process. I have posted a few times on relevant variables for this, if you 
 > want to go this route.

I've hacked a bit into libc6 and changed the code for dlopen() to look
into /emul/*/<path> if a library cannot be found in /<path>. Note this
is only relevant for a few dynamically loaded libraries.

For example, running firefox encounters the following deviations:

    haifa:~$ LD_DEBUG=libs firefox 2>&1|grep multiarch
         14091:     multiarch: trying /emul/ia32-linux//usr/X11R6/lib/X11/locale/lib/common/xlcUTF8Load.so.2
         14091:     multiarch: trying /emul/ia32-linux//usr/lib/gconv/ISO8859-1.so
         14091:     multiarch: trying /emul/ia32-linux//usr/lib/gconv/UTF-16.so
         14091:     multiarch: trying /emul/ia32-linux//usr/lib/gtk-2.0/2.4.0/loaders/libpixbufloader-xpm.so
         14091:     multiarch: trying /emul/ia32-linux//usr/lib/pango/1.4.0/modules/pango-basic-fc.so

but then it runs. I was also successful with acroread (though there is
one plugin it does not load, it runs fine) and the Sun Java 5 JDK.

I include the patch at the end - you have to apply it to the
glibc-2.3.2.ds1 package, and then install the ld-linux.so.2 from
there. Since it involves changing the loader, I am not sure such
a patch will be will received by the glibc people, but it is, afaik,
the only way to seamlessly run i386 programs in a pure amd64 without
making a chroot. 

Maybe the people doing the multiarch project can comment on this?

In some sense, the patch is not really necessary - it could be
circumvented by changing the i386 packages for gconv/X11/gtk/pango
correctly to do their dlopen()s right, e.g. by supplying an alternate
dlopen() function that searches the multiarch directories.

-Christoph

-- 
Christoph Best                                      cbst at tigertiger de
Max-Planck-Institute of Biochemistry, Munich      http://tigertiger.de/cb


------------------------------------------------------------------------------

--- glibc-2.3.2/elf/dl-load.c.xris	2005-08-25 13:32:18.000000000 +0200
+++ glibc-2.3.2/elf/dl-load.c	2005-08-25 14:34:09.000000000 +0200
@@ -34,6 +34,7 @@
 #include "dynamic-link.h"
 #include <abi-tag.h>
 #include <dl-osinfo.h>
+#include <dirent.h>  /* tigertiger 2005-09-05 */
 
 #include <dl-dst.h>
 
@@ -1886,6 +1887,34 @@
       else
 	{
 	  fd = open_verify (realname, &fb);
+          /* multiarch patch  2005-08-23 Christoph Best <cbst at tigertiger.de>
+             If <libpath> cannot be loaded, try /emul/*/<libpath>
+           */
+          if (fd==-1 && realname[0]=='/') {
+              struct dirent *e;
+              DIR *d;
+              char *multiarchname;
+              int buflen;
+
+              buflen = strlen(realname) + 300;
+              multiarchname = malloc(buflen);
+              d = opendir("/emul/.");
+              while (d && fd<0 && (e = readdir(d))) {
+                  if (e->d_name[0]!='.') {
+                      strcpy(multiarchname,"/emul/");
+                      strncat(multiarchname,e->d_name,buflen - strlen(multiarchname) - 1);
+                      if (realname[0]!='/')
+                          strncat(multiarchname,"/",buflen - strlen(multiarchname) - 1);
+                      strncat(multiarchname,realname,buflen - strlen(multiarchname) - 1);
+                      free (realname);
+                      realname = multiarchname;
+                      if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+                          INTUSE(_dl_debug_printf) ("multiarch: trying %s\n", realname);
+                      fd = open_verify (realname, &fb);
+                  };
+              }
+          }
+          /* -- */
 	  if (__builtin_expect (fd, 0) == -1)
 	    free (realname);
 	}



Reply to: