29 November 2012

287. Compiling Wine 1.5.5 from source using the carbon-dev deb patches

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

UPDATE (10th Jan 2013): See here for Wine 1.5.21 using the multiarch approach: http://verahill.blogspot.com.au/2013/01/308-compiling-wine-1521-on-debian.html
. Use the updated build instead of what follows below.


Here's how to build the wine 1.5.5 packages without any errors.

I'm cheating and using the debian rules from dev.carbon-project.org.-- it's a small file and is a better solution than downloading the deb files from there.

Note that you will probably need more packages than the ones listed here.

1. Download the source and debian build patches

sudo apt-get install bzip2
cd ~/tmp
mkdir wine-1.5.5_carbon/
cd wine-1.5.5_carbon/
wget http://sourceforge.net/projects/wine/files/Source/wine-1.5.5.tar.bz2
mv wine-1.5.5.tar.bz2 wine-unstable_1.5.5.orig.tar.bz2
tar xvf wine-unstable_1.5.5.orig.tar.bz2
cd wine-1.5.5/
wget http://dev.carbon-project.org/debian/wine-unstable/wine-unstable_1.5.5-0.1.debian.tar.bz2
tar xvf wine-unstable_1.5.5-0.1.debian.tar.bz2
rm wine-unstable_1.5.5-0.1.debian.tar.bz2 

2.  Edit control, control.in and rules
Allow any version of gcc (this may obviously backfire if your version is no good)
Edit debian/control and control.in

 27  gcc-4.5-multilib [amd64 kfreebsd-amd64], gcc-4.5 [amd64 kfreebsd-amd64]
 28  g++-4.5 [amd64 kfreebsd-amd64],

so that is says
 27  gcc-multilib [amd64 kfreebsd-amd64], gcc [amd64 kfreebsd-amd64],
 28  g++ [amd64 kfreebsd-amd64],

Edit debian/rules
 53 ifeq ($(DEB_HOST_GNU_CPU),x86_64)
 54 CC=gcc-4.5
 55 CXX=g++-4.5
 56 else
 57 CC=gcc
 58 CXX=g++

to say
 53 ifeq ($(DEB_HOST_GNU_CPU),x86_64)
 54 CC=gcc
 55 CXX=g++
 56 else
 57 CC=gcc
 58 CXX=g++

2. Get dependencies
Note that this list is based on a very old post -- some packages may not be needed.


sudo apt-get install ia32-libs ia32-libs-dev bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev opencl-dev lib32opencl1 oss4-dev gettext lib32v4l-dev lib32ncurses5-dev lib32asound2-dev libtiff4-dev libgphoto2-2-dev
sudo apt-get install libxkbfile-dev libxxf86dga-dev freeglut3-dev unixodbc-dev gcc-multilib dpkg-dev

Note: I used the following list on debian stable/squeeze.
sudo apt-get install ia32-libs ia32-libs-dev bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev oss4-dev gettext lib32v4l-dev lib32ncurses5-dev lib32asound2-dev libtiff4-dev libgphoto2-2-dev libxkbfile-dev libxxf86dga-dev freeglut3-dev unixodbc-dev gcc-multilib dpkg-dev debhelper libxmu-dev dctrl-tools lzma sharutils lib32z1-dev libgstreamer-plugins-base0.10-dev
sudo apt-get install lib32opencl1


Then continue as normal.

If you're on Wheezy/Testing you should be following this post instead anyway.

3. Compile
in wine-1.5.5/:
dpkg-buildpackage -us -uc
If all went well you saw:
dpkg-deb: building package `wine-unstable' in `../wine-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `wine-bin-unstable' in `../wine-bin-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-dbg-unstable' in `../libwine-dbg-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-dev-unstable' in `../libwine-dev-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-unstable' in `../libwine-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-alsa-unstable' in `../libwine-alsa-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-bin-unstable' in `../libwine-bin-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-capi-unstable' in `../libwine-capi-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-cms-unstable' in `../libwine-cms-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-gl-unstable' in `../libwine-gl-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-gphoto2-unstable' in `../libwine-gphoto2-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-ldap-unstable' in `../libwine-ldap-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-openal-unstable' in `../libwine-openal-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-oss-unstable' in `../libwine-oss-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-print-unstable' in `../libwine-print-unstable_1.5.5-0.1_amd64.deb'.
dpkg-deb: building package `libwine-sane-unstable' in `../libwine-sane-unstable_1.5.5-0.1_amd64.deb'.
[..]
dpkg-source: info: using options from wine-1.5.5/debian/source/options: --compression=bzip2 --compression-level=9
dpkg-source: info: unapplying Bug#28201_proposed-fix-modified.patch
dpkg-source: info: unapplying Bug#28898_squashed-proposed-patches.patch
dpkg-source: info: unapplying fix-winegcc-paths.patch
dpkg-source: info: unapplying Bug#29669_proposed-fix.patch
dpkg-source: info: unapplying function_grep.patch
dpkg-source: info: unapplying readd_xpm.patch
dpkg-source: info: unapplying debian-changes-from-1.1.32-1.patch
dpkg-buildpackage: full upload (original source is included)

