HOWTO: WINE on amd64 (faster/binary way)

Since some longer time amd64 users can run WINE without a problem, but additional complete i386 environment is requied, as http://wiki.freebsd.org/Wine states, you will have to build i386 version, then build WINE and so (which of course takes time). In this guide You will learn how to install WINE on amd64 system without compiling a single file, everything will be achieved using already built packages/data sets.

Use this script below to add both i386 complete environment under /compat/i386 and wine packages along with appreciate dependencies.

Code:
#! /bin/sh

URL=ftp.freebsd.org/pub/FreeBSD/releases/i386/$( uname -r | egrep -o ".*-[A-Z]+[0-9]*" )/base
DIR=/compat/i386

mkdir -p ${DIR}
export DESTDIR=${DIR}
pkg_add -r wget
wget -r -c ftp://${URL}
cd ${URL}
chmod +x install.sh
yes | ./install.sh
cp /etc/resolv.conf ${DIR}/etc/

cat > ${DIR}/chroot.sh << __EOF
  /etc/rc.d/ldconfig start
  export MACHINE=i386
  export UNAME_p=i386
  export UNAME_m=i386
  pkg_add -r wine
__EOF

chroot ${DIR} /bin/sh chroot.sh
rm ${DIR}/chroot.sh

Just lauch it as root and it will install/do everything.

Tested, works great with Heroes ]I[ game, devfs is not needed for it, but in case some other game/application will yell about it, just mount it.

# mount -t devfs devfs /compat/i386/dev

You will also have to use these aliases:

Code:
# alias winecfg="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/winecfg"
# alias wine32="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/wine"

Works for me, in case You have any problems, this thread is the place to yell :p
 
I run this script , and it download many packages , and I think it want install all of them , So I cancel it , and I think install this packages break my system , for example this script download these packages
Code:
libX11-1.2.1,1.tbz... Done.
libXrender-0.9.4_1.tbz... Done.
libXt-1.0.5_1.tbz... Done.
libXfixes-4.0.3_1.tbz... Done.
libXdamage-1.1.1.tbz... Done.
libXext-1.0.5,1.tbz... Done.
libXpm-3.5.7.tbz... Done.
libXmu-1.0.4,1.tbz... Done.
libXi-1.2.1,1.tbz... Done.
libXxf86vm-1.0.2.tbz... Done.
Am I right ?
Do I think true ?
 
Today I run this script and I see this error first

Code:
You are about to extract the base distribution into /compat/i386 - are you SURE you want to do this over your installed system (y/n)? 
./var/empty/: Can't set user=0/group=0 for var/empty: Operation not permitted Can't update time for var/empty: Operation not permitted
./usr/sbin/sliplogin: Could not unlink: Not a directory
./usr/lib/libkse.so.3: Could not unlink: Not a directory
./usr/lib/librt.so.1: Could not unlink: Not a directory
./usr/bin/chpass: Could not unlink: Not a directory
./usr/bin/chfn: Could not unlink: Not a directory
./usr/bin/chsh: Could not unlink: Not a directory
./usr/bin/ypchpass: Could not unlink: Not a directory
./usr/bin/ypchfn: Could not unlink: Not a directory
./usr/bin/ypchsh: Could not unlink: Not a directory
./usr/bin/login: Could not unlink: Not a directory
./usr/bin/opieinfo: Could not unlink: Not a directory
./usr/bin/opiepasswd: Could not unlink: Not a directory
./usr/bin/passwd: Could not unlink: Not a directory
./usr/bin/yppasswd: Could not unlink: Not a directory
./usr/bin/rlogin: Could not unlink: Not a directory
./usr/bin/rsh: Could not unlink: Not a directory
./usr/bin/su: Could not unlink: Not a directory
./usr/bin/crontab: Could not unlink: Not a directory
./sbin/init: Could not unlink: Not a directory
./libexec/ld-elf.so.1: Could not unlink: Not a directory
./lib/libc.so.7: Could not unlink: Not a directory
./lib/libcrypt.so.4: Could not unlink: Not a directory
./lib/libthr.so.3: Could not unlink: Not a directory
./bin/rcp: Could not unlink: Not a directory
tar: Error exit delayed from previous errors.
when I run this command
Code:
whereis wine
I see this
Code:
wine: /usr/ports/emulators/wine
when I type
Code:
/usr/local/bin/wine
I see this
Code:
zsh: no such file or directory: /usr/local/bin/wine
when I type
Code:
/usr/local/sbin/wine
I see this
Code:
sh: no such file or directory: /usr/local/sbin/wine
I use
Code:
FreeBSD 7.2-RELEASE-p8 #0: Tue May 25 17:51:43 UTC 2010     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
 
@mfaridi

Today I run this script and I see this error first
Its not the first time You can not use a HOWTO properly ;)

