SLiM GUI running natively on Microsoft Windows 10 with WSL

983 views
Skip to first unread message

Bernard Kim

unread,
May 22, 2020, 4:03:58 PM5/22/20
to slim-d...@googlegroups.com
Hi all,

I am working with a student who has a Windows laptop, and therefore was motivated to get SLiM GUI running on her laptop natively (i.e. without the clunkiness of dual-booting or VMs). I am sharing this with the community in the hope that it'll be useful to those of you with Windows systems and to further expand the potential userbase of this awesome program.

Proof:


Here are the steps to getting it running:

1. Set up Windows Subsystem for Linux

https://docs.microsoft.com/en-us/windows/wsl/install-win10


2. Install Ubuntu 20.04 LTS from the Windows Store


3. (Optional) Install Windows Terminal from the Windows Store for a nicer interface


4. Set up VcXsrv (X11 for Windows). Xming+Qt apps have OpenGL issues that I do not know the solution for. See step 7 for additional settings.


5. Install dependencies. Not sure if all these packages are necessary, but this is what I had installed when QtSLiM ran successfully.

$ sudo apt-get update && sudo apt-get install -y cmake gcc g++ qt5-default mesa-utils libgl1-mesa-glx x11-apps unzip wget

6. Download and build QtSLiM according to the directions in the manual

$ wget http://benhaller.com/slim/SLiM.zip
$ unzip SLiM.zip
$ cd SLiM 
$ cd .. 
$ mkdir build 
$ cd build 
$ cmake -D BUILD_QTSLIM=ON ../SLiM 
$ make QtSLiM

7. Before running vcxsrv, fix blurry fonts issue for high-resolution monitors. Right-click on icon, go to “Compatibility” tab and “Change High DPI settings” button. Enable “High DPI scaling behavior and change dialog box to “Application” or “System Enhanced.”


8. Run VcXsrv in “Multiple windows” and “Start no client” mode. Disable OpenGL indirect rendering by adding “-nowgl” (no quotes) into the “Additional parameters for VcXsrv” box.


9. At the Linux terminal, unset LIBGL_ALWAYS_INDIRECT. This must always be done before running QtSLiM, so add to your .bashrc to save some hassle.

$ export LIBGL_ALWAYS_INDIRECT=

  

10. Run QtSLiM


-Bernard

Ben Haller

unread,
May 22, 2020, 4:26:26 PM5/22/20
to slim-discuss
Hi Bernard!  This is amazing!  Thanks for posting this info publicly.  I'll reply to you off-list regarding putting this info into the manual for the next release.  Thanks!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University

Bernard Kim

unread,
May 22, 2020, 4:51:55 PM5/22/20
to Ben Haller, slim-discuss
Sorry everyone, one quick correction. In Step 8, in the same window where you add "-nowgl" to a dialog box, you should also make sure that the "Native opengl" box is ticked. I think it's unticked by default. Here's what that looks like:

image.png

--
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/de0a8857-c4c6-4f71-acda-708795e41107%40googlegroups.com.
Message has been deleted

Chaz Hyseni

unread,
May 24, 2020, 9:46:39 PM5/24/20
to slim-discuss
this is fantastic! 

just wanted to add a few things:

after completing steps 1-5, and then attempting to build QtSLiM, an issue might come up, which should be resolved by running the following line:

$ sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 

additionally, you want to add "export DISPLAY=:0.0" to ~/.bashrc by running:

$ echo "export DISPLAY=:0.0" >> ~/.bashrc


before running:

$ ./QtSLiM 

Ben Haller

unread,
May 26, 2020, 4:01:53 PM5/26/20
to slim-discuss
Hi all.  I've followed up with Bernard and Chaz offline and have written up a more detailed set of install instructions for QtSLiM on Windows WSL.  I've posted a new version of the SLiM manual at http://benhaller.com/slim/SLiM_Manual.pdf, and the new install instructions are in section 2.4.5 of that new draft manual.  I recommend that you follow them instead of this slim-discuss thread, as there are a number of details that have been added/clarified.  (Please note that I haven't rolled a new release of SLiM for this, so the manual installed by the macOS double-click installer is still the original SLiM 3.4 manual.)

It's exciting to be able to add a new platform that QtSLiM can run on; many thanks to Bernard Kim for developing these instructions, and for following up so diligently with me offline!  This is really great!  :->