Your packages will be found in the wine-1.5.5_carbon/ directory.
../libwine-alsa-unstable_1.5.5-0.1_amd64.deb
../libwine-bin-unstable_1.5.5-0.1_amd64.deb
../libwine-capi-unstable_1.5.5-0.1_amd64.deb
../libwine-cms-unstable_1.5.5-0.1_amd64.deb
../libwine-dbg-unstable_1.5.5-0.1_amd64.deb
../libwine-dev-unstable_1.5.5-0.1_amd64.deb
../libwine-gl-unstable_1.5.5-0.1_amd64.deb
../libwine-gphoto2-unstable_1.5.5-0.1_amd64.deb
../libwine-ldap-unstable_1.5.5-0.1_amd64.deb
../libwine-openal-unstable_1.5.5-0.1_amd64.deb
../libwine-oss-unstable_1.5.5-0.1_amd64.deb
../libwine-print-unstable_1.5.5-0.1_amd64.deb
../libwine-sane-unstable_1.5.5-0.1_amd64.deb
../libwine-unstable_1.5.5-0.1_amd64.deb
../wine-bin-unstable_1.5.5-0.1_amd64.deb
../wine-unstable_1.5.5-0.1_amd64.deb

If something went wrong, it's probably because of a missing dependency.

To install just run
sudo dpkg -i *.deb in the wine-1.5.5_carbon/ directory.

20 comments:

  1. will this work on debian squeeze?

    ReplyDelete
    Replies
    1. If the packages are available, then yes, probably. It's easy enough to try.

      Delete
    2. The post has been updated for debian stable/squeeze. It builds fine (tested in a fresh chroot).

      Delete
  2. where are you getting opencl-dev lib32opencl1 because i do not have those packages

    or what version of debian are you running when doing this

    ReplyDelete
  3. what is in your sources.list because i do not have lib32opencl1

    ReplyDelete
    Replies
    1. There's been a bit of turnover in the repos so that some packages that used to be available in Wheezy no longer are. Instead, if you are on testing have a look at e.g. http://verahill.blogspot.com.au/2013/01/323-wine-1522-on-debian-testingwheezy.html for how to build the current version of Wine with the current set of packages in the repos (i.e. using multiarch).

      Delete
    2. Anon -- seems like for STABLE some repos don't have lib32opencl1. ftp.au.debian.org does though. Wheezy should NOT contain it though: http://packages.debian.org/squeeze/lib32opencl1

      Delete
  4. i get these errors when building on squeeze and following the directions exactly (this is during dkpg-buildpackage)

    dpkg-source: error: cannot represent change to wine-1.5.5/wine-unstable_1.5.5-0.1.debian.tar.bz2: binary file contents changed
    dpkg-source: error: add wine-unstable_1.5.5-0.1.debian.tar.bz2 in debian/source/include-binaries if you want to store the modified binary in the debian tarball
    dpkg-source: error: unrepresentable changes to source
    dpkg-buildpackage: error: dpkg-source -b wine-1.5.5 gave error exit status 2


    ReplyDelete
  5. sorry i missed the rm wine-unstable in the 1.5.5 directory lol my bad

    ReplyDelete
  6. ive gotten it to compile on debian squeeze but when i try to run wineconsole cmd i get

    wine cmd.exe /c echo '%ProgramFiles%' returned unexpanded string '%ProgramFiles%' ... can be caused a corrupt wineprefix, an old wine, or by not owning /home/~/.wine

    i definitely own the folder, and ive deleted the .wine folder to have it recreated and the same thing, and this shouldnt be an old version as it is 1.5.5

    any ideas on what i could do to fix this

    ReplyDelete
    Replies
    1. Works fine here:
      wine cmd.exe /c echo '%ProgramFiles%'
      gives
      C:\Program Files

      Is there anything else which doesn't work? i.e. does winecfg work? Does installing windows binaries work?

      Delete
    2. winecfg returns

      err:module:attach_process_dlls "winspool.drv" failed to initialize, aborting
      err:module:LdrInitializeThunk Main exe initialization for L"C:\\windows\\system32\\winecfg.exe" failed, status c0000005

      Delete
    3. Not sure what's wrong but it seems broken.

      Googling suggests
      http://forum.winehq.org/viewtopic.php?t=11102

      Are you on 64 or 32 bit?

      Delete
  7. 64 bit debian squeeze, i must be missing the 32bit libs or something according to that thread

    ReplyDelete
    Replies
    1. Which is odd if the compilation succeeded. I wish I could help you, but all I can suggest is to do a bit more troubleshooting and see if something comes up.

      Start by doing e.g.
      ltrace -o ltrace.log wine cmd.exe
      (traces library calls I think)
      and
      strace -o strace.log wine cmd.exe
      (traces system calls)

      You'll get lots of output, and most of it won't be relevant. See if there's any libs missing or any obvious errors.

      Delete
    2. i couldnt run those commands, but i created a new debian vm to test on and recompiled when running wineconsole i get

      err:rundll32:wWinMain Unable to load L"setupapi"

      that last error was when running winetricks i put that wrong the last time, but still all i find from googleing is that some lib is messed up either video driver or that wine prefix is messed up or that i need to build from original source b/c he build is broken

      but i get no errors when it compiles

      Delete
    3. Could be due to you doing it in a virtual machine. I may have time to test it for myself within a week or so -- are you doing this in virtualbox? Any settings that I should be aware of?

      The first time you got errors, was that in a vm as well, or on a native installation?

      Delete
    4. To run strace and ltrace you will need to install those packages:
      sudo apt-get install strace ltrace

      Delete
    5. I've now compiled and installed it according to the instructions above in a virtualbox debian stable/64 bit environment.

      winecfg and everything else runs without any problems.

      Not sure what's causing the problems in your case.

      Delete
  8. Thanks for a painless solution to something I was expecting to be exquisitely painful!

    ReplyDelete