Click to See Complete Forum and Search --> : Getting 32-bit binaries to work on MDVx86_64


Liquid Snake
04-27-2007, 02:56 PM
I just moved from MDV06 32 bit to MDV07 64 bit. I still have all the binaries I used on my old machine and would like to run them on this one since a lot of the programs I've used aren't available on x86_64 or can't be compiled on it.

When I run my old xmms, it complains about not finding a bunch of -1.2.so.0 libaries, but I can see their -2.0.so.0 counterparts under /usr/lib.

I really don't know a lot about these libraries or how they're linked to the binaries. If I copied all the libraries from my old machine's /usr/lib to my new machine's /usr/lib, would my old binaries be happy or would I break something on the new machine?

bwkaz
04-27-2007, 10:20 PM
Does the 64-bit installation have a /usr/lib64? If so, then you should probably be OK just installing the 32-bit package(s) for this library. (And if the library you're referring to is the one I think you're referring to -- gtk or gdk -- then it's going to require a lot more than just the library files. It'll require a few config files, some theme-related stuff, maybe various pkg-config files, and maybe also a bunch of the stuff that it puts into /usr/share. Just running a program will probably only require the theme stuff and the config files. And the libs, of course. But that's why I suggest installing the distro package.)

As a side note, the runtime linker isn't using the -2.0.so.0 libraries because the linker requires the exact name that's registered in the binary. If the binary is asking for libgtk+-1.2.so.0, then you need a library whose name matches that exactly. (Usually this is a symlink to <that name>.x.y, where x and y are minor and patchlevel version numbers.) The linker used during compilation will use the libgtk+-1.2.so name that it builds (from the Makefile passing it -lgtk+-1.2), and follow that symlink to the full library name. Then it reads the "soname" out of that file, and adds a dependency entry for that name. For gtk+ 1.2, the soname is libgtk+-1.2.so.0. (And it's not even close to binary-compatible with gtk 2.0, which is why they changed the soname in version 2.0.)

What you can't do is have a single library that loads into both a 32-bit and a 64-bit process. (And a single process can only load one type of library: the lib type has to match the binary's type.) So if your distro has a 64-bit gtk v1.2 in /usr/lib for some reason, you won't be able to replace it. (That's why one setup for multi-lib has the 64-bit libs in /usr/lib64. Another setup has all the 32-bit stuff installed in a chroot environment, but this only really helps when the package manager can't handle both types of package.)

Liquid Snake
04-27-2007, 11:01 PM
Thanks for the reply bwkaz! I feel bad because I'm a programmer and I don't have a grasp on dynamic libraries. They didn't teach us too much about them in college.

I do have a lib64 directory, and you're right, gdk/gtk is causing a lot of problems! What I've done is created a /usr/lib32 directory and copied the /usr/lib directory from my Mdv2006 x86 machine to them and then used LD_LIBRARY_PATH to point to that directory. It works great for zsnes and dosbox, but not for other apps. I'm annoyed that mencoder doesn't come with this distro, so I'm either going to have to try and fix the 32-bit dependencies or build a new version. Which do you recommend? Is it safe to install lib*i586.rpm packages so I can get all the gtk/gdk extras too?

bwkaz
04-28-2007, 02:24 PM
I do have a lib64 directory, and you're right, gdk/gtk is causing a lot of problems! What I've done is created a /usr/lib32 directory and copied the /usr/lib directory from my Mdv2006 x86 machine to them and then used LD_LIBRARY_PATH to point to that directory. OK, but that's not enough for gtk. ;)

I'm actually surprised it works for any programs that use gtk. (It's probably fine for a lot of other libraries though.) I thought gtk tried to read its config files as soon as it started up, and I know those config files hold file locations that will be different for 64-bit gtk versus 32-bit gtk. Certainly if the program tries to use a theme (i.e. xmms -- though I don't get why xmms can't be recompiled 64-bit), then it won't work right, because the theming stuff is in the config files that either won't exist, or will be for the wrong word-size gtk.

so I'm either going to have to try and fix the 32-bit dependencies or build a new version. Which do you recommend? No idea: I don't use that distro, so I don't know how much pain you might run into with either solution. If you can get -devel packages for all the dependent mplayer libraries (and there are a ton of them...), then that might work. (But be careful of compiling a 64-bit mplayer: if you need to use third-party binary codecs, then you'll need to keep mplayer 32-bit so it can load them.)

Is it safe to install lib*i586.rpm packages so I can get all the gtk/gdk extras too? In theory, yes -- but again, I don't use the distro, so I don't know for sure. Hopefully they would have thought things through well enough that the 32-bit RPMs will just install and work, but you probably want to make sure you get the right RPMs for this version of the distro (i.e. use the CD(s) or DVD(s), or get them from Mandriva's site).