Pages

21 August 2013

497. Compiling Wine 1.7 in a chroot on debian

Here's a generic way of building Wine 1.7 which is the new testing branch. And yes, it's the instructions for 1.5.28-1.6 recycled, with a few small amendments.

See here for information about 3D acceleration using libGL/U with Wine: http://verahill.blogspot.com.au/2013/05/429-briefly-wine-libglliubglu-blender.html

Getting started:
If you set up a e.g. chroot to build 1.6 you don't need to set up a new chroot to build 1.7. In that case, skip the set-up step below and instead re-enter your existing chroot like this:

sudo mount -o bind /proc wine32/proc
sudo cp /etc/resolv.conf wine32/etc/resolv.conf
sudo chroot wine32
su sandbox
cd ~/tmp

And skip to 'Building wine'.

Otherwise do this:
Setting up the Chroot
sudo apt-get install debootstrap
mkdir $HOME/tmp/architectures/wine32 -p
cd $HOME/tmp/architectures
sudo debootstrap --arch i386 wheezy $HOME/tmp/architectures/wine32 http://ftp.au.debian.org/debian/
sudo mount -o bind /proc wine32/proc
sudo cp /etc/resolv.conf wine32/etc/resolv.conf
sudo chroot wine32

You're now in the chroot:
apt-get update
apt-get install locales sudo vim
echo 'export LC_ALL="C"'>>/etc/bash.bashrc
echo 'export LANG="C"'>>/etc/bash.bashrc
echo '127.0.0.1 localhost beryllium' >> /etc/hosts
source /etc/bash.bashrc
adduser sandbox
usermod -g sudo sandbox
echo 'Defaults !tty_tickets' >> /etc/sudoers
su sandbox
cd ~/

Replace 'beryllium' with the name your host system (it's just to suppress error messages)

Building Wine
While still in the chroot, continue (the i386 is ok; don't worry about it -- you don't actually need it):

sudo apt-get install libx11-dev:i386 libfreetype6-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxxf86vm-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcomposite-dev:i386 libglu-dev:i386 libosmesa-dev:i386 libglu-dev:i386 libosmesa-dev:i386 libdbus-1-dev:i386 libgnutls-dev:i386 libncurses-dev:i386 libsane-dev:i386 libv4l-dev:i386 libgphoto2-2-dev:i386 liblcms2-dev:i386 libgstreamer-plugins-base0.10-dev:i386 libcapi20-dev:i386 libcups2-dev:i386 libfontconfig-dev:i386 libgsm1-dev:i386 libtiff-dev:i386 libpng-dev:i386 libjpeg-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libldap-dev:i386 libxrender-dev:i386 libxml2-dev:i386 libxslt-dev:i386 libhal-dev:i386 gettext:i386 prelink:i386 bzip2:i386 bison:i386 flex:i386 oss4-dev:i386 checkinstall:i386 ocl-icd-libopencl1:i386 opencl-headers:i386 libasound2-dev:i386 build-essential
mkdir ~/tmp
cd ~/tmp
wget http://prdownloads.sourceforge.net/wine/wine-1.7.0.tar.bz2

tar xvf wine-1.7.0.tar.bz2
cd wine-1.7.0/
./configure
time make -j3
sudo checkinstall --install=no
checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran This software is released under the GNU GPL. The package documentation directory ./doc-pak does not exist. Should I create a default set of package docs? [y]: Preparing package documentation...OK Please write a description for the package. End your description with an empty line or EOF. >> wine 1.7.0 >> ***************************************** **** Debian package creation selected *** ***************************************** This package will be built according to these values: 0 - Maintainer: [ root@beryllium ] 1 - Summary: [ wine 1.7.0] 2 - Name: [ wine ] 3 - Version: [ 1.7.0] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ i386 ] 8 - Source location: [ wine-1.7.0 ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ wine ] 12 - Conflicts: [ ] 13 - Replaces: [ ]
Checkinstall takes a little while (In particular this step: 'Copying files to the temporary directory...').
********************************************************************** Done. The new package has been saved to /home/sandbox/tmp/wine-1.7.0/wine_1.7.0-1_i386.deb You can install it in your system anytime using: dpkg -i wine_1.7.0-1_i386.deb **********************************************************************


Installing Wine

Exit the chroot
sandbox@beryllium:~/tmp/wine-1.7.0$ exit
exit
root@beryllium:/# exit
exit
me@beryllium:~/tmp/architectures$ 

On your host system
 Enable multiarch* and install ia32-libs, since you've built a proper 32 bit binary:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install ia32-libs libgstreamer-plugins-base0.10-0

*At some point I think ia32-libs may be replaced by proper multiarch packages, but maybe not. So we're kind of doing both here.

 Copy the .deb package and install it
sudo cp wine32/home/sandbox/tmp/wine-1.7.0/wine_1.7.0-1_i386.deb .
sudo chown $USER wine_1.7.0-1_i386.deb
sudo dpkg -i wine_1.7.0-1_i386.deb

20 comments:

  1. Works for 1.7.1 too.
    Thanks!

    ReplyDelete
  2. Here is a slightly changed version for installing on sid/unstable.
    ----
    ##############
    # PREPARATION -run once
    ##############

    # SET UP CHROOT:
    mkdir /home/build/chroot32/ -p
    sudo apt-get install debootstrap
    cd /home/build
    sudo debootstrap --arch i386 sid chroot32 http://ftp.se.debian.org/debian/
    sudo mount -o bind /proc /home/build/chroot32/proc
    sudo cp /etc/resolv.conf /home/build/chroot32/etc/resolv.conf
    sudo chroot /home/build/chroot32

    # (you're now in the chroot)
    apt-get update
    apt-get install locales sudo vim
    echo 'export LC_ALL="C"'>>/etc/bash.bashrc
    echo 'export LANG="C"'>>/etc/bash.bashrc
    # CHANGE hostname to your hostname
    echo '127.0.0.1 localhost hostname' >> /etc/hosts
    source /etc/bash.bashrc
    adduser sandbox
    usermod -g sudo sandbox
    echo 'Defaults !tty_tickets' >> /etc/sudoers
    su sandbox

    # INSTALL 32bit PACKAGES AND WINE BUILD-DEPS:
    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install ia32-libs-i386 libgstreamer-plugins-base0.10-0
    sudo apt-get install libx11-dev:i386 libfreetype6-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxxf86vm-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcomposite-dev:i386 libglu-dev:i386 libosmesa-dev:i386 libglu-dev:i386 libosmesa-dev:i386 libdbus-1-dev:i386 libgnutls-dev:i386 libncurses-dev:i386 libsane-dev:i386 libv4l-dev:i386 libgphoto2-2-dev:i386 liblcms2-dev:i386 libgstreamer-plugins-base0.10-dev:i386 libcapi20-dev:i386 libcups2-dev:i386 libfontconfig-dev:i386 libgsm1-dev:i386 libtiff-dev:i386 libpng-dev:i386 libjpeg-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libldap-dev:i386 libxrender-dev:i386 libxml2-dev:i386 libxslt-dev:i386 libhal-dev:i386 gettext:i386 prelink:i386 bzip2:i386 bison:i386 flex:i386 oss4-dev:i386 checkinstall:i386 ocl-icd-libopencl1:i386 opencl-headers:i386 libasound2-dev:i386 build-essential


    ############
    # BUILD WINE -every new build
    ############

    # ENTER CHROOT (skip if you're already in chroot):
    sudo mount -o bind /proc /home/build/chroot32/proc
    sudo cp /etc/resolv.conf /home/build/chroot32/etc/resolv.conf
    sudo chroot /home/build/chroot32
    su sandbox

    # UPGRADE PACKAGES (optional):
    sudo apt-get update
    sudo apt-get upgrade

    # BUILD WINE RELEASE:
    wget http://prdownloads.sourceforge.net/wine/wine-1.7.1.tar.bz2
    tar xvf wine-1.7.1.tar.bz2
    # OR BUILD FROM GIT
    #git clone git://source.winehq.org/git/wine.git
    cd wine-1.7.1/
    ./configure
    time make -j3
    sudo checkinstall --install=no
    # (answear questions)

    # EXIT CHROOT:
    exit
    exit

    # INSTALL WINE:
    sudo cp /home/build/chroot32/home/sandbox/wine-1.7.1/wine_1.7.1-1_i386.deb .
    sudo chown $USER wine_1.7.1-1_i386.deb
    sudo dpkg -i wine_1.7.1-1_i386.deb

    ----
    Changes for sid:
    a) sudo debootstrap --arch i386 sid chroot32 http://ftp.debian.org/debian/
    b) ia32-libs to ia32-libs-i386 (ia32-libs was not available for some reaseon)

    ReplyDelete
    Replies
    1. Thanks for the feedback and the build instructions. I need to look into ia32-libs soon -- I think it's in flux on jessie as well.

      Delete
    2. You need to install binutils-multiarch.

      Delete
  3. I run into a checkinstall bug to do with mkdir -p....
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717778

    the workaround is to add "--fstrans=no" to the checkinstall invocation

    ReplyDelete
    Replies
    1. That's right -- I thought I had started to add that to the checkinstall commands in the posts by default, but apparently not.
      Thank you for the feedback.

      Delete
  4. FAILED at checkinstall step:

    (...)
    make[1]: Nothing to be done for `all'.
    make[1]: Leaving directory `/home/sandbox/tmp/wine-1.7.5/dlls/xpssvcs'
    STRIPPROG="strip" ./tools/install-sh dlls/xpssvcs/xpssvcs.dll.so /usr/local/lib/wine/xpssvcs.dll.so
    /usr/bin/install -c -m 644 dlls/xpssvcs/xpssvcs.dll.fake /usr/local/lib/wine/fakedlls/xpssvcs.dll
    make[1]: Entering directory `/home/sandbox/tmp/wine-1.7.5/fonts'
    make[1]: Nothing to be done for `all'.
    make[1]: Leaving directory `/home/sandbox/tmp/wine-1.7.5/fonts'
    make[1]: Entering directory `/home/sandbox/tmp/wine-1.7.5/fonts'
    /bin/mkdir -p -m 755 /usr/local/share/wine/fonts
    /bin/mkdir: cannot create directory `/usr/local/share/wine': No such file or directory
    make[1]: *** [/usr/local/share/wine/fonts] Error 1
    make[1]: Leaving directory `/home/sandbox/tmp/wine-1.7.5/fonts'
    make: *** [fonts/install] Error 2

    **** Installation failed. Aborting package creation.

    Cleaning up...OK

    Bye.

    Any help?

    ReplyDelete
  5. Fixed with:
    sudo checkinstall --install=no --fstrans=no

    Thank you Anonymous (16 October, 2013 02:34).

    ReplyDelete
  6. works for 1.7.6 too (though I had to mkdirs manually during checkinstall), thanks!

    ReplyDelete
    Replies
    1. checkinstall --fstrans=no should obviate the need for creating directories manually

      Delete
  7. The build steps worked a charm for 1.7.7 under Debian Stable (Wheezy / 7.0). Will update with installation and running.

    ReplyDelete
  8. wine 1.7.10 works fine with this procedure

    ReplyDelete
  9. Hello,
    Thanks for sharing this very interesting post as a solution to a very old and persistent problem :)
    I was wondering if the process can be streamlined using tools like "sbuild" and "pbuilder"?
    (I am yet to work on your solution AS IS...though the approach appeared familiar.)
    Cheers!

    ReplyDelete
  10. Hello, thanks so much for this walk through. I don't know if this is supposed to be complete, but don't you need to " winecfg "somewhere during the process to actually get the wine up and running? I want to make sure that I install conrrectly!
    Thanks again this has been a very valuable learning aid.

    ReplyDelete
    Replies
    1. Happy it worked out for you. No, you don't need to do winecfg at any stage.

      Most likely you'll be asked to install gecko and/or mono on your first use of wine.

      Delete
  11. wine 1.7.13 works fine with this procedure, too

    ReplyDelete
  12. Hi, I followed this procedure for Jessie and most of the stuff worked fine. The problem arises with ia32-libs as it seems to have been removed from testing. Will it be possible to provide a list of libraries (32 bit) which are required for wine, so that I can do a manual install?

    ReplyDelete
    Replies
    1. Your best bet is probably to use ldd to figure out what packages may be missing.(if any)
      e.g.
      ldd `which wine`
      linux-gate.so.1 (0x55576000)
      libwine.so.1 => /usr/local/bin/../lib/libwine.so.1 (0x55579000)
      libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0x55761000)
      libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0x5577d000)
      libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0x55928000)
      libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0x5592d000)
      /lib/ld-linux.so.2 (0x55555000)

      Delete