How to Install 32-bit Wine on CentOS 7

Since version 7, RHEL has only x86-64 versions. The same thing happens to CentOS 7. In CentOS 7/EPEL, there is only package for Wine x86-64. However, many Windows .exe files are 32-bit. Even there are 64-bit versions for some software, their installation file is 32-bit. And for some certain software such as Office 2007, 32-bit wine is preferred.

In this post, we will check how to install 32-bit Wine 1.8 on CentOS 7. We will use Wine 1.8.5 as the example.

  • It is confirmed that this method works for Scientific Linux 7.2 too by Steve.
  • It is confirmed that this method works for Wine 2.0 too by Victor Schulz (but you will need to modify the script a little bit).

One single script to build and install Wine

The whole process in this post has already been written as a shell script install-wine-i686-centos7.sh. You may download the script and run it directly as root to install wine.

wine-1-8-32-bit-centos-7

Build and install Wine manually step by step

The following part of this post introduces what each step does.

Erase old wine versions installed

If you ever installed wine packages, erase them first as we will build wine from the source.

yum erase wine wine-*

Install packages needed to build wine

We are going to install the packages needed to build wine. These may not be sufficient depending on your base installation packages. If later steps complain that some packages are missing, you can install them.

yum install samba-winbind-clients -y
yum groupinstall 'Development Tools' -y
yum install libjpeg-turbo-devel libtiff-devel freetype-devel -y
yum install glibc-devel.{i686,x86_64} libgcc.{i686,x86_64} libX11-devel.{i686,x86_64} freetype-devel.{i686,x86_64} gnutls-devel.{i686,x86_64} libxml2-devel.{i686,x86_64} libjpeg-turbo-devel.{i686,x86_64} libpng-devel.{i686,x86_64} libXrender-devel.{i686,x86_64} alsa-lib-devel.{i686,x86_64} -y

Download and unpack the source package

Here, we use a variable $ver to specify the version we want to install. It will be used in later steps too.

ver=1.8.5
cd /usr/src
wget http://dl.winehq.org/wine/source/1.8/wine-${ver}.tar.bz2 -O wine-${ver}.tar.bz2
tar xjf wine-${ver}.tar.bz2

Build wine 32-bit and 64-bit versions

Make directories for building wine 32-bit and 64-bit versions.

cd wine-${ver}/
mkdir -p wine32 wine64

Build the 64-bit version first as 32-bit version building depends on it.

cd wine64
../configure --enable-win64
make -j 4

Build the 32-bit version now.

cd ../wine32
../configure --with-wine64=../wine64
make -j 4

Install wine 32-bit and 64-bit versions

Now, we can install Wine. The trick is to install 32-bit version first and then the 64-bit version.

As we are still in the win32 directory, run

make install

Install the 64-bit version:

cd ../wine64
make install

By now, if everything goes well, you have successfully installed the Wine 32-bit and 64-bit versions. You may double-check it with the file command:

$ file `which wine`
/usr/local/bin/wine: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=a83b9f0916e6c0d5427e2c38a172c93bd8023d98, not stripped
$ file `which wine64`
/usr/local/bin/wine64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=4d8e8468402bc63bd2a72c59c57fcad332235d41, not stripped

Note the “ELF 32-bit” and “ELF 64-bit” in the file type strings.

Now you can run your 32-bit Windows application on CentOS 7. Enjoy :-)

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