If You run it once, then extracting base.* packages also applied various flags for the directories, check man chflags for details.

when I type
Code:
/usr/local/bin/wine
I see this
Code:
zsh: no such file or directory: /usr/local/bin/wine
You know what a chroot(1) is mate?
 
when I run this commnad
Code:
/compat/i386/usr/local/bin/wine Google\ Chrome\ 4.0.295.0\ Beta.exe
I see this error
Code:
ELF interpreter /libexec/ld-elf.so.1 not found
and
Code:
zsh: abort      /compat/i386/usr/local/bin/wine Google\ Chrome\ 4.0.295.0\ Beta.exe
I run these command too
Code:
# alias winecfg="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/winecfg"
# alias wine32="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/wine"
 
mfaridi said:
I run these command too
Code:
# alias winecfg="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/winecfg"
# alias wine32="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/wine"

You know what a alias(1) is and what is it used for?
 
I tried this script and kept getting errors. The first line of code took off the 1 from 8.1-RC1 leaving me unable to change directories properly at the remote site. Then it gave me double slashes '//' just before the base directory. I also got the ldconfig error. Once I got it somewhat debugged, to that point at least. In short I think your script needs to be reworked a bit. I'll give it another hour or two of work, but I think your how-to isn't quite how to.... I didn't get to the point of needing aliases, just couldn't get the base.aa-zz downloaded at all. Bummer, heavy sigh. Will try an mget later on the base.* and work the script from there on.
 
@dralex999

I will test it on 8.1-RELEASE as it will get out (about early august I think).

dralex999 said:
In short I think your script needs to be reworked a bit.
It seems that it will work on RELEASE and STABLE but not on RC*/BETA* so the only part that needs to be changed is the regullar expression, fixed:

% echo "8.1-RC1" | egrep -o ".*-[A-Z]+[0-9]*"
8.1-RC1
 
Nope, didn't work. I downloaded the base.* 'stuff' and ran across the same unlink problems one of the other posters had. I used the install.sh they had on the remote site instead of the script provided above. Well, anyway, I'm going to play elsewhere in the ports and forget about wine on the amd64....for now.
 
dralex999 said:
Nope, didn't work. I downloaded the base.* 'stuff' and ran across the same unlink problems one of the other posters had.

Its because files in base.** tarbals have put on various flags (man chflags for details), so You will need to remove them first, delete all 'junk' that is left and THEN start over:

# find /compat/i386 -exec chflags -f 0 {} ';'
# rm -r -f /compat/i386
 
Ok, well something went kaflouey in my system and I had to reinstall the whole thing. I'm sure it wasn't a wine thing, but nonetheless, I'll work on that script again in a couple days and see what I get. I believe I have some files in the /compat/i386/* directories so will grab a windows disk and give it a whirl.

Later..
 
Anything to have into account when using nvidia-drivers ? because when I use the alias to launch an X 3D application, it just crash without being able to find an OpenGL device :\

Code:
err:d3d_caps:WineD3D_CreateFakeGLContext Can't find a suitable iPixelFormat.
err:d3d:InitAdapters Failed to get a gl context for default adapter
err:d3d:WineDirect3DCreate Direct3D9 is not available without opengl

Thanks in advance :D
 
You should install the SAME version of nvidia drivers into the chroot environment.

Remember that you have to set MACHINE,UNAME_p and UNAME_m to i386 again in the chroot environment.

Nvidia driver depends on xorg and linux_base (fc10 in release8.1).

PD: Sorry for my poor english :D
 
I tried something similar on 9.0-CURRENT but with 8.0-RELEASE as my /compat/i386. My app would run because of a different shlib version in base, which also got me thinking that 64-bit base might not go over well at times with the 32-bit app.

My solution, was to prepend /compat/i386/lib:/compat/i386/usr/lib: to the LD_PATH similar to:
Code:
alias winecfg="LD_32_LIBRARY_PATH=/compat/i386/lib:/compat/i386/usr/lib:/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/winecfg"
alias wine32="LD_32_LIBRARY_PATH=/compat/i386/lib:/compat/i386/usr/lib:/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/wine"

I am not at that machine currently, but I will check my .zshrc later and make sure that is what I had.
 
