View Single Post
  #1   (View Single Post)  
Old 9th December 2008
Gemini Gemini is offline
New User
 
Join Date: Dec 2008
Posts: 7
Default I386 ELF32 binary on AMD64 system can't find shared libraries

Hello all,

I have encountered an issue trying to execute an I386 ELF32 binary on my AMD64 platform. When I attempt to execute the binary, it reports back with the following error:

Code:
[user@k8 ~]$ ./zsnes
/libexec/ld-elf.so.1: /usr/local/lib/libSDL-1.2.so.11: unsupported file layout
Now, it appears that the binary is attempting to link to a 64-bit version of the library that I have installed rather than the 32-bit version of the library. This is odd because I do have the 32-bit library installed, and it is listed in the hints cache:

Code:
[user@k8 ~]$ ldconfig -r |grep libSDL
359:-lSDL-1.2.11 => /usr/X11R6/lib/libSDL-1.2.so.11
674:-lSDL-1.2.11 => /usr/local/lib/libSDL-1.2.so.11

[user@k8 ~]$ ldconfig -32 -r |grep libSDL
76:-lSDL-1.2.11 => /usr/lib32/libSDL-1.2.so.11
However, when I attempt to dump the library dependencies of the binary, it doesn't show up:

Code:
[user@k8 ~/bin]$ ldd32 ./zsnes 
./zsnes:
	libz.so.3 => /usr/lib32/libz.so.3 (0x2834d000)
	libSDL-1.2.so.11 => not found (0x0)
	libpng.so.5 => not found (0x0)
	libstdc++.so.5 => /usr/lib32/libstdc++.so.5 (0x2835f000)
	libm.so.4 => /usr/lib32/libm.so.4 (0x28434000)
	libpthread.so.2 => /usr/lib32/libpthread.so.2 (0x2844a000)
	libc.so.6 => /usr/lib32/libc.so.6 (0x28471000)
I've run elfdump against all of libraries, and they all come back with:

Code:
elf header:

	e_ident: ELFCLASS32 ELFDATA2LSB ELFOSABI_FREEBSD
	e_type: ET_DYN
	e_machine: EM_386
	e_version: EV_CURRENT
The only difference between the 32-bit libraries being detected by ldd32 and those that are missing is that I hand installed the latter libraries myself. I grabbed the parent package from the i386/packages-6.3, unrolled the tarballs, and copied the files over manually, checked permissions, and then ran ldconfig -R. No luck.

So, what am I doing wrong here? Is there something special about the libraries installed with the lib32 distribution set versus ones in the wild?

System is running FreeBSD 6.4-RELEASE/AMD64. Kernel was built with "options COMPAT_IA32".

Last edited by Gemini; 9th December 2008 at 06:52 AM. Reason: missed pasting a line with my ldconfig -r output
Reply With Quote