19 comments:

  1. i just try the script and got this error:
    ../../../dlls/vbscript/parser.y: conflicts: 7 shift/reduce
    ../../../dlls/winex11.drv/x11drv_main.c: In function ‘process_attach’:
    ../../../dlls/winex11.drv/x11drv_main.c:536:33: error: ‘SONAME_LIBX11’ undeclared (first use in this function)
    void *libx11 = wine_dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL, error, sizeof(error) );
    ^
    ../../../dlls/winex11.drv/x11drv_main.c:536:33: note: each undeclared identifier is reported only once for each function it appears in
    make[1]: *** [x11drv_main.o] Error 1
    make: *** [dlls/winex11.drv] Error 2
    make: *** Waiting for unfinished jobs....
    [root@svr1 ~]# wine
    -bash: /usr/bin/wine: No such file or directory

    what was i am missing?

    1. `SONAME_LIBX11` seems a macro defined by `wine` src. Might be something wrong during the `./configure` step.

      Did you use the script or do the steps manually? If you run the script, you might paste the log (the log file is shown at the very beginning of the STDOUT) to let us take a look.

  2. This worked perfectly for me on Scientific Linux 7.2 except that I needed to install glibc-devel.i686 along with the other development packages. Maybe that reflects a difference between Centos 7 and SL 7. No problems after that.
    Thanks very much!

    1. Great to know that and thanks for the note! CentOS 7 I used seems already have the ‘glibc-devel.i686’ package before I did this. Added into the installation package list.

  3. Eric Zhiqiang Ma, MANY thanks you man,
    So much thanks we done it. I have tried to make it more than few months from time to time and got the same result or just 64bit installed or couple of problems during 32bit building.
    Now the everything and you are the greatest man ever for me.
    Thanks for save much of my private time.
    The everything best to you.

    Sign,
    Fen

  4. Hi,

    make install on 32 bits is ok but when i try the same on 64 bits src, i got the following error :

    gcc -m64 -c -o x11drv_main.o ../../../dlls/winex11.drv/x11drv_main.c -I. -I../../../dlls/winex11.drv \
    -I../../include -I../../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe \
    -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \
    -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith \
    -Wlogical-op -gdwarf-2 -gstrict-dwarf -g -O2
    ../../../dlls/winex11.drv/x11drv_main.c: In function ‘process_attach’:
    ../../../dlls/winex11.drv/x11drv_main.c:536:33: erreur: ‘SONAME_LIBX11’ undeclared (first use in this function)
    void *libx11 = wine_dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL, error, sizeof(error) );
    ^
    ../../../dlls/winex11.drv/x11drv_main.c:536:33: note: each undeclared identifier is reported only once for each function it appears in
    make[1]: *** [x11drv_main.o] Erreur 1
    make[1] : on quitte le répertoire « /usr/src/wine-1.8.5/wine64/dlls/winex11.drv »
    make: *** [dlls/winex11.drv] Erreur 2

    any idea ?
    PS : excuse my english, I ‘m from Paris

  5. I had that same “SONAME_LIBX11 undeclared (first use in this function)” error and found that the problem was I didn’t have the (64bit) libX11-devel.x86_64 installed.
    The i686 version is explicitly installed by the yum command in the script but unless your system has this installed previously none of the yum’s in the script will pull it in.
    So, do “yum install libX11-devel.x86_64” and re-run and that particular problem should go away.

    (the same is true from the xrender, xml, gnutls and png libs too… the 32-bit versions are explicitly yum’ed by the script but your system may not have the 64-bit versions installed)

  6. I had to add the alsa-lib-devel packages (both 32 and 64 bits) before compiling, otherwise wine was compiled without sound support.

    I was also able to compile the 2.0 version of wine with the script, by changing the version variable and the path in the wget line.

    1. Hi Victor, thanks for the tips. I will add alsa-lib-devel as the default packages required.

      And it is great to know it works for 2.0 version too!

  7. Your instructions are really good, simple and to the point
    I just wanted to add for better build support with 99% of the development libraries the following RPMs help in order to install some of these you need epel and nux desktop installed as a repo

    make sure to have epel and nux desktop installed before installing these packages

    extra 64bit-packages
    ——————–

    yum install glibc-devel libstdc++-devel icoutils openal-soft-devel prelink gstreamer-plugins-base-devel gstreamer-devel ImageMagick-devel fontpackages-devel libv4l-devel gsm-devel giflib-devel libXxf86dga-devel mesa-libOSMesa-devel isdn4k-utils-devel libgphoto2-devel fontforge libusb-devel lcms2-devel audiofile-devel

    yum install openldap-devel libxslt-devel libXcursor-devel libXi-devel libXxf86vm-devel libXrandr-devel libXinerama-devel libXcomposite-devel mesa-libGLU-devel ocl-icd opencl-headers libpcap-devel dbus-devel ncurses-devel libsane-hpaio pulseaudio-libs-devel cups-devel libmpg123-devel fontconfig-devel sane-backends-devel.x86_64

    extra 32bit-packages
    ————–

    yum install glibc-devel.i686 dbus-devel.i686 freetype-devel.i686 pulseaudio-libs-devel.i686 libX11-devel.i686 mesa-libGLU-devel.i686 libICE-devel.i686 libXext-devel.i686 libXcursor-devel.i686 libXi-devel.i686 libXxf86vm-devel.i686 libXrender-devel.i686 libXinerama-devel.i686 libXcomposite-devel.i686 libXrandr-devel.i686 mesa-libGL-devel.i686 mesa-libOSMesa-devel.i686 libxml2-devel.i686 libxslt-devel.i686 zlib-devel.i686 gnutls-devel.i686 ncurses-devel.i686 sane-backends-devel.i686 libv4l-devel.i686 libgphoto2-devel.i686 libexif-devel.i686 lcms2-devel.i686 gettext-devel.i686 isdn4k-utils-devel.i686 cups-devel.i686 fontconfig-devel.i686 gsm-devel.i686 libjpeg-turbo-devel.i686 pkgconfig.i686 libtiff-devel.i686 unixODBC.i686 openldap-devel.i686 alsa-lib-devel.i686 audiofile-devel.i686 freeglut-devel.i686 giflib-devel.i686 gstreamer-devel.i686 gstreamer-plugins-base-devel.i686 libXmu-devel.i686 libXxf86dga-devel.i686 libieee1284-devel.i686 libpng-devel.i686 librsvg2-devel.i686 libstdc++-devel.i686 libusb-devel.i686 unixODBC-devel.i686 qt-devel.i686 libpcap-devel.i686

  8. Thanks for this, Eric. And thanks also to the folks who added useful things to this to this in comments. The instructions here allowed me to build Wine64 and Wine32 from scratch using the latest 2.0.1 source from WineHQ. On my wife’s new Centos 7 machine. The one I have built for her in order to wean her away from Windows. I had to get Wine going for a few apps she won’t give up / are used by customers of ours. It took me a couple of goes to get to grips with it. I was missing audio support at first, added in on the third stab at it. But it was an educational experience, and this roadmap made it understandable and easy to do.

  9. Hi Eric, thanks so much for this article, it worked flawlessly (with latest wine 2.11), but now I’m a bit confused about the state of my system now, and the best way to run my 32bit Windows app.

    I realize that I need to create a 32bit wine prefix, but when launching the app, should I use wine64 (and assume it now knows where to find the 32bit libraries), or should I be using the 32bit /usr/local/bin/wine that was also installed?

    Thanks!

    1. Nevermind…just tried to start the app with wine64, and got an informative error message…should have tried that before posting…

Leave a Reply

Your email address will not be published. Required fields are marked *