Great job. I too have not been able to resolve the ld-elf error. I am certain it's me and not the script but any assistance in correcting this is greatly appreciated;

Code:
%/usr/compat/i386/usr/local/bin/winecfg                                         ELF interpreter /libexec/ld-elf.so.1 not found
Abort

Environment
Code:
%uname -rip
8.1-RELEASE amd64 GENERIC
%echo $SHELL
/bin/csh

Details are posted at http://freebsd.pastebin.com/mLzV9LDX

I am willing to switch to sh or install zsh (not really so high on bash) if that is the only suggestion any of you have. I mention that because my first though it that my knowledge of aliases in csh is really limited and that seems like a possible source of the issue. The only reason I am installing wine on this particular box is that I'd like to keep the installed number of ports to a minimum so virtualbox is out.

Thanks guys and gals.
 
BuSerD said:

Hi,
Has anyone already solved the "/libexec/ld-elf.so.1 not found"-problem?
I have the same problem too. Here is what i have done:
  1. First I ran vermaden's installscript from the first post. I got no error here.
  2. Then I mounted the devfs also according to the first post.
  3. Afterwards I added the aliases to my ~/.bashrc (iam using bash)
  4. Finally i copied some of the nvidia-32-bit libs to the chroot-folder:
Code:
NVIDIA-FreeBSD-x86-195.36.15/obj/libnvidia-tls.so.1 -> /compat/i386/usr/local/lib/libnvidia-tls.so.1                                                            
NVIDIA-FreeBSD-x86-195.36.15/obj/libGLcore.so.1 -> /compat/i386/usr/local/lib/libGLcore.so.1                                                                    
NVIDIA-FreeBSD-x86-195.36.15/obj/libGL.so.1 -> /compat/i386/usr/local/lib/libGL.so.1
These files were also copied to the lib32-dir by the "patch-wine-nvidia.sh"-script, that is provided with the unofficial amd64 wine builds to improve the 3D performance. So I thought putting them in the chroot might be a good idea too.

Some info about my system:
I'm running a generic kernel
My .bashrc:
Code:
alias ls='ls -G'                                                                                                                                               
 alias dir='ls'                                                                                                                                                 
 alias winecfg="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/winecfg"                         
alias wine32="LD_32_LIBRARY_PATH=/compat/i386/usr/local/lib PATH=/compat/i386/usr/local/bin:$PATH /compat/i386/usr/local/bin/wine"                          
 PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]'
The content of the libexec folders:
Code:
vdop ~ $ ls /libexec/                                                                                                                                           
ld-elf.so.1                                                                                                                                                     
vdop ~ $ ls /compat/i386/libexec/
ld-elf.so.1

And here is what happens when I try to run wine:
Code:
vdop ~ $ wine32
ELF interpreter /libexec/ld-elf.so.1 not found                                                                                                                  
Abort trap: 6                                                                                                                                                   
vdop ~ $ winecfg                                                                                                                                                
ELF interpreter /libexec/ld-elf.so.1 not found                                                                                                                  
Abort trap: 6

Now if I manually chroot into /compat/i386, this error does not occur:
Code:
root /home/vdop #  chroot /compat/i386/ /usr/local/bin/bash                                                                                                     
[root@bsdbox /]# wine                                                                                                                                           
Usage: wine PROGRAM [ARGUMENTS...]   Run the specified program                                                                                                  
       wine --help                   Display this help and exit                                                                                                 
       wine --version                Output version information and exit                                                                                        
[root@bsdbox /]# winecfg                                                                                                                                        
Application tried to create a window, but no driver could be loaded.                                                                                            
Make sure that your X server is running and that $DISPLAY is set correctly.                                                                                     
err:systray:initialize_systray Could not create tray window                                                                                                     
Application tried to create a window, but no driver could be loaded.                                                                                            
Make sure that your X server is running and that $DISPLAY is set correctly.                                                                                     
[root@bsdbox /]#

So there seems to be a problem with the aliases and the settings for the paths. I just can't figure out what.


Greetings,
Chris
 
Just in case someone is interested in the solution of this problem:
It was my fault, as there were some libs in /usr/lib32 missing!

I just fetched all the files from here ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.1-RELEASE/lib32/ and ran
Code:
sh install.sh

Then I rebuilt all of the sources again:
Code:
cd /usr/src; make build32 install32; ldconfig -v -m -R /usr/lib32

Then it worked like a charm on both ways (Your chroot/alias-solution and the unofficial wine-amd64 package)


