[Nix-dev] wine on x86_64, and x86_64 in general

Eelco Dolstra e.dolstra at tudelft.nl
Fri Feb 27 13:46:39 CET 2009


Hi,

Lluís Batlle wrote:

> I'd like to use wine in an x86_64 machine... I understand it may not
> be possible to do that.

Wine apparently only builds in a 32-bit environment.  Fortunately you can do
32-bit builds on x86_64-linux on the latest Nix (without requiring you to
configure a distributed build from some remote i686-linux machine, which used to
be the case).  This should do the trick:

$ nix-env -i wine --argstr system i686-linux --system-filter \*

> I think "-m32" creates 32bit executables, which should be able to run
> in an x86_64 environment, isn't it?

Yes, but the default GCC in Nixpkgs on x86_64 doesn't have the required
libraries (namely a 32-bit Glibc and 32-bit GCC libraries).  However, it is
possible to do 32-bit builds by using stdenv_32bit, which provides the necessary
libraries.  For instance, Grub (which also requires -m32) is built like this:

  grub = import ../tools/misc/grub {
    inherit fetchurl autoconf automake;
    stdenv = stdenv_32bit;
  };

You could try the same for Wine, e.g.

  wine = import ../misc/emulators/wine {
    ...
    stdenv = stdenv_32bit;
  };

However, this likely won't be enough: all the other dependencies would also have
to be compiled in 32-bit versions.  That can be done in the same way, but it's
just a huge headache.  (I could be wrong though; the Wine document you linked to
seems to suggest that building Wine on x86_64 yields a 64-bit Wine.)  So I'm
more inclined to put something like this in Nixpkgs:

  wine =
    if system == "x86_64-linux" then
      # Can't build this in 64-bit; use a 32-bit build instead.
      (import ./all-packages.nix {system = "i686-linux";}).wine
        # some hackery to make nix-env show this package on x86_64...
        // {system = "x86_64-linux";}
    else
      import ../misc/emulators/wine {
        ... bla bla ...
      };

> Regarding x86_64 in general... aren't other distros making tricks on
> libraries, trying to get 32-bit and 64-bit libraries for all the
> system? I only heard that, and I don't know how 64bits cope with
> 32bits... so I'd like some light on that. I think, for example, that
> people run 'skype' in 64-bit OSs having a bunch of 32bit libraries
> (some X client libraries I guess, as the X protocol may be the same).
> How linux copes with 32-bit executables, I don't know at all.
> If it were the case, shouldn't nix have a good way of dealing with 32
> and 64bit libraries installed at once?

Installing and running 32-bit programs and libraries on x86_64-linux is no
problem at all.  It's just that building them used to be a problem, but no
longer now that Nix on x86_64-linux supports building derivations for i686-linux
directly.  (I implemented this in r13744, BTW, after I discovered that Linux has
a personality() syscall to make it pretend to be a different architecture.)

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/




More information about the nix-dev mailing list