Saturday, 16 July 2011

A Noob's Experience of Getting Portal 2 to Run on Wine

Disclaimer: This is not yet a success story. I'm waiting through another two hour build of Wine having finally eliminated a host of warnings I'd ignored earlier. I just had to get this logged after the day I had.

It's been a long day. Last night I thought it might be worth trying to install Steam on my ubuntu laptop, since it's the only one I've got and I'd bought the Valve pack a few weeks ago and only caught a few hours of L4D2 at my parent's since. I installed Wine and Steam in the usual way, realised the download would take all night and went to sleep.

I'm now nearly 14 hours into a gruelling googling, trying and waiting session of attempting to make that happen today.

There are some very clever people out there on the internet. I'm relatively new to Ubuntu and for the most part, it's great. Generally, programs work like you'd expect and if they don't, they, or google, will helpfully tell you exactly what packages you need to install. The package installer puts Windows to shame and you can often hazard some search terms and the program you want, or one that offers significantly more will present itself.

So I thought I'd log what I went through, in particular to get down some of the steps that weren't obvious  to me.

I knew people had been happily successfully using Steam on linux for years (I didn't realise how long, but some of the forums I visited were from 2005.)  So I blithely started up Steam, double-clicked on Portal 2 and crossed my fingers. Anyone who has tried this knows the Valve man shows up (dowwwwm) and it crashes after the next screen. A quick search told this was fatal and final. That was depressing. Luckily for me I'm not someone who cares about consuming anything on the day of release and the magical fix was just written 4 days ago. In fact my timing could literally not have been better. So I'll skip my wrong turns and present what I think is the correct way to do this.

0. Prestep: Run ubuntu update manager and update everything. I couldn't find a package later on and it came down to a fix in ubuntu from about a month ago. Save yourself the pain.

1. Install Wine source and compile it yourself:
This is necessary cause the Magical Fix(TM) is a patch on the Wine code. The code is available at:
http://sourceforge.net/projects/wine/files/Source/

DON'T take the "latest" link at the top of the page. I did that first and I'm pretty sure it was a binary release. The tar only contained etc/ and bin/ folders. I took wine-1.3.24.tar.bz2 which was the latest for me.

Whether you want to compile now depends on how confident you are about the patch process... I'd recommend patching first because nothing went wrong today I didn't do myself so I'll make the next section:

2. Applying the Magical Fix(TM) patch.
The patch was supplied by my new best friend Grazvydas Ignotas (Aaaaaah - I'm serious, choirs of heavenly angels surround that name) in this historic post at winehq. First, change to the directory you unzipped the source to. To be safe there's no harm in backing up the file that will be changed: 


cp server/ptrace.c server/ptrace.c_bk


You can try applying the patch but it didn't work for me. From the top level directory of the Wine source, run:


patch -p0 < breakpoints.patch --dry-run
patch -p0 < breakpoints.patch


Here it told me both hunks(changes) had failed so I went to apply the changes manually. I'm pretty comfortable with diffs but I  sought out a good guide anyway. I found this one jogged my memory of the bits I'd forgotten in my years of tortoise graphical diffs. You're basically adding a sum total of six lines to the file we backed up earlier.


3. Installing Wine
Instructions for installing are at:
http://www.winehq.org/site/docs/wineusr-guide/installing-wine-source
but I'll repeat them here cause I was stuck on one point for a while.

   1. Uninstall Wine. This is a matter of opening the package manager and searching for Wine. Mark any installed for removal. You don't need complete removal and you might lose data if you do. Removal doesn't delete your ~/.wine directory but I didn't know that and had zipped my steamapps directory out just in case.

   2. Get the build dependencies. This is the bit that cost me perhaps 8-10 hours of my day, because it was one the first steps and I didn't see it through correctly. The instructions on the page said to run configure and fix the errors as they arise. As a programmer, this pretty much describes my life so I thought I was prepared. There are two types of errors and warnings though. There's a whole pile that won't let configure finish successfully. IT'S NOT ENOUGH TO FIX THESE. I carried on happily with the process and kinda regretting that 10 hours later. At the end of the configure output there's a series of warnings which led to my installs being various degrees of failure. So eliminate all but one of these - OpenCL.

Most of the warnings are dev tools so a search in the package installer for <whatever> dev brought them up quickly enough.

DON'T DO THIS NEXT BIT
I'm on integrated graphics so I went as far as to uninstall an NVidia package so I could install AMD OpenCL dev tools. Every search result told me this warning was meaningless since my graphics can't support OpenCL but I wasn't going through another 2 hour build only to wish I'd done it in the first place. This was the most awkward warning to eliminate - and I wish I hadn't. I found a package that eliminated the error here. The problem was I had to uninstall NVidia and that led to 3D support not being compiled... Another few hours wasted...

Carrying on...
3. Compile the patched Wine code:
$ make depend
$ make (This takes about 2 hours on my laptop)
4. Install Wine

$ sudo make install


Installing Steam etc has been covered so I won't go into it. Fingers crossed this time...

No comments:

Post a Comment