Cheers,

Nirodha Epasinghe

unread,
Dec 7, 2020, 5:07:39 PM12/7/20
to slim-discuss
Hello Benard,

Thank you very much for sharing this with us. I followed all these steps(according to the SLiM manual) and installed SLiM  GUI on my Windows 10 machine last few months ago. Also, I used it for my simulations, thanks to you. But recently I am getting an error message which I can not figure out. I re-installed all and followed the steps again but still I am getting the same error. This error occurs when I try to run the QtSLiM. If you have time can you please get back to me about this error. Thank you very much for your time.

Regards,
Nirodha.

Error.jpg

Bernard Kim

unread,
Dec 7, 2020, 5:46:33 PM12/7/20
to Nirodha Epasinghe, slim-discuss
Ni Nirodha,

Can you try throwing double quotes around the command instead? I get the same issue at the command prompt when trying to run anything with single quotes; double quotes fix the issue.

-Bernard

--
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.

Anna Hewett

unread,
Feb 10, 2021, 3:31:14 PM2/10/21
to slim-discuss
Hi all, 
Thanks for this (especially to Bernard - really clear instructions!) , its been super useful I'm just running into one problem, but am frustratingly close so i was hoping someone could help with my issue. 
Im running Ubuntu 20.04 on a windows laptop (WSL1). I followed the instructions for installation using ubuntu in section 2.2.1 using wget directly from the webpage and that ran through fine. Ending with:
""[100%] Built target SLiMgui Installation to /usr/bin was successful. Proceeding with desktop integration. Desktop integration was successful. Temporary files will be removed""
After navigating to the bin directory I can access SLiM through the command line, and can see the SLiMgui in the directory. BUT no clickable icon on desktop and when i try to run SLiMgui it it gives me this error message :

"":/usr/bin$ ./SLiMguiqt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
Aborted""

Then I tried using the method Bernard described and in the manual making a build directory using Xlaunch etc. Now I have a build/SLiMgui and a SLiM/QtSLiM directory. From here when i run:

""$bash -c 'export LIBGL_ALWAYS_INDIRECT=; export DISPLAY=:0; ~/build/SLiMgui' 
I get the same/similar message:
qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
bash: line 1:  1564 Aborted                 ~/build/SLiMgui""

Ive tried updating qt5 but it says its at the newest version: $qt5-default is already the newest version (5.12.8+dfsg-0ubuntu1).
Ive tried specifying the display. 
Ive also googled to my hearts content but am just not computer savvy enough to really understand the issue or answers. 
Any help on this would be greatly appreciated!
Many thanks!
Anna 

bcar...@mtroyal.ca

unread,
Feb 11, 2021, 3:32:06 AM2/11/21
to slim-discuss
Hello Anna,

The intended use of that script is to ease installation for Debian and Ubuntu desktop users; it hasn't been tested on Windows with the WSL installation procedure (except that is no longer true, as you've just tested it; it is working as expected, actually).

"Desktop integration was successful" refers only to the installation of files required for desktop integration on Linux desktop environments; it is not referring to the Windows desktop, where you might see an application shortcut for Microsoft Office, or Microsoft Edge.

Regards, and good luck with the WSL.

-Bryce Carson

Bernard Kim

unread,
Feb 12, 2021, 12:36:28 AM2/12/21
to bcar...@mtroyal.ca, slim-discuss
Hi Anna,

Not sure what is going on. It could be that some of the VcXsrv settings are wrong. I don't think it's a network issue, if I remember correctly the WSL1 VM shares the IP of your computer so localhost in Linux maps back to the Windows localhost. 

Is it possible for you to upgrade to WSL2? I haven't been using WSL1 for a while, particularly because of the abysmally slow read/write performance. So I don't have recent (in the last 6 months) experience with WSL1. It is a tiny bit more of a hassle to run it because the WSL2 network isn't shared with Windows, but I can confirm that I have QtSLiM running using the instructions in the manual.

Can you try just running QtSLiM at the command line, without the fancy batch script method? That is, go to the directory the QtSLiM binary is in, and execute these lines:
# if WSL2
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
# if WSL1
export DISPLAY=:0

export LIBGL_ALWAYS_INDIRECT=
Then run QtSLiM through a shell command?

