NI Linux Real-Time Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Installing Wine (run Windows EXEs) on x86_x64 Controllers

What Is Wine?

Wine is a set of software made for Linux which allows running Windows programs from within Linux without the use of emulation, or virtual machines.  With it you can install programs, run command line tools, install and run games, and use other Windows only tools, from inside a Linux environment. 

 

Wine Limitations

Because Wine is aimed at allowing Windows programs to run in Linux, that means that the processors that Wine is compatible with, are the ones Windows is compatible with, which means x86 or x64 processors only.  Those running RT Linux with an ARM based controller cannot currently run Wine.

 

Another caveat is at the moment your Windows binary program needs to be compiled for a 64 bit processor, not 32.  In Windows x64 there is a layer of software called WOW64 which makes running 32 bit programs seamless when in a 64 bit environment.  Unfortunately installing Wine with 32 bit support means lots of extra work in getting those 32 bit components installed, and the opkg package manager at the moment makes it difficult.  Its not that it is impossible, but this document currently only describes how to get Wine64 installed.

 

Installation Easy Method (but may not always work)

So I've gone through and downloaded all the packages needed to make Wine work in my case with a cDAQ-9123 running LabVIEW 2016, with OS version NI Linux Real-Time x64 4.1.15-rt17-4.0.0f0.  But these packages might not work with other controllers or software setups.  I just don't know what packages, and dependencies are on those controllers.  You can attempt to install them but if they don't work for you, you may have to go to the harder method of tracking down and installing each package, but first the easy method:

 

1)   Configure your controller with SSH, have a method of file transfer, and a connection to the internet.

 

2)   Navigate to your /etc/opkg/arch.conf file and add these two lines to it which enable packages to be installed with different architectures:

 

arch i386 27

arch amd64 28

 

3)   Download the packages from here (my Google Drive) and put them in a folder on your controller.  These packages come from the Debian Jessie repository but have been rebuilt with the gzip compression so the current OPKG can install them.

 

4)   Install the packages in this order, with these commands:

 

opkg update

opkg install ./multiarch-support_2.19-18+deb8u4_amd64.deb

opkg install ./libedit2_3.1-20140620-2_amd64.deb

opkg install ./libmpg123-0_1.20.1-2_amd64.deb

opkg install ./liblcms2-2_2.6-3_amd64.deb

opkg install ./libpcre3_8.35-3.3+deb8u4_amd64.deb

opkg install ./liborc-0.4-0_0.4.22-1_amd64.deb

opkg install ./zlib1g_1.2.8.dfsg-2_amd64.deb

opkg install ./libopenal-data_1.15.1-5_all.deb

opkg install ./libopenal1_1.15.1-5_amd64.deb

opkg install ./libglib2.0-0_2.42.1-1+b1_amd64.deb

opkg install ./libgstreamer0.10-0_0.10.36-1.5_amd64.deb

opkg install ./libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb

opkg install ./libwine-gecko-2.21_2.21+dfsg2-1_all.deb

opkg install ./libwine_1.6.2-20_amd64.deb --force-depends

opkg install ./x11-utils_7.7+2_amd64.deb --force-overwrite --force-depends

opkg install ./wine64_1.6.2-20_amd64.deb

opkg install ./wine_1.6.2-20_amd64.deb

 

The Force Depends command above is because libgcc1 version >=4.8 needs to be installed, but it already is, and libxrandr2 version >=1.2.0 needs to be installed but 1.4.2 already is.  The Force Overwrite is because there are files in the /usr/bin/xdpyinfo, and /usr/bin/xfontsel that already exist from the xdpyinfo and xfontsel packages.  I am unsure what effect overwriting these will have but these could be backed up and restored, or reinstalled if there are issues.

 

5)    Wine for 64 bit applications should now be installed.  In a terminal type wine cmd, after a few seconds of configuring the first time you should be in a new mode where you can perform a dir to get a directory listing, which you can't outside of wine.  CTRL+C will return back to the normal terminal.

 

Running Your Own Programs

You can now use a terminal, or the system exec function in LabVIEW to run a Windows 64 bit program by performing the command wine <application> <optional switches>.  If this program has a UI and is being ran from XFCE you should see the UI.  If you have a command line program, and are running it from a terminal with no UI it will work just fine.  If you are running a command line program that calls into some Windows UI API you will get errors about not being able to make the UI.  The temporary solution to this is to run the command DISPLAY=:0 wine <application> <optional switches>.  This only works if the Embedded UI is enabled.  A better solution would be to look into getting Xvfb installed, which can simulate a display, but I couldn't get it installed due to other conflicts in packages with ones provided by NI.

 

A Package Didn't Install Right, or Dependency Issues

As mentioned earlier there could be cases where these packages just won't install right.  And in those cases I'd suggest doing what I did to get this far.  Download the Wine Deb package, and start installing dependencies one after another until everything is installed.  At the moment to do this you'll first need to update your OPKG package manager to have support for xz compression.  As of writing this, this functionality is only available in the daily builds.

 

1)    Install all the packages to be able to build and install OPKG.  To do this run these commands:

 

opkg update

opkg install packagegroup-core-buildessential

opkg install packagegroup-core-buildessential-dev

opkg install libarchive-dev

opkg install libcurl-dev

opkg install gpgme-dev

opkg install intltool-dev

 

2)    Restart the controller

 

3)    Download the master source from here, or download a snapshot I took from my Google Drive.

 

4)    Navigate to where the OPKG source is on the controller and perform the following commands one after another.  Some may take more time than others.

 

./autogen.sh

./configure

make

make install

 

5)    After this if you type opkg --version you should see a snapshot installed, meaning OPKG is updated.

 

6)    Get the Wine package.  My starting point was Wine for Debian using the Jessie distribution which is the newest stable release today.  Download the package, and attempt to install it.  You should see errors telling you what packages you are missing, get these dependencies and try again.  Rinse, Lather, Repeat.

 

7)    If a package won't install because it won't read the header, or has a segmentation fault you may need to unpack, and repack the package.  If this is the case you can use the command ar vx ./<package>.deb to extract the package, then use tar xf data.tar.xz to extract the tar, then use tar -cvzf data.tar.gz ./usr (and other directories that were extracted), then use ar rcv <package>.deb debian-binary control.tar.gz data.tar.gz to create the new package that should now install.

 

Thanks to the NI team who helped me out in a couple of threads.

 

7-Zip Wine2.jpg

Example running the 7-Zip EXE on my embedded controller.

Comments
BradM
Active Participant
Active Participant
on

Thanks for sharing, WINE can be a bit frustrating to get working and you've provided instructions for a great start for others.

gomezramones
Member
Member
on

Can I install Wine on cRIO?

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

I don't have a cRIO to test on but I believe this process can be repeated to install Wine on that hardware as long as it is on the x86/x64 platform.  There is a Wine for ARM processors but I have no experience with it, and again have no hardware to test with.

Contributors