# Upgrading existing FreeBSD 10 to use 32-bit libraries



## pta99 (Apr 9, 2014)

I have a nearly completely configured FreeBSD 64-bit machine and I need to enable / install the 32-bit compatibility libraries - did not do this at install time.   :x  Looked in manual and searched on google - there doesn't seem to be a post about how to do this.  I'm afraid to use `bsdinstall` for fear that it will be destructive to all the configuration I've done so far.  There must be a manual method to install these libraries but what is it?


----------



## kpa (Apr 9, 2014)

Extract the lib32.txz tarball from the distribution sets (should be at /usr/freebsd-dist on the installation media) at the root directory and that should be all.


----------



## SirDice (Apr 9, 2014)

Or, if you do a full build(7) of world it will also get installed.


----------



## pta99 (Apr 9, 2014)

Thank you.  The libraries were installed!  I did as you suggested, I extracted the lib32.txz file ( `tar xvzf lib32.txz` ).  Is there anything else I need to do to make them usable?  The application that I'm trying to install still returns :


```
# ./install.sh
ELF interpreter /libexec/ld-elf.so.1 not found
Abort trap
```

However, the file exists on the machine:


```
# whereis ld-elf.so.1
ld-elf.so.1: /usr/libexec/ld-elf.so.1 /usr/share/man/man1/ld-elf.so.1.1.gz
```

and more specifically: 


```
root@rd1:/libexec # ls
ld-elf.so.1	resolvconf
```

If the file exists why am running into this error?  Really stumped.

I'm unwilling to do a rebuild of world - I'm doing it remotely and can't afford a problem shutting me out of the machine …


----------



## SirDice (Apr 10, 2014)

I think you need to tell ldconfig(8) there are libraries in /usr/lib32. Try this:
`ldconfig -32 /usr/lib32/ /usr/local/lib32/compat/`


----------



## pta99 (Apr 10, 2014)

Let me start by saying that I am a total newbie to FreeBSD 10 so please forgive me for asking.  I have looked up `ldconfig` and tried to figure this out but the suggestion you made does not work.  My directory structure is apparently different from the paths you suggested:



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



The output I got from that is: 


```
# ldconfig -32 /usr/lib32/ /usr/local/lib32/compat/
ldconfig: warning: /usr/local/lib32/compat/: No such file or directory
```


```
/usr/local/lib # ls
X11		libpkg.a	libpkg.so	libpkg.so.1
```

The first 32-bit file that needs to be present is there:


```
# whereis ld-elf.so.1
ld-elf.so.1: /usr/libexec/ld-elf.so.1 /usr/share/man/man1/ld-elf.so.1.1.gz
```

and also here:


```
root@rd1:/libexec # ls
ld-elf.so.1   resolvconf
```

Does this mean that while the file that I need is on the system, it's in the wrong place or that I failed to install the 32-bit libraries in the correct location?  Something else?


----------



## kpa (Apr 10, 2014)

Have you rebooted after installing the libraries? That would have fixed the linker paths. If you haven't yet rebooted you don't have to because this should do the trick:

`service ldconfig start`


----------



## pta99 (Apr 10, 2014)

I rebooted and it still doesn't work.  I then implemented your suggestion as follows:


```
# service ldconfig start
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib
32-bit compatibility ldconfig path: /usr/lib32
```

But unfortunately, it still looks like the needed file can't be found …


```
# ./install.sh
ELF interpreter /libexec/ld-elf.so.1 not found
Abort trap
```

I checked again and /libexec/ld-elf.so.1 is still there.

from the output of `service ldconfig start` above it looks like /libexec and /usr/libexec are not in the path of ldconfig.  Would it then be correct to run `ldconfig` as follows?

`ldconfig -elf /libexec`

and 

`ldconfig -elf /usr/libexec`


----------



## kpa (Apr 10, 2014)

What exactly is the application you're trying to install. Is it really for FreeBSD?


----------



## pta99 (Apr 10, 2014)

I'm trying to install surgemail_65a2_freebsd8.tar.gz (see www.netwinsite.com).  It is my understanding that this version applies to FreeBSD and all subsequent versions of FreeBSD though I'm checking with them now - waiting for confirmation.  However, this application is looking for ld-elf.so.1 in /libexec and the file is there - how then, could it be a problem with the application?  But then again, I don't have any answers so maybe I'm wrong?


----------



## SirDice (Apr 11, 2014)

Judging by the number in the filename I'm guessing it was built for FreeBSD 8. If you are on 10.0 you'll need misc/compat8x and misc/compat9x. The kernel also needs COMPAT_FREEBSD8 and COMPAT_FREEBSD9, the GENERIC kernel should have them already.


----------



## pta99 (Apr 12, 2014)

That makes sense.  I'll try to figure out how to do that!    Will report back what I find.


----------



## pta99 (Apr 12, 2014)

I was able to install  misc/compat8x and misc/compat9x but I can't find any reference on how to find whether they're part of the GENERIC kernel.  I used `bsdconfig` and installed them from the packages.  I've rebooted the machine and it does not appear that the system knows about these two new packages - the problem persists with the same error.  

Does anyone have any suggestions on where the issue might be?  

Even after installing misc/compat8x and misc/compat9x I still get 


```
# ./install.sh
ELF interpreter /libexec/ld-elf.so.1 not found
Abort trap
```

What I can say is that the application I'm trying to run is a freeBSD 32-bit application but I'm running a 64-bit machine.  Could that be the reason why it can't see /libexec/ld-elf.so.1?.


----------