-Bernard


Anna Hewett

unread,
Feb 12, 2021, 10:32:58 AM2/12/21
to slim-discuss
Hi Bernard, 

Thank you so much for the quick reply! Ive updated to WSL2 and as far as im aware ive set up Xlaunch as specified in the manual (and changed for WSL2 set up). Also when you say 'run QtSLiM through a shell command' do you mean using powershell or ubuntu? (so far ive been using ubuntu to run ./SLiMgui or ./QtSLiM).
But a couple of other things im running in to:

- Following your thread above, the command "make QtSLiM" comes back with the error: "no rule to make target QtSLiM" but when i follow the manual and just do "make" it works giving me a build directory with SLiMgui and SLiM etc in it. 
- When I then try to run "./SLiMgui" from the build directory i get the same error message as I described above 
- I also have an additional directory as well as build, called SLiM. When i nav through this to SLiM/QtSLiM there is a whole load of files called things like QtSLiM.pro etc but no QtSLiM ... so obviously when I run "./QtSLiM" from here I get the error "no file or directory".  

I'm getting a bit confused between the manual and this thread in that the manual is running SLiMgui and you're running QtSLiM, which is it that i need to try and get to work haha?

Again, thank you so much for all the quick responses and I'm sorry if I'm asking very basic questions or not explaining things clearly but it feels like im very close just not quite there!
-Anna 

Ben Haller

unread,
Feb 12, 2021, 10:57:08 AM2/12/21
to slim-discuss
Hi Anna and Bernard,

Anna, I think you are working from an old version of the SLiM manual, from SLiM 3.4.  In that release, the new cross-platform SLiMgui app was pre-release software and was temporarily called "QtSLiM".  In 3.5 it usurped the throne, assumed the name "SLiMgui", and the old macOS-only SLiMgui app was put out to pasture.  So the instructions you're seeing regarding "make QtSLiM", running "./QtSLiM", etc., are from the SLiM 3.4 manual and are obsolete.  Working from the latest manual might fix other problems you are experiencing, too, as Bernard's instructions for running under the WSL were refined and improved from version 3.4 to 3.5.  You can download the current manual from the SLiM home page.

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University

Anna Hewett

unread,
Feb 12, 2021, 11:40:14 AM2/12/21
to Ben Haller, slim-discuss
Hi Ben, 

Ah that makes sense why they are being called different things in the thread vs the manual!
 I'm using the 3.5 manual and so I have also done "cmake -D BUILD_SLIMGUI=ON ../SLiM"  "make SLiMgui" which runs successfully.
But when i then try to run ./SLiMgui following the manual guidelines i.e. after the export steps i get the same error as before:
"qt.qpa.xcb: could not connect to display 8.8.8.8:0

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
Aborted"

Thanks!
-Anna

You received this message because you are subscribed to a topic in the Google Groups "slim-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/slim-discuss/TPtWvhRoZaA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to slim-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/a0f9e662-85d1-4efb-a7f5-e5ff7bb97e21n%40googlegroups.com.

Bernard Kim

unread,
Feb 12, 2021, 3:52:35 PM2/12/21
to Anna Hewett, Ben Haller, slim-discuss
Hi Ana and Ben,

I was indeed working out of an older version of the manual. I've updated to the newest version of SLiMgui and it's working fine, but I think I know what the problem is.

I don't have a great understanding of networking and how WSL2 works, so this will be a superficial explanation at best.

I think something was modified in your Linux build such that the DNS nameserver (found in /etc/resolv.conf) is set to Google's server address (8.8.8.8) rather than the one automatically generated by whatever Windows does when setting up WSL. I'm not sure why this happened for you. In essence, SLiMgui is trying to connect to a non-existent (or inaccessible) display address.

One way to fix this might be to manually look up WSL's IP address and set your DISPLAY variable to it. If you open up Windows Powershell and type:
ipconfig /all

You'll get a bunch of output with networking info and settings. Look for the section "Ethernet adapter vEthernet (WSL)" and find the "IPv4 Address" in that section.

Now in the Linux command prompt, type:
export DISPLAY=XXX.XX.XX.X:0

where XXX.XX.XX.X is the IPv4 address you got from the previous step. That line can be copied into your bashrc in lieu of
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0

Hopefully now SLiMgui should work...?

