4

GDB is telling me, that the program compiled with gcc -m32 (i386 program) is incompatible with my shared libraries (i386:x86-64).

Output of gdb:

(gdb) r
Starting program: /root/format
warning: `/libexec/ld-elf.so.1': Shared library architecture i386:x86-64 is not compatible with target architecture i386.

It would be nice if someone could explain how to fix this / how to get the libraries.

1 Answer 1

6

You do not tell anything about your system so I'll just make the most likely guess. You are running a 64 bit system and have not installed any 32 bit libraries. The simplest method is to simply add them from the installer:

 bsdinstall

...and select lib32. You can run the installer at any time (not just first install). That's it.

What it does is getting the lib32.txz tarball from somewhere like http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/ and unpack it to /usr/lib32. Remember to get the correct version (check with uname -a). You can do this manually as well if you prefer. Maybe you already have it available in /usr/freebsd-dist or on a DVD.

If you do it manually then you may need to tell ldconfig that you have new libraries. Or if you have placed them in unusual locations you need to correct the paths.

ldconfig -32 /usr/lib32/ /usr/local/lib32/compat/

...or...

ldconfig -v -m -R /usr/lib32

See ldconfig(8)

You tell very little of why you try to run a 32 bit binary on a 64 bit system. If it is because it was actually made on an older version then you might want one of the compatability packages: misc/compat8x, misc/compat9x, misc/compat10x, misc/compat11x

And just to be sure: You are aware that you would normally target amd64 (i386-64) on a recent system? i386 is only 32 bit and we have moved on to 64 bit. This might be trivial to you but with the lack of context in the question I just want to make sure that we are not trying to solve the wrong problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .