16 May 2013

416. Compiling Wine 1.5.30 in a chroot (fixed)

Update 2, 22 May 2013: Thanks to the Anonymous poster who pointed out that wine 1.5.30 was broken! Anyway, I've updated this post with instructions how to patch the wine 1.5.30 sources so that it includes libwine in the final .deb package.

(I normally attached a screenshot of the winecfg about tab, but not this time -- had I done that I would've realised something was wrong. )

It's fixed now. Wine 1.5.30 is OK again.






Update 22 May 2013: libwine.so.1 doesn't get included in the deb package, which causes severely reduced functionality. I've confirmed that Wine 1.5.28 built as shown in http://verahill.blogspot.com.au/2013/04/387-compiling-wine-1528-in-i386-chroot.html works fine though.

I'll update here when I've figured out why the compiled libraries don't get included.

It's similar to what is mentioned in these bug reports:
https://bugs.archlinux.org/task/35189
https://bugs.archlinux.org/task/35190
https://bugs.archlinux.org/task/35191

There's a fix here: http://bugs.winehq.org/attachment.cgi?id=44422


Original post:
While it'd be absolutely fair to accuse me of recycling posts, I have a reasonably good reason for doing so: posting build instructions for the latest version -- even if identical to instructions for earlier versions -- confirms that it 'works'. Also, it shows that the instructions are current.

I'm too much of a hoarder to go back and update old posts.

Anyway, here's a generic way of building wine which works for 1.5.30 (and 1.5.28 and everything in between). And yes, I've copy/pasted from my old 1.5.28 post...

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

Getting started:
If you set up a chroot to build 1.5.28 before, you don't need to set up a new chroot to build 1.5.30. 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

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 liblcms-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.5.30.tar.bz2
tar xvf wine-1.5.30.tar.bz2
cd wine-1.5.30/
wget http://bugs.winehq.org/attachment.cgi?id=44422 -O diff.patch
patch -p1 < diff .patch
patching file configure patching file configure.ac patching file libs/wine/Makefile.in
./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.5.30-2 >> ***************************************** **** Debian package creation selected *** ***************************************** This package will be built according to these values: 0 - Maintainer: [ root@beryllium ] 1 - Summary: [ wine 1.5.30-2 ] 2 - Name: [ wine ] 3 - Version: [ 1.5.30-2 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ i386 ] 8 - Source location: [ wine-1.5.30 ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ wine ] 12 - Conflicts: [ ] 13 - Replaces: [ ]
Compilation took ca 13 minutes with three threads. Checkinstall takes a little while (In particular this step: 'Copying files to the temporary directory...').

Installing Wine

Exit the chroot
sandbox@beryllium:~/tmp/wine-1.5.30$ 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

*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.5.30/wine_1.5.30-1_i386.deb .
sudo chown $USER wine_1.5.30-1_i386.deb
sudo dpkg -i wine_1.5.30-1_i386.deb

16 comments:

  1. I had a problem while in the chroot using checkinstall : the system call __stat would produce the error : "Value too large for defined data type" because the inodes of the files it's trying to create is 64 bits and too high for 32 bits. The problem is not easy to solve (i've been recompiling installwatch.c), but there's an easy workaround : you can compile in 32 bits and run checkinstall in your normal 64 bits shell, and just change the architecture to i386 from x64. Then the package is created and it works perfect ! thx for the tutorial :D

    ReplyDelete
    Replies
    1. Thank you for the feedback and the fix.

      * What kernel version are you running (and what distro/release)?
      * What files system are you using (ext2/3/4?)

      I'm just interested in understanding under what circumstances this might occur since I haven't seen it before.

      Delete
  2. #uname -a
    Linux neptune 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux

    The filesystem on which i compiled is XFS, and now that you asked it, i'll try to compile it on a EXT4 filesystem tomorrow to see if it could be part of the problem !

    ReplyDelete
    Replies
    1. Thanks for the update. It shouldn't be the kernel, and googling for xfs and the error above returns quite a few hits.

      Delete
    2. >_> .... that was the problem. I've been fighting with weird error during 2 days, debugging stuff and system calls. On the bright side of things, it seems the scenario depicted in the terminator movies won't happen because Skynet will just bug sometime...

      Delete
  3. Compiling Wine Pulse -

    http://repo.or.cz/w/wine/multimedia.git

    - which has very fine sound quality -

    worked beautifully by this method. Wine had refused to compile after Debian upgraded to jessie and the intended or indirect removal of ia32-libs - which cannot be installed in the main system even using sources from sid.

    A remaining problem is that win32 programs that require Nvidia 32 bit drivers in Wine have been out of commission for some time now. They include Sculptris and probably win32 Blender. Any way to restore accelerated Nvidia 32 bit functionality to Wine?

    ReplyDelete
  4. Works fine all the way to the end, but then when executing winecfg it says:

    error while loading shared libraries: libwine.so.1: cannot open shared object file: No such file or directory

    I have checked and while it build the shared library did it not end in the deb package and so does not get installed in the destination directory .../lib/ nor .../lib/wine/

    Did you miss to mention a step somewhere?

    ReplyDelete
    Replies
    1. Thanks for the feedback. You're right -- I get the same message when doing winecfg.

      I've confirmed that libwine.so.1 was included in my 1.5.28 deb package that I built here: http://verahill.blogspot.com.au/2013/04/387-compiling-wine-1528-in-i386-chroot.html

      Use that while I figure out what's wrong.

      Delete
    2. OK, it's been fixed. See updated build with patch.

      Delete
  5. Using a chroot build of wine multimedia 32 bit - accelerated graphics require a new i386 driver from multiarch:

    $ wine blender
    err:module:load_builtin_dll failed to load .so lib for builtin L"GLU32.dll": libGLU.so.1: cannot open shared object file: No such file or directory

    $ wine sculptris.exe
    err:module:load_builtin_dll failed to load .so lib for builtin L"GLU32.dll": libGLU.so.1: cannot open shared object file: No such file or directory

    libGLU.so.1 is a link to a driver that is part of libglu1-mesa-dev - but wine complains of the wrong architecture if a link is put of the installed libglu1-mesa (amd64) into /usr/lib

    So there is a chance that changing the architecture of libglu1-mesa will restore accelerated graphics to wine. Changing sources from jessie to sid temporarily to test(jessie prevents the operation because it would cause broken packages):

    # apt-get install libglu1-mesa:i386
    ...
    The following extra packages will be installed:
    gnuplot-qt libatomic1 libegl1-mesa libegl1-mesa-drivers libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-dri:i386 libgl1-mesa-glx libgl1-mesa-glx:i386 libglapi-mesa libglapi-mesa:i386 libgles2-mesa libglu1-mesa
    libglu1-mesa-dev mesa-common-dev
    Suggested packages:
    gnuplot-doc libglide3 libglide3:i386
    The following packages will be REMOVED:
    blender enblend gimp-plugin-registry gnuplot-x11 hugin hugin-tools libglew-dev libglew1.7 mesa-utils meshlab openimageio-tools openshot
    The following NEW packages will be installed:
    gnuplot-qt libatomic1 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386 libglu1-mesa:i386
    The following packages will be upgraded:
    libegl1-mesa libegl1-mesa-drivers libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgles2-mesa libglu1-mesa libglu1-mesa-dev mesa-common-dev
    10 upgraded, 6 newly installed, 12 to remove and 701 not upgraded.
    Need to get 51.3 MB of archives.
    After this operation, 81.4 MB disk space will be freed.
    Do you want to continue [Y/n]?

    It is unclear whether this would restore wine accelerated graphics. Also there may be problems from the multiarch of Nvidia. So keep the other programs.

    The similarly problematic state of ia32-libs:

    # apt-get install ia32-libs
    ...
    The following extra packages will be installed:
    freeglut3:i386 gnuplot-qt ia32-libs-i386:i386 libatomic1 libegl1-mesa
    libegl1-mesa-drivers libfltk1.1:i386 libgl1-mesa-dev libgl1-mesa-dri
    libgl1-mesa-dri:i386 libgl1-mesa-glx libgl1-mesa-glx:i386 libglapi-mesa
    libglapi-mesa:i386 libgles2-mesa libglu1-mesa libglu1-mesa:i386
    libglu1-mesa-dev mesa-common-dev
    Suggested packages:
    gnuplot-doc ia32-libs-gtk ia32-libs-gtk-i386:i386 libglide3 libglide3:i386
    The following packages will be REMOVED:
    blender enblend gimp-plugin-registry gnuplot-x11 hugin hugin-tools
    libglew-dev libglew1.7 mesa-utils meshlab openimageio-tools openshot
    The following NEW packages will be installed:
    freeglut3:i386 gnuplot-qt ia32-libs ia32-libs-i386:i386 libatomic1
    libfltk1.1:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386
    libglu1-mesa:i386
    The following packages will be upgraded:
    libegl1-mesa libegl1-mesa-drivers libgl1-mesa-dev libgl1-mesa-dri
    libgl1-mesa-glx libglapi-mesa libgles2-mesa libglu1-mesa libglu1-mesa-dev
    mesa-common-dev
    10 upgraded, 10 newly installed, 12 to remove and 701 not upgraded.
    Need to get 52.0 MB/52.1 MB of archives.
    After this operation, 79.8 MB disk space will be freed.
    Do you want to continue [Y/n]?

    Such is the confusing state of multiarch in Debian.

    ReplyDelete
    Replies
    1. Thanks Owen. I'll have a look at this later.

      I've got 32 bit libGLU.so.1 and libGL.so.1, but apt-file won't tell me where they come from. I've also never tried anything like blender in wine, so I don't know if they are recognized.

      /usr/lib/i386-linux-gnu/libGLU.so.1
      /usr/lib/mesa-diverted/i386-linux-gnu/libGL.so.1

      I've used the libGL.so.1 with a 32 bit version of bioblender (for linux) -- had to put an extra symlink in.

      Anyway, will look at this later.

      Delete
    2. Fixed. Long story (might make a brief post later) short:
      sudo apt-get install libgl1-nvidia-glx:i386

      Blender runs under wine now (64 bit linux, 32 bit wine).

      Delete
    3. http://verahill.blogspot.com.au/2013/05/429-briefly-wine-libglliubglu-blender.html

      Delete
  6. To compile wine multimedia by this method:

    $ git clone http://repo.or.cz/w/wine/multimedia.git

    To save bandwidth on a connection that is sometimes slow:

    "This project is a fork of the wine.git project. If you have that one already cloned locally, you can use
    git clone --reference /path/to/your/wine.git/incarnation mirror_URL"

    Put the cloned folder multimedia into /home/user/tmp/architectures/wine32/home/sandbox/tmp in the chroot using sudo nautilus and enter the chroot using the directions above.

    $ sudo apt-get build-dep wine

    $ sudo apt-get pulseaudio libpulse-dev

    (for high quality pulse resampling - not sure which of these libraries are necessary)

    Enter the multimedia folder and

    ./configure
    make -j4
    checkinstall --install=no

    Must prefix wine and put actual version number or else Synaptic probably won't know.

    ReplyDelete
  7. My doubt is what are the differences between Wine 1.5.5 created by dev.carbon (http://dev.carbon-project.org/debian/wine-unstable/) and Wine 1.5.30 compiled using this method? Why dev.carbon has so many packages? They will work in the same way?

    ReplyDelete
    Replies
    1. They will work in the same way. The carbon dev packages are built the 'proper' debian way, whereas checkinstall (which is used here) is a solution which works for people like I who don't actually know how to make proper debian packages.

      Delete