[Wine] Should I report my problem in Bugzilla? Outcast problem.

L. Rahyen research at science.su
Tue Nov 6 22:54:25 CST 2007

On Tuesday November 6 2007 17:14, Rémi G. wrote:
> Thank you for your answer ;)
> As you suggest to me, I report the bug in bugzilla here :
> http://bugs.winehq.org/show_bug.cgi?id=10283
> But before doing a regression test, I would like to try an old version
> of Wine to be sure Outcast works with it.
> In order to install Wine 0.9, I try these commands (on ubuntu 7.10) :
> sudo apt-get install git ccache build-dep wine wine-dev
> git clone git://source.winehq.org/git/wine.git wine-git
> cd wine-git
> Then, to tell git I would like to install wine 0.9, I type this :
> git branch oldstuff wine-0.9
> git checkout oldstuff

	This is wrong. You need to execute:

git-reset wine-0.9
git checkout -f

	If necessary use this command to destroy your unintentional changes in 
current source:

git checkout -f

> Then, I try to compile Wine 0.9.2 with the following lines :
> CC="ccache gcc" ./configure && make clean && make
> ...
> [compilation errors]
> ...
> So my questions are :
> What could I do to avoid this?

	Short answer. To compile wine-0.9 execute the following from the root of the 
source directory (I assume that you have .diff files that are attached to 
this message there):

git-reset wine-0.9
git checkout -f
patch -p1 < 0.9-gdi-freetype-old.diff
patch -p1 < 0.9-kernel-time.diff
patch -p1 < 0.9-wrc-parser.diff
./configure && make depend && make

	At least on Debian Etch system I was able to compile wine-0.9 successfully. 
Try this first. Then install your game to clean WINE prefix, cd to its 
directory and run it. For example (I assume that you have your git repository 
with WINE source at /usr/src/wine-git/ ):

export WINEPREFIX=~/.wine-tmp
rm -rf ~/.wine-tmp/
cd /mnt/hdc/
/usr/src/wine-git/wine setup.exe
cd ~/..wine-tmp/drive_c/Games/My_Game/
/usr/src/wine-git/wine game.exe

	If your game works with 0.9 then you can proceed with regression testing.
	Please note that you *may* need to repeat above commands so to start with 
clean WINE prefix directory each time during regression testing; in practice 
everything should work with the same WINE prefix directory in most cases so 
you most likely don't need to reinstall your game from scratch each time.

	Long answer: you may wonder how I did find necessary changes to compile 
wine-0.9 successfully on moder system? Below you can find detailed 
instructions on real world example. I recommend you to read these 
instructions carefully - this will help you to do the regression test between 
modern WINE and wine-0.9 without troubles.

	*	*	*


	Sometimes old programs doesn't compile on new systems. But what if you know 
that old program worked better than new one for particular task? This called 
regression. Fastest way to find the cause of regression is to do regression 
testing. But usual regression testing procedure will fail to work: you cannot 
compile and test old versions!
	Let's examine real-world example. We want to run regression test between 
wine-0.9 and wine-0.9.40. But we cannot compile wine-0.9 on modern system! 
That means we cannot do the regression test? No, we can! But we need to do 
reverse regression test first... What "reverse" does mean? It means that if 
program compiles (in this example WINE) - this is "bad" revision. If it 
doesn't compile - this is "good" revision.

	*	*	*

	0) Lets start. This is preliminary optional step. System used by the author 
of this howto was Debain Etch at the time of writing. We know that 0.9 
doesn't compile on it. Let's try to compile other old revisions - maybe they 
will work? For example:

git-reset wine-0.9.10
git checkout -f

	Then try to compile:

./configure && make depend && make

	Great! Now we know that wine-0.9.10 can be successfully compiled on Debian 
Etch. So we now know that wine-0.9.10 compiles fine on Debian Etch but 0.9 
doesn't. Good starting point. Actually this is optional step - we can use 
0.9-0.9.40 history window as starting point too. But 0.9-0.9.10 is better 
because it allow us to find out the cause faster.

	*	*	*

	1) First, we need to start git-bisect:

git-bisect start

	Then we need to tell GIT that our current revision (0.9.10) is good:

git-bisect bad wine-0.9.10

	This is correct: we are using "git-bisect bad" for good revision because we 
are going to do reverse regression test. And we need to choose bad revision 
that we cannot compile:

git-bisect good wine-0.9

	*	*	*

	2) Now try to compile:

./configure && make depend && make

	If at the end of compilation you see:

Wine build complete.

	Then current revision is good and you need to execute (remember, we are doing 
reverse regression test so "bad" means good revision):

make distclean; git-checkout -f && git-bisect bad

	Clean up commands "make distclean" and "git-checkout -f" are for sanity 
(without them sometimes strange things may happen).
	If you don't see "Wine build complete." then compilation was stopped because 
of errors. In this case you need to execute:

make distclean; git-checkout -f && git-bisect good

	"good" means bad revision.
	Make sure that you are doing reverse regression test against one particular 
error at a time and ignore all other errors when choosing between "good" 
and "bad".
	Advice: when 2-20 revisions left it is easy to find that patch by using qgit 
program and SHA1 id of current revision. This may save you some time 
especially if you have slow computer.

	*	*	*

	3) Go to step 2. Stop when you find lack of what patch is causing 
compile "current" errors and execute:

git-bisect reset

	*	*	*

	When trying to compile 0.9 first compilation error will be:

