ISE in WSL
Home Up Elbert V2 Mach XO ISE in WSL ISE Webpack Textbooks Exercises

 

ISE Webpack and Windows Subsystem for Linux

This is an attractive alternative to the virtual machine download supplied by Xilinx.

wsl is an addition to Windows 10, and it is yet another way of adding a Linux virtual machine with some integration with the windows desktop such that the application appears to be running in Windows, it isn't in a VM window.

I've gone for a fairly "vanilla" wsl setup, letting it pick the default Ubuntu package.

I've uninstalled Acrylic DNS, which I had previously set up as an experiment in split DNS. WSL or Ubuntu appear to require port 53 to be available, and throw a mysterious error "WslRegisterDistribution failed with error: 0xffffffff" when it wasn't. Searching the web revealed other potential causes.

The remaining issues were:

Obtaining the package

This was found at https://www.xilinx.com/downloadNav/vivado-design-tools/archive-ise.html

I opted for the "Full Installer for Linux" and left the computer running for a while while it got on with downloading.

Setting up WSL

My first surprise was that running "wsl --install" left me with a command line install.

I was advised to run "sudo apt update" and "sudo apt full-upgrade" to bring the install up to date.

It was also suggested to install a package x11-apps for a GUI and later I found I needed other packages including GCC. Here's the list:

  • sudo apt install x11-apps
  • sudo apt install libncurses5
  • sudo apt install libxi6
  • sudo apt install libxrandr2
  • sudo apt install gcc

Then I was confronted by the problem of how to unpack the download.

Unpacking the package

I made a "ise" folder to unpack into, though this proved unnecessary as the archive unpacked into a folder anyway.

then I ran "tar -xf /mnt/c/users/<username>/Downloads/Xilinx_ISE_DS_Lin_14.7_1015_1.tar"

Using "/mnt/c" gives me the Windows filesystem.

"tar" runs silently and took a couple of minutes.

The installer is called xsystem. Two catches here:

  • By default Linux won't look for executable files in the working directory
  • It needs to run as root

so the actual command is "sudo ./xsetup"

Satisfying the dependencies so the installer would run

I also found I needed some packages before it could run: libncurses5, libxi6 and libxrandr2

Eventually I was presented with the installer's window and the installation proceeded.

Launching the ISE

There was one final step: ". /opt/Xilinx/14.7/ISE_DS/settings64.sh". This script seems to be needed at the start of every session in order to make the "ise" findable.

A single dot as a shell command means execute the shell script in the same shell instead of forking another process. This is needed as the script sets environment variables and without the dot the changes would be lost when the script finished. This is the reverse of how Windows batch files work, by default batch files execute in the same process and an extra command is needed to fork.

The single dot is not to be confused with the dot-slash that means look in the current directory, not the path. Again this differs from Windows, in Windows the shell looks in the current directory first before searching the path. In Linux the shell only searches the path.

At the end of this it appears I can open an Ubuntu shell using WSL, initialise it with 
". /opt/Xilinx/14.7/ISE_DS/settings64.sh" but note there is a space after the dot
then run the ISE project manager by typing "ise". While running it appears to output some responses to the shell, particularly while compiling.

Unfortunately I need to run settings64.sh each time I start wsl, so I probably need a way to auto-run the script

Also if I run: "nohup ise" then the ISE development environment will run in a detached process and the Ubuntu shell window may be closed without prematurely killing the ISE process.

Finding my work folder

Windows drive C is mounted as /mnt/c (Forward slashes as we're not in Windows anymore) so you need a path something like "/mnt/c/users/<username>/Documents/ISE_Projects/elbert/data_selector_verilog" to get to a folder in Windows documents.

Kludging a launch icon version 1

Warning: this breaks things, in particular it broke "apt-get".

The problem is that settings64.sh remaps an important path so that ISE can use its own copy of standard libraries. After you've run settings64.sh you shouldn't use that shell for general system maintenance. A better solution is found in my version 2, which uses a longer command line to force the desired setup.

So I found the Stackexchange page https://superuser.com/questions/1723966/how-to-create-a-shortcut-in-windows-10-to-launch-a-wsl2-gui-app-in-vcxsrv

I'm not exactly sure what I'm doing here but this describes a file "~/.bashrc" which runs whenever a bash shell opens. It has a guard that means it only runs for interactive shells, meaning ones that you control and not scripts.

If I add ". /opt/Xilinx/14.7/ISE_DS/settings64.sh" at the end, carefully, then this pre-sets the required environment, meaning I now just need to run "ise".

A windows command line of:

C:\Windows\System32\wsl.exe -e bash -lic "nohup ise & exit"

will launch bash with the options l,i,c and then fork the ise and close the shell so there isn't a command shell left open.

I didn't type "C:\Windows\System32\" that just gets added automatically.

That command can then be put in a shortcut and it will launch ISE from a command line.

The options used are:

-e    execute something, see "wsl --help"

-l    Its a login shell

-i    Pretend its an "interactive shell" so bashrc gets used

-c    Run a command

A more sophisticated command line might look like:

C:\Windows\System32\wsl.exe -e bash -lic "cd /mnt/c/<path to my working folder> && nohup ise & exit"

Since nohup puts the nohup.out file in the current directory this puts the file in your working folder, making it easy to see what "ISE" dumps to the terminal. Alternatively the output could be redirected to /dev/null since it appears to duplicate information visible in the IDE

Kludging a launch icon version 2

This is my "improved" version that does NOT involve messing around in the shell's configuration, so it doesn't leave you with a "Broken" Ubuntu.

My improved command line goes:

C:\Windows\System32\wsl.exe -e bash -lic ". /opt/Xilinx/14.7/ISE_DS/settings64.sh && cd /mnt/c/<path to my working folder> && nohup ise & sleep 5"

This version will find your working folder using the %username% environment variable:

C:\Windows\System32\wsl.exe -e bash -lic ". /opt/Xilinx/14.7/ISE_DS/settings64.sh && cd /mnt/c/Users/%username%/Documents/ISE_Projects && nohup ise & sleep 5"

This can be put in a Windows shortcut. The resulting shortcut will give you a black window for a few seconds before it disappears and the ISE loading symbol appears shortly followed by the full ISE. The "sleep 5" gives you a chance to see any errors before the command window closes.

As a refinement once it is working you can set the Windows shortcut to "start minimized" which hides the command window. The application itself still opens as a window.

This is rather a clunky command line, it probably does more than some batch files. Roughly speaking "&&" means "and then..." and "&" means "at the same time". On launching WSL it runs bash with a long command line that roughly means first set up the ISE environment and then change to my Windows work folder and then launch the ISE and at the same time exit the shell.

IMPORTANT CLARIFICATION ABOUT DOTS:

The dot by itself at the beginning of the command line tells the current shell to execute the following script. This particular script sets some environment variables then returns control. This is rather like how a DOS batch file is executed. This is not the default behaviour in "bash" though, normally a script would be executed separately in another process and any environment variable changes would be lost when the script terminated. In comparison In DOS you had to tell it to execute a command in a separate shell.

Further to the above if a script is executed using the dot then it does not need to be set as executable and does not need the "pound bang" line to indicate that it is a shell script.

Other odd shell characters

command 1 | command 2

Run command 1 and redirect (pipe) its output to the input of command 2. Note they may run simultaneously

command 1 & 

Run command 1 and return to the shell while command 1 runs in the background

command 1 & command 2

Run command 1 and command 2 simultaneously (I think)

command 1 && command 2

Run command 1 and then if it succeeds run command 2

command 1 || command 2

Run command 1 or if it fails run command 2