Greetings,
Chris
 
I am running 8.1 on AMD64 (I swear my next system will be Intel) I am unable to install Wine, I tried everything ..
The reason I am stuck with FreeBSD is because PCBSD disabled both my AMD64 systems after install.
I had to unplug the HD in order to be able to boot something because the bios kept hanging (some bug) and even the F10 or DEL options were useless. (Had to plug them back in after booting Gparted).
Ok, I admit, I am a total noob, so any help of you BSD gods is appreciated ..

1) Do not know what happened with this port but it is not available

2) These builds for AMD install, but do not show up in the KDE menu, but only in search. After booting I see the Wine icon at the mouse pointer for a minute after which it stops and nothing happens

3) I tried this link

but after the first command

# cd /usr/src && make buildworld installworld distribution TARGET=i386 DESTDIR=/compat/i386


I wait 45 minutes after which I have the following message

Code:
>>> Making hierarchy
--------------------------------------------------------------
cd /usr/src; make -f Makefile.inc1 hierarchy
cd /usr/src/etc;                make distrib-dirs
mtree -eU  -f /usr/src/etc/mtree/BSD.root.dist -p /compat/i386/
mtree: /compat/i386/: No such file or directory
*** Error code 1

Stop in /usr/src/etc.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.

4) So I found this thread and tried the script in the first post above with the following somewhat similar outcome as in (3):

Code:
FINISHED --2010-11-24 19:49:29--
Downloaded: 43 files, 53M in 6m 56s (130 KB/s)
$ cd ${URL}
$ chmod +x install.sh
$ yes | ./install.sh
Sorry, this must be done as root.
$ cp /etc/resolv.conf ${DIR}/etc/
cp: directory /compat/i386/etc does not exist
$ 
$ cat > ${DIR}/chroot.sh << __EOF
>   /etc/rc.d/ldconfig start
>   export MACHINE=i386
>   export UNAME_p=i386
>   export UNAME_m=i386
>   pkg_add -r wine
> __EOF
cannot create /compat/i386/chroot.sh: No such file or directory
$ 
$ chroot ${DIR} /bin/sh chroot.sh
chroot: /compat/i386: No such file or directory
$ rm ${DIR}/chroot.sh


Is there any way how I can solve this problem? Thanks in advance
 
thx for the reply

I did not notice it in the message but I already ran this in root, with the necessary errors. I discovered the port wget was not configured correctly and did a make config.

I updated and upgraded all available ports, this seems to have solved the necessary errors but for some reason I am still unable to get it working. I'll keep trying till I found the source of this problem.
 
I used it on FreeBSD 8.0-RELEASE, I havent tried it on 8.1, maybe the guide (or WINE) is broken now ...
 
VdoP said:
Just in case someone is interested in the solution of this problem:
It was my fault, as there were some libs in /usr/lib32 missing!

I just fetched all the files from here ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/8.1-RELEASE/lib32/ and ran
Code:
sh install.sh

Then I rebuilt all of the sources again:
Code:
cd /usr/src; make build32 install32; ldconfig -v -m -R /usr/lib32

Then it worked like a charm on both ways (Your chroot/alias-solution and the unofficial wine-amd64 package)


Greetings,
Chris

Pardon my ignorance, but does this have to be done outside of chroot?

I have copied the lib32 files in, put them in /compat/i386/usr/lib32 and I get the following error (in chroot)
Code:
make: don't know how to make build32. Stop
*** Error code 2
 
Thank you vermaden.

Here's a version which will work on FreeBSD 9 (it will *not* work on FreeBSD 8 and earlier).

Code:
#! /bin/sh

URL=ftp.freebsd.org/pub/FreeBSD/releases/i386/$( uname -r | egrep -o ".*-[A-Z]+[0-9]*" )/base.txz
DIR=/usr/compat/i386

mkdir -p ${DIR}

fetch ftp://${URL}
tar xf base.txz -C ${DIR}
cp /etc/resolv.conf ${DIR}/etc/

mount -t devfs devfs /compat/i386/dev

cat > ${DIR}/chroot.sh << __EOF
  /etc/rc.d/ldconfig start
  export MACHINE=i386
  export UNAME_p=i386
  export UNAME_m=i386
  pkg_add -r wine
__EOF

chroot ${DIR} /bin/sh chroot.sh
rm ${DIR}/chroot.sh

I changed the install directory to /usr/compat/i386 because my rootfs isn't large enough.

(You may want to add the devfs mount to your fstab).
 
Back
Top