[pkg-wine-party] Bug#769234: Automatically detect wine32 and wine64.

Jens Reyer jre.winesim at gmail.com
Sat Dec 12 22:05:34 UTC 2015

On 12/11/2015 11:08 PM, Austin English wrote:
> On Fri, Dec 11, 2015 at 3:52 PM, Jens Reyer <jre.winesim at gmail.com> wrote:
>> Hi,
>> please see below for another patch. IMO it is clean, simple and
>> matches the logic of the wine-script perfectly.
>> It tries to detect the correct wine version using the following
>> precedence:
>> 1. WINEARCH - can't be misinterpreted and was also used
>>    previously.
>> 2. WINEPREFIX - if it is set and system.reg exists, we have a
>>    clean indicator if it is a 32-bit or 64-bit installation,
>>    and therefore which wine to use.
>> 3. WINELOADER - if it is set to a known loader, use this for
>>    deciding which wine to use.
>>    The 32-bit loaders seem to work with both wine32 and wine64,
>>    but I see no point in doing this here. Instead it is easier
>>    to choose the correct 32-bit or 64-bit wineprefix later if
>>    wine loader and binary match.
>>    Note that I'm not really familiar with the preloader.
>> 4. Test with "file" if $1 is a 64-bit application. Note that some
>>    64-bit applications have PE32 installers, or install single
>>    PE32 executables. But those also seem to work with wine64 as
>>    long as wine32 is installed. Therefore only testing for PE32+.
> Only speaking as an upstream observer, I haven't followed the issues
> with the debian wine packaging too closely..

Thanks a lot for your constructive and informational feedback Austin. I
appreciate this very much. I'll definitely not insist on using my
patches (this and the WoW64 patch), but I think they help to discuss
this matter.

The current status in Debian is to prefer Wine32, even if Wine64 is
installed. This is a constant source for bugreports of users thinking
that Wine64 doesn't work - generally, and specifically in combination
with binfmt.

However I now see the benefit of defaulting to wine32 (even despite of
my new knowledge that WoW64 already works), given the maybe typical
installation on amd64:
1.) Install wine, pulling in wine64.
2.) Realize that wine32 is missing.
3.) Add the foreign arch and install wine32.
Because of this, and "wine" depending on "wine64|wine32", the default on
Debian (amd64) is to have wine64 installed.

Further we have to avoid breaking existing installations. With current
default 32-bit wineprefixes (although many have wine64 installed), a
simple change to WoW64 (=prefer Wine64 if installed) would cause a lot
of breakage. However if we do it, now (close to a new stable upstream
release, and a year before Debian freeeze) would be the best time.

> That said, I think going out of your way to detect what sort of prefix
> to use is the wrong approach. A properly built wow64 install will
> automatically use the correct wine bitness when launching
> applications. Trying to detect what architecture to use is prone to
> breakage, as you've seen.

I see two reasons for it:

Checking with "file" (but honoring the WINE* variables first) allows to
continue to default to Wine32, while you still can install 64-bit apps
without manual intervention. However at least 64-bit apps with PE32
installers make this as a sole solution "problematic" and obfuscating
problems (-> consider tagging #769234 as "wontfix").

Testing existing wineprefixes allows to change the default to WoW64 (if
wine64 is installed) without breaking old installations

> In general, upstream recommends running 32-bit Wine if 64-bit
> executables are not needed. For users on 64-bit OSes, the
> recommendation is usually to remove Wine64 packages if you don't want
> them.

Oh, I'd been under the impression that WoW64 is the default and
recommended by upstream. Seeing that it may also cause problems, and
reading you, I'm glad that we have 32-bit as default and I think we
should stay with that, even if wine64 is installed.

However we definitely should add something to the README. Given no other
changes in the packaging I'd propose [2].

Maybe we should consider dropping the automatic setting of WINEPREFIX,
because it is not set session-wide. Like the automatic detection, this
is a feature that may obfuscate problems. Yet, how to handle this for
existing installations? Setting the WINEPREFIX made sense for separate
32-/64-bit installation. But now that I know that WoW64 works, I see
less use in it.

Maybe we should offer a separate "wine-wow64" package similar to the
"wine" package (but conflicting with it), that offers a version of the
wine script that prefers win64 and depends on wine32 _and_ wine64.

The "Depends: wine64|wine32" in the wine package might be reversed to

> I don't know what issues these wrapper scripts the package is using
> are supposed to solve, they seem to be causing more issues than they
> solve, AFAICT.

I honestly can't comment on the general usefulness of/requirement for
the wrapper scripts (yet). Maybe I agree with you, maybe there's a hard
reason to use them. For me, I just started to work in the existing system.

> In any case, good luck, thanks for packaging/updating Wine on Debian.

Thanks again, and at the same time honoring Mike's and Stephen's work.


[1]: This might be done more fine-grained, distinguishing between wine32
not being installed, and foreign arch i386 missing.

[2]: Proposal for README and wiki:
-------- snip --------

To run 64-bit Windows applications you have to install both wine32 and
wine64 (or wine32-development and wine64-development). It is not
recommended to only install wine64 (or wine64-development).

This alone will still use 32-bit Wine uniquely. To run 64-bit
applications you have to set "WINEARCH=win64". Then both 32-bit and
64-bit applications will be installed in 64-bit wineprefixes (WoW64).

$ WINEARCH=win64 wine
$ WINEARCH=win64 wine-development

If you generally use Wine32, you have to manually add "WINEARCH=win64"
to Desktop launchers of applications installed that way.

If you want to use Wine64/WoW64 permanently, include the following two
lines in your ~/.bashrc file. Because Wine64 on Debian uses ~/.wine64 as
default wineprefix, you should specify that at the same time:
export WINEARCH=win64
export WINEPREFIX="~/.wine64"

Some 32-bit applications only run with Wine32 (but not with WoW64). If
you generally use Wine64, use "WINEARCH=win32" and a separate wineprefix
for these applications.
-------- snap --------

More information about the pkg-wine-party mailing list