gcc -m32 -c -I. -I. -I../../include -I../../include  -DINCLUDEDIR="\"/usr/local/include/wine\""  -Wall -pipe -fno-strict-aliasing -gstabs+ -Wdeclaration-after-statement -Wpointer-arith  -O3 -mfpmath=387,sse -ffast-math -mmmx -msse -msse2 -msse3 -m3dnow -maccumulate-outgoing-args -minline-all-stringops -Wdisabled-optimization -Wall  -o 
lex.yy.o lex.yy.c
lex.yy.c:2610: error: expected ';', ',' or ')' before numeric constant
make.bin[2]: *** [lex.yy.o] Error 1
make.bin[2]: *** Waiting for unfinished jobs....

	Make sure to do reverse regression test against this error only and ignore 
all other possible errors (if any).
	If you followed above steps carefully you will find that this error is caused 
by lack of 69dcbaaf93a65820a28fe2485b6d15a90f423899 commit in 0.9. Using qgit 
it is easy to find this patch. Select it in the tree, press Ctrl+P to open 
separate window with patch content. Now press right mouse button and 
choose "Select All". Then press Ctrl+C to copy whole patch. With your 
favorite editor create file "0.9-wrc-parser.diff" and paste the patch into.
	Now go to step 0 and search for a cause of next problem. When you face 
with "expected ';', ',' or ')' before numeric constant" error again at step 2 

patch -p1 < 0.9-wrc-parser.diff
make depend && make

	When you stop at next error or successfully complete compilation - follow 
corresponding instructions in step 2.
	I think you get the idea. Each iteration of reverse regression testing will 
give us yet another patch. At the end we have all patches necessary to 
compile ancient wine-0.9 on modern system.

	*	*	*

	There is some important notes. First, sometimes patches won't apply to old 
revisions. Usually this isn't big trouble. For example, I have incorporated 
following patches to a file "0.9-gdi-freetype.diff": 

	But we cannot apply this fix to 0.9 directly. How to solve this problem? 
Execute this to choose wine-0.9 revision first:

git-reset wine-0.9
git checkout -f

	Then try to apply the patch:

patch -p1 < 0.9-gdi-freetype.diff

	Fortunately, just 1 out of 6 hunks failed to apply. We now have 
freetype.c.rej. Open it. As you can see it is very easy to fix this by 
editing freetype.c accordingly. Save the result 
to "0.9-gdi-freetype-old.diff" by executing:

git-diff > 0.9-gdi-freetype-old.diff

	*	*	*

	There is an alternative to reverse regression test: fix the code yourself. 
This may be even faster if you know exactly what's wrong, how to fix it and 
there is few lines to change. For example, this is exactly how I created 
patch "0.9-kernel-time.diff": by fixing the code manually (I just replaced 
old function TIME_ClockTimeToFileTime with newer version of it taken from 
recent time.c). However, if you don't know exact cause or there to many lines 
to change reverse regression testing is best and fastest option.

	*	*	*

	At the end of the whole process you should have four 
patches: "0.9-kernel-time.diff", "0.9-gdi-freetype.diff", "0.9-gdi-freetype-old.diff" 
and "0.9-wrc-parser.diff".
	As you remember, our original goal was to do regression test between 0.9.40 
and 0.9. So what now? Just proceed with regression test as usual. When you 
get compile error just apply corresponding patch and try to compile again.
	It may be confusing to have multiple versions of patch to fix similar error 
("0.9-gdi-freetype.diff" and "0.9-gdi-freetype-old.diff" in this case). But 
actually it isn't too hard to guess what you need. For example if you about 
0.9.5 revision you need 0.9-gdi-freetype.diff", if you about 0.9 revision you 
need "0.9-gdi-freetype-old.diff". Of course it is possible to apply wrong 
version of patch by mistake. Just execute:

git-checkout -f

	And then apply right patch(es).

	*	*	*

	Using above instructions it is possible to do regression test between recent 
version of WINE and ancient one. Everything should be very straightforward 
even for non-programmer. Just basic knowledge is needed. If you havn't basic 
knowledge just read man pages for commands you don't know.


	This howto isn't stricly step-by-step guide and isn't perfectly written but I 
havn't time for writing better version. However, I think that above howto is 
understandable enough to be useful. If not (or you find any errors/typos) 
then tell me about this.

> Should I remove wine first (binary .deb provided with ubuntu)?

	Simplest way to run WINE during regression testing is to just execute "./wine 
program.exe" from the root of the source directory where you are doing the 
regression test.

	In case if you stuck completely (or havn't enough personal/CPU time), you can 
consider to send your game via postal mail to someone who can try to do the 
regression testing for you. For example, I can try. When I complete 
regression testing I can return the game back to you if you want.
	It is obvious that you really should try to do the regression testing 
yourself first because it is a fastest way to find the cause of the bug. I 
will try to help you remotely if possible, just ask for help in case of any 

	Thank you for using WINE.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0.9-gdi-freetype-old.diff
Type: text/x-diff
Size: 5122 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-users/attachments/20071107/f0dad1e8/attachment-0004.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0.9-kernel-time.diff
Type: text/x-diff
Size: 635 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-users/attachments/20071107/f0dad1e8/attachment-0005.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0.9-gdi-freetype.diff
Type: text/x-diff
Size: 5350 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-users/attachments/20071107/f0dad1e8/attachment-0006.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0.9-wrc-parser.diff
Type: text/x-diff
Size: 6520 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-users/attachments/20071107/f0dad1e8/attachment-0007.diff 

More information about the wine-users mailing list