08 January 2013

308. Compiling Wine 1.5.21 with multiarch on Debian Testing -- clean multiarch build

UPDATE 16 May 2013: See here for Wine 1.5.30: http://verahill.blogspot.com.au/2013/05/416-wine-1530-in-chroot.html

Another update (28/1/2013): It seems like your mileage in terms of how well Wine will work for you will vary using this method. It works fine for me and I suspect it's because I've built earlier Wine versions of my systems and have ia32-libs-dev installed. This package is no longer available in Testing. ia32-libs installs the libs you need, but does not provide symlinks between .so and .so.X files -- you can probably do that by hand if necessary though. It's not for beginners.

An additional thing to remember is that the 1.5 series of Wine is a development series -- 1.4 is the stable series which is meant for end users. Progress made in 1.5 will be included in 1.6.


Update2 (26 Jan 2013): there are a couple of issues, and they will depend on how your system is set up.
* libosmesa6-dev:i386 will require mesa-common-dev:i386 which will remove libosmesa6-dev:amd64 and more, which is bad.
* libglu1-mesa-dev:i386 depends on libgl1-mesa-dev:i386 which will remove libgl1-mesa-dev:amd64 and more, which is bad.
*  libgstreamer-plugins-base0.10-dev:i386 depends on libgstreamer0.10-dev:i386 which depends on gir1.2-gstreamer-0.10:i386 which depends on gir1.2-freedesktop:i386 which depends on gir1.2-glib-2.0:i386 which depends on libgirepository-1.0-1:i386 which will remove a whole lot of packages (132 on one of my systems, including gnome, gdm3 etc.)

I'm working on figuring out what's triggering this on some systems but not others. Be aware that that doesn't necessarily mean that I will be successful in doing so -- any help is appreciated.

In the mean time see http://verahill.blogspot.com.au/2013/01/308-compiling-wine-1521-on-debian.html to see how to build wine in a chroot, which is safe. You can then install that .deb package on your normal system and HOPEFULLY there won't be any broken dependencies. You won't need the -dev:i386 packages on the install target.


ldd `which wine` 
linux-gate.so.1 => (0x55573000) libwine.so.1 => /usr/local/lib/libwine.so.1 (0x55576000) libpthread.so.0 => /lib32/libpthread.so.0 (0x556ec000) libc.so.6 => /lib32/libc.so.6 (0x55705000) libdl.so.2 => /lib32/libdl.so.2 (0x55867000)
so you really don't seem to need much in the way of shared libs installed.



Old Update: This build is safe now, and there are no remaining errors (i.e. opencl has been taken care of) (see update2 above for more recent information)


I've been building wine (e.g. http://verahill.blogspot.com.au/2012/12/building-wine-1519-on-debian.html) on a system that was set up a few years ago.

Ergo, since ia32libs are on their way out and being replaced by multiarch libs it's time to have a look at what a build from scratch looks like, and what dependencies are needed.

This time we'll build wine the old-fashioned way using configure/make/make install. The biggest challenge was to overcome the annoying
configure: error: Cannot build a 32-bit program, you need to install 32-bit development libraries.
error. The solution to that was simply to install gcc-multilib. 

To work everything out from scratch I've set up a an amd64 chroot of a clean debian testing/wheezy. , It's increasingly appearing as if this is the easiest and safest thing to do.  Hopefully the release of Jessie will get the develop/improvement of multiarch back on the road.

To follow what's new in wine, look here: http://linux.softpedia.com/progChangelog/Wine-Changelog-148.html

...and the obligatory screenshot


The chroot environment
Basically as I've shown before:

sudo apt-get install debootstrap coreutils
mkdir -p $HOME/tmp/architectures/wine
cd $HOME/tmp/architectures
sudo debootstrap --arch amd64 testing $HOME/tmp/architectures/wine/ http://ftp.au.debian.org/debian/
sudo chroot wine/
apt-get install locales sudo vim
echo 'export LC_ALL="C"'>>/etc/bash.bashrc
echo 'export LANG="C"'>>/etc/bash.bashrc
source /etc/bash.bashrc
adduser winebuild
usermod -g sudo winebuild
echo 'Defaults !tty_tickets' >> /etc/sudoers

