# 32 bit ports on an amd64 system



## mamalos (Jul 21, 2010)

Hi all,

for a few reasons I want to "upgrade" my laptop from fbsd8-32bit into fbsd64-bit. Since I have lots of ports/packages installed already, I was hoping that I could manage running 32bit ports (at least most of them) on a 64bit installation.

Before blowing off my installation, I found it wise to install fbsd-amd64 on a memory stick, and try to see how it would work when mounting /usr/local from my local hard drive. 

After running the /path/to/installationcd/lib32/install.sh and restarting the system, I mounted /usr/local from my local hard drive. I ran ldconfig -m /usr/local/lib so as to "inform" ldconfig about the "new libraries" and started running 32bit applications (like bash, startx, etc.). None of them ran correctly, since all of them wouldn't be able to find their dependent libraries, even though ldconfig -r would show them. What I noticed was that the error returned talked about ld-elf.so.1 instead of ld-elf32.so.1. 

I know that I must be missing something very trivial, but my head is stuck, and I would greatly appreciate if someone could help me in this.

The installation media I used was bsd8.1-release (?! I thought it would be named pre-release...) from ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/8.1/FreeBSD-8.1-RELEASE-amd64-disc1.iso.

Thank you all in advance,

mamalos


----------



## mamalos (Jul 23, 2010)

Whoever moved this post from "Installing & Upgrading" to "Installation and Maintenance of FreeBSD Ports or Packages", with no offense, I think they were very wrong. My problem is not how to install or upgrade my ports and/or packages, my problem is to understand what I have done wrong so that my 64bit FreeBSD seems to fail to call the right linker when running a 32bit binary , and also fails to read the "correct" libraries even though they are installed.

No offense again, just stating my opinion.


----------



## dbi (Jul 23, 2010)

/* offtopic

Whoever did that was absolutely correct. "Installing & Upgrading" is a forum in the "Base System" category, while "Installation and Maintenance of FreeBSD Ports or Packages" is in the "Ports & Packages" category and your question is about ports...

*/

On the subject:

Perhaps this information will help you a little.

http://wiki.freebsd.org/Wine
http://forums.freebsd.org/showthread.php?t=13982


----------



## fairy (Jul 24, 2010)

Try to add following into /etc/rc.conf

```
ldconfig32_paths="$ldconfig32_paths /usr/local/lib"
ldconfig_local32_dirs="$ldconfig_local32_dirs /usr/local/libdata/ldconfig"
```
then rerun ldconfig script
`# /etc/rc.d/ldconfig restart`
Does above solve your problem with running already installed 32bit ports?

As for building 32bit ports on amd64 without using chroot there are some issues to be resolved, see this thread on ml. I've tried extend that wrapper a bit but it still fails to build a few ports: ftp://ftp.lissyara.su/users/Guest/cc32wrapper.


----------



## mamalos (Jul 26, 2010)

fairy thank you very much for your help!

After a few tweeks (my 64bit base system is installed in a memory stick, while everything else is installed in zfs, so when ldconfig runs /usr/local is not yet mounted. After zfs mounting it -manually- and rerunning /etc/rc.d/ldconfig restart, ldconfig sees all shared libraries) everything seems to work fine. 

My new problem is with the nvidia-driver, whose original version is 32bit while the system is 64bit. I deinstalled the driver and reinstalled it so as to install its 64bit version. Nevertheless, the driver is not loaded with kldload nvidia, and the error returned is something regarding kernel mismatch or something (I did not save it, so I cannot post it here, but the first part was "KLD nvidia.ko: depends on kernel - not available or version mismatch"), and some other message mentioning the linker. Other 32bit binaries seemed to work just fine (like bash for example), so my new task is to resolve the issue with the nvidia driver.

Thank you once more for your help!


----------



## lily (Jul 26, 2010)

You probably have different sources for kernel than the one you're running. The easiest way to solve it is to recompile kernel, then nvidia module.

BTW, you'll probably need to install 32bit version of driver (mostly libs, not kmod) if you're gonna use it with 32bit Xorg and 32bit opengl apps.


----------