-Bernard

Anna Hewett

unread,
Feb 15, 2021, 12:41:01 PM2/15/21
to Bernard Kim, Ben Haller, slim-discuss
Hiya, 

Thanks for all the help, I have it working now!! From your solution above I actually figured out I had essentially been shooting myself in the foot using a bit of code I had to run to access the files from the webpage. I was running: echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null .....  which i found on stackoverflow as for some reason i couldnt download any packages or access the webpage to get SLiM downloaded, which helped for that step but then obviously messed up the display connection somehow! I had also missed the step in disabling the firewall in powershell when i upgraded to WSL2 (I'm assuming that this will not be permanent?)
Thanks again all, 
Anna 

bcar...@mtroyal.ca

unread,
Feb 15, 2021, 5:05:26 PM2/15/21
to slim-discuss
Hi Anna,

That's great! Have fun slim-ulating!

Regards,

Bryce.

Bernard Kim

unread,
Feb 16, 2021, 1:28:06 AM2/16/21
to bcar...@mtroyal.ca, slim-discuss
Wonderful! Glad it's working.

By the way, I'm not sure the WSL2 firewall step needs to be taken every time you restart anymore. I've been through multiple restarts and regularly use GUI applications like Rstudio off of Linux, and I can't remember the last time changed that setting.

Not 100% sure as I haven't really been paying attention...

-Bernard

John Benning

unread,
Feb 16, 2021, 3:07:12 PM2/16/21
to slim-discuss
Sorry to butt in...but just wanted to report that there's been another test of using the installer with Windows/WSL2, in case this helps anyone else. 

I was upgrading to SLiM 3.5 (wanting to use those sweet new popgen functions) and running into issues ('make' was getting upset about some usage of "override" in the code) using the non-installer option (i.e., Step 6 in Sec 2.4.5). So I tried the installer (Sec. 2.2.1). On the first try I had an error at the desktop integration step, where it couldn't find 'xdg-mime'. So I installed 'xdg-utils' and ran the installer again, and it worked! 

The only changes I had to make afterward were changing my SLiMgui launch code ('export LIBGL_ALWAYS_INDIRECT=; export DISPLAY=:0; ~/build/QtSLiM') to 'export LIBGL_ALWAYS_INDIRECT=; export DISPLAY=:0; /usr/bin/SLiMgui', as the installer builds SLiM in '/usr/bin' instead of '~/build' as I had done it the first time around.

Thanks so much to everyone for all of their hard work on both SLiM and the Windows option.

John

bcar...@mtroyal.ca

unread,
Feb 16, 2021, 4:16:00 PM2/16/21
to slim-discuss
Hi John,

Glad the Debian & Ubuntu build script was helpful. I'm going to guess that there are some differences between a regular Ubuntu installation (as you would have from ubuntu.com, running on bare metal or in a virtual machine) and the WSL version of Ubuntu from the Microsoft App Store. If one of the differences is that there is no desktop environment installed in the "prefix" (where Ubuntu lives) it would make sense that xdg-utils is not present, as that is only relevant to the various desktop environments you could run on Linux.

Regards,

Bryce.

Bernard Kim

unread,
May 5, 2021, 5:07:20 PM5/5/21
to bcar...@mtroyal.ca, slim-discuss
Hi all,

A preview of GPU-accelerated (!) graphical support for WSL2 came out April 21 and I finally had some time to play with it. It looks promising. 

Warning: to use it you have to update your Windows to the latest version on the developer channel; this change can introduce instability to your system and is irreversible unless you do a fresh installation of Windows.

That said, installation instructions are here: https://github.com/microsoft/wslg

Once WSLg is set up, any Linux GUI programs you install (at least to /usr/bin - haven't tested with other PATH directories) automatically becomes available in your Windows start menu.

image.png

To run the program, you simply click on the icon there. No fuss with setting up a Windows X server.

image.png

-Bernard






--
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.

bcar...@mtroyal.ca

unread,
Jun 14, 2021, 7:55:24 PM6/14/21
to slim-discuss
Ah, a fellow Emacs user! :) That's really cool that Microsoft is making it easier to use more and more software from the Linux ecosystem on Windows 10. Hopefully that simplifies things for the Windows 10 userbase in the future.
Reply all
Reply to author
Forward
0 new messages