Edit /etc/hosts and add your hostname (here beryllium) to the end of the line e.g.
127.0.0.1 localhost beryllium

Exit, and the log in again
exit
sudo chroot wine

Then change user:
su winebuild
cd ~

Change at the very least the country code for the repo above (n red) so that you're using the closest/fastest one.

Compiling Wine
Set up multiarch (we're using amd64 but also want to support i386). I'm setting this up from scratch.

sudo dpkg --add-architecture i386
sudo apt-get update

Get the wine dependencies:

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 libcurl4-openssl-dev:i386

sudo apt-get install gettext prelink bzip2 bison flex oss4-dev checkinstall ocl-icd-libopencl1:i386 opencl-headers

sudo apt-get install gcc-multilib

mkdir ~/tmp/
wget http://mirrors.ibiblio.org/wine/source/1.5/wine-1.5.21.tar.bz2 -O wine-unstable_1.5.21.orig.tar.bz2
tar xvf wine-unstable_1.5.21.orig.tar.bz2
cd wine-1.5.21/
./configure
config.status: executing include/wine commands config.status: executing Makefile commands configure: Finished. Do 'make' to compile Wine.
time make -j4

where -j4 is the number threads to launch, normally number of cores+1 (see here). Took around 15 minutes on a 3 core AMD.

Next
sudo checkinstall

to build a .deb package and install it (preferred solution) or
sudo make install

to just install.
Done!


Note that while this build works without issue, the transition to multiarch in debian is not complete and you will likely encounter this problem:
p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: cannot open shared object file: No such file or directory
If you try to fix it you get
sudo apt-get install gnome-keyring:i386 libcap-ng0:i386 libgck-1-0:i386 libgcr-3-1:i386 gcr:i386 libcap2-bin:i386
The following packages have unmet dependencies: libgcr-3-1:i386 : Depends: libgcr-3-common:i386 but it is not installable
This is known. The question is what the consequences of this are -- in this thread it's been suggested that it prevents any program needing to use SSL under wine from working. More at wine HQ here and here. More at Debian here. If I'm reading this right -- and I might not be -- we'll at the least have to wait for gnome-keyring 3.6 to make it out of experimental to sid, then from sid to testing (which is frozen).

 For no particular reason I think this may be what's causing issues with the installation of Office 2003 (and a few other programs, including Agilent HP Chemstation).

Links to this page:
http://linux.org.ru/forum/desktop/8571617/page1?lastmod=1358076186524

16 comments:

  1. Hi!

    Regarding OpenCL, you could try

    1) download http://ftp.de.debian.org/debian/pool/main/o/ocl-icd/ocl-icd-libopencl1_1.3-3_i386.deb.

    2) then install it, forcing overwrite of Changelog.Debian.gz. I hope it shouldn't heart.

    # dpkg -i --force-overwrite /home/andrey/Downloads/wine/ocl-icd-libopencl1_1.3-3_i386.deb
    (Reading database ... 470595 files and directories currently installed.)
    Unpacking ocl-icd-libopencl1:i386 (from .../ocl-icd-libopencl1_1.3-3_i386.deb) ...
    dpkg: warning: overriding problem because --force enabled:
    trying to overwrite shared '/usr/share/doc/ocl-icd-libopencl1/changelog.Debian.gz', which is different from other instances of package ocl-icd-libopencl1:i386
    dpkg: warning: overriding problem because --force enabled:
    trying to overwrite shared '/usr/share/doc/ocl-icd-libopencl1/copyright', which is different from other instances of package ocl-icd-libopencl1:i386
    dpkg: dependency problems prevent configuration of ocl-icd-libopencl1:i386:
    ocl-icd-libopencl1:i386 depends on libc6 (>= 2.3.4).

    dpkg: error processing ocl-icd-libopencl1:i386 (--install):
    dependency problems - leaving unconfigured
    Errors were encountered while processing:
    ocl-icd-libopencl1:i386

    3) now, run aptitude to resolve dependencies:

    # aptitude

    Or just
    # apt-get install ocl-icd-libopencl1:i386
    if apt-get would ask about overwriting.

    Regards,
    Andrey

    ReplyDelete
    Replies
    1. Hi Andrey,
      thanks for the suggestions!

      I tested it in a chroot here.
      1. ocl-icd-libopencl1:i386 didn't cause any conflicts on my (sparse) system.
      2. you also need opencl-headers (i.e. not multiarch)

      Now there are no more remaining errors for wine. Finally.

      Delete
  2. These instructions are quite helpful, given the inexplicably bad state of Debian's wine packages.

    However, when I tried to install the dependencies you list (not in a chroot), apt-get complains:

    The following packages have unmet dependencies:
    libgstreamer-plugins-base0.10-dev:i386 : Depends: libgstreamer0.10-dev:i386 (>= 0.10.36) but it is not going to be installed
    Depends: gir1.2-gst-plugins-base-0.10:i386 (= 0.10.36-1) but it is not going to be installed

    ...which seems to stem from some conflits between some of my installed (amd64) packages and their i386 variants. I'll try a chroot next, but your note "won't have to/shouldn't use a chroot" is confusing me a little. Is there a disadvantage to using a chroot, like losing 3D acceleration or something?

    ReplyDelete
    Replies
    1. Michael, the chroot comment stems from a few things, chief among which is that it adds another layer of complexity -- you now have to import/export files to the jail, you need to mount /proc, copy resolv.conf, and use xhost to get a decent experience, etc. You can of course build in a chroot and install the deb in the normal environment, but you still need to watch out for dependencies.

      What happens if you add the dependencies to the list of packages to be installed? Does it eventually tell you which package it is conflicting with?

      More unlikely: do you have an /etc/apt/preferences file which is causing issues?

      I had some initial issues with conflicts, but it was down to an incorrectly set up environment. If memory serves me right it was because of binutils-multiarch being installed, but I might be wrong.

      Delete
    2. For libgstreamer-plugins-base0.10-dev:i386, the culprit appears to be pkg-config:i386. I only need pkg-config:amd64 for nvidia-settings, which I could live without.

      For gir1.2-gst-plugins-base-0.10:i386, it looks like libgirepository-1.0-1:i386 is the problem. I can't get rid of libgirepository-1.0-1:amd64 without losing a bunch of stuff.

      I don't have an /etc/apt/preferences file, nor do I have any packages with 'multiarch' in the name except for multiarch-support (which I can't remove without losing pretty much every package on my system).

      Delete
    3. For now, try building in a chroot, make the .deb package using checkinstall, and try installing the deb. There's a risk that it might not work properly due to missing dependencies, but it's easy to try.

      I'll see if I can look into it during the next week or so. I (hope) that the issue is just the particular set-up of your build environment.

      The first build of this wine version had similar issues due to conflicting requirements between two sets of packages -- I can't remember exactly how it was set up and blogger doesn't do versioning (which would've been helpful) but it had something to do with how I set up the 32 bit build environment. It'll take a bit of forensics to figure it out.

      Delete
    4. Michael,
      I think building the .deb in chroot will be the way to go, followed by installing it on your regular system. Luckily it seems that most libs are statically linked so the list of dependencies is really small (and probably present). See top of post.

      Let me know what you decide to do and how it goes.

      Delete
    5. So I built a Wine .deb in a chroot as you suggested, and installed it on the host system. Seemed to work, but I have encountered various problems actually running apps in it.

      First Wine complained about missing an OpenGL library, which I fixed easily enough by installing libgl1-nvidia-glx:i386. But then it complained about missing libgstapp, which I tried to fix by installing libgstreamer-plugins-base0.10:i386. Even though this did eliminate the error message, I still get no sound.

      Most importantly, the game I'm trying to run (which has run in Wine before) gets stuck loading the first level, with this console output:

      fixme:win:EnumDisplayDevicesW ((null),0,0x33f838,0x00000000), stub!
      fixme:d3d:wined3d_get_adapter_raster_status wined3d 0x128030, adapter_idx 0, raster_status 0x33fc70 semi-stub!
      fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
      fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting

      ...with the last two lines repeated multiple times. I'm still trying to figure out what's causing this. Thanks for your help so far, by the way.

      Delete
    6. Michael,
      the fixme messages are about functionality that is missing in Wine (http://wiki.winehq.org/FAQ#head-51e2c09a43f0ac997f818617bec098e97170c503) -- if you didn't have them before it could indicate a regression.

      Anyway, it's beginning to seem that multiarch wine on Debian Testing just isn't ready for prime time just yet.

      Your next step could be to either use the build rules for 1.5.5 from carbon dev (http://verahill.blogspot.com.au/2012/11/compiling-wine-155-from-source-using.html)
      or simply download the prebuilt binaries directly from here: http://dev.carbon-project.org/debian/wine-unstable/

      What version of Wine did the game work on?

      Delete
    7. (Sorry for the delayed response.) I don't think I'd seen those exact fixmes before, but I'm not sure. Wine spits out a lot of those.

      The 1.5.5 build from dev.carbon-project.org was what I was using before, and the game ran on that-- but very slowly, due to a regression that was fixed in a later version of Wine (which is why I was trying to build my own).

      I may mess around with 1.5.5 some more, but my patience for this kind of tinkering is short these days. I may just have to wait until Debian's Wine packages get updated, after all. Sigh.

      Delete
    8. Michael,
      there's also wine 1.5.19 using the carbon dev rules:
      http://verahill.blogspot.com.au/2012/12/building-wine-1519-on-debian.html

      Anyway, I hear you on being tired of the tinkering -- wheezy is frozen but the multiarch transition in no way seems finished, and it's adding unnecessary complexity.

      Hopefully there'll be some progress once Jessie is out.

      Delete
  3. I compiled 1.5.14, and method chroot worked very well for me, but i needed to change packages in Wheezy:

    sudo apt-get -f install bison bzip2 checkinstall flex gcc-multilib gettext gir1.2-freedesktop:i386 gir1.2-glib-2.0:i386 gir1.2-gst-plugins-base-0.10:i386 gir1.2-gstreamer-0.10:i386 libcapi20-dev:i386 libcups2-dev:i386 libcurl4-openssl-dev:i386 libdbus-1-dev:i386 libfontconfig1-dev:i386 libfreetype6-dev:i386 libgirepository-1.0-1:i386 libglu1-mesa-dev:i386 libgnutls-dev:i386 libgphoto2-2-dev:i386 libgsm1-dev:i386 libgstreamer0.10-dev:i386 libgstreamer-plugins-base0.10-dev:i386 libhal-dev:i386 libjpeg8-dev:i386 liblcms1-dev:i386 libldap2-dev:i386 libmpg123-dev:i386 libncurses5-dev:i386 libopenal-dev:i386 libosmesa6-dev:i386 libpng12-dev:i386 libsane-dev:i386 libtiff4-dev:i386 libv4l-dev:i386 libx11-dev:i386 libxcomposite-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxinerama-dev:i386 libxml2-dev:i386 libxrandr-dev:i386 libxrender-dev:i386 libxslt1-dev:i386 libxxf86vm-dev:i386 ocl-icd-libopencl1:i386 opencl-headers oss4-dev prelink

    The "-f" in apt-get is very usefull.

    But there is a problem: no prompt in winecfg to download mono or gecko, and no shortcut/icons in Menu/Applications/System.

    ReplyDelete
    Replies
    1. Thanks for the feedback!

      As for gecko/mono -- is Wine simply detecting previous versions (if you have a pre-existing ~/.wine folder)? I was thinking that I'd heard something about mono being removed in the latest versions, but that was CrossOver, not wine.

      Delete
    2. Probably yiou are right, i had installed 1.5.5 carbon before install 1.5.24.

      Delete
  4. Sorry, i compiled 1.5.24, not .14!!!

    ReplyDelete
  5. SInce Wine/Multiarch in Wheezy is such as mess I'm not going to publish any new updates on how to build Wine properly until it's fool proof. At the moment trying to build wine using multiarch will end up breaking your (build) system due to conflicts between i386 and amd64 packages.

    Having said that:
    * Wine 1.5.25 claims to have fixed the MS Office Equation editor bug:
    http://bugs.winehq.org/show_bug.cgi?id=32697

    * For those interested in the (slow) progress re multiarch, see e.g. here for freetype:
    https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/990982
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666761

    Hopefully things will pick up a bit once Jessie comes around (anyone using SID? Better there?)

    ReplyDelete