-
Notifications
You must be signed in to change notification settings - Fork 20
PureOnWindows
Pure readily compiles from source using the msys2/mingw environment, please check the instructions below. However, the easiest way to get started with Pure on Windows is by using the "one-click" installer.
This package installs the Pure development environment into an existing msys2 installation. It also sets up the environment so that Pure can be run from the Windows command line.
Download the current version (0.68): pure-mingw32.exe
Please note that this is the x86 (32 bit) version, but it should also work fine on all recent 64 bit Windows versions (Windows 10 has been tested). The installer already includes all addon packages which are supported on Windows right now. (Note, however, that the Pd-related packages are distributed separately, see Pd and Friends below.)
First, set up the msys2 environment as discussed under Installing Msys2 below. Then launch the pure-mingw32 installer by double-clicking it. The installer will guide you through the installation and give you the opportunity to change the installation path and choose the package features that you want/need (base, documentation, examples, data, graphics, math, multimedia, etc.).
By default, the installation goes into c:\msys64
(the default installation path for the 64 bit version of msys2), you will have to adjust this if your msys2 installation lives elsewhere (e.g., if you installed the 32 bit msys2 version for some reason).
Before installing Pure, you first need to install msys2 including gcc and various utilities and libraries as detailed below. (The process is rather straightforward, but not fully automatic which is why the one-click installer doesn't include the necessary setup right now.) Note that you really must install msys2 first, because the msys2 installer will refuse to install into an existing non-empty directory.
You can get msys2 from http://www.msys2.org/. Follow the installation instructions there to install msys2. After that, add the following packages inside the msys2 environment using pacman
:
pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-i686-llvm35 mingw-w64-i686-emacs w3m
The following additional libraries are needed to make the base and math modules work:
pacman -S --needed mingw-w64-i686-glpk mingw-w64-i686-gsl mingw-w64-i686-libxml2 mingw-w64-i686-libxslt
The following are needed for GUI development (Tcl/Tk and GTK+/Gnocl, cf. GTK+, Gnocl and VTK below):
pacman -S --needed mingw-w64-i686-gtk2 mingw-w64-i686-glade mingw-w64-i686-libnotify mingw-w64-i686-libgnomecanvas mingw-w64-i686-tcl mingw-w64-i686-tk
Also install these for the multimedia modules (pure-audio, pure-midi):
pacman -S --needed mingw-w64-i686-fftw mingw-w64-i686-libsamplerate mingw-w64-i686-libsndfile mingw-w64-i686-portaudio mingw-w64-i686-portmidi
Feel free to leave away packages not required for your setup. E.g., if you are not interested in graphics and multimedia development, then just the first two pacman
commands above will install everything you need for basic Pure development.
There's also a 64 bit version of the installer (Pure 0.67): pure-mingw64.exe.
CAVEAT: The pure-mingw64 installer is still considered highly experimental at this point, so expect some bugs (specifically in exception handling, due to limitations in the 64 bit version of the mingw compiler). It's also an older version (not updated regularly) and lacks some of the addon modules (specifically, anything related to GTK+ development). We strongly recommend using pure-mingw32 instead if possible.
Also note that for the pure-mingw64 installer you'll have to install the x86_64 packages of the compiler and the libraries (replacing i686
with x86_64
in the package lists above):
pacman -S --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-llvm35 mingw-w64-x86_64-emacs
pacman -S --needed mingw-w64-x86_64-glpk mingw-w64-x86_64-gsl mingw-w64-x86_64-libxml2 mingw-w64-x86_64-libxslt mingw-w64-x86_64-tcl mingw-w64-x86_64-tk
pacman -S --needed mingw-w64-x86_64-fftw mingw-w64-x86_64-libsamplerate mingw-w64-x86_64-libsndfile mingw-w64-x86_64-portaudio mingw-w64-x86_64-portmidi
With some diligence, the 32 and 64 bit versions can be run alongside each other. However, you may have to juggle with the Windows environment variables like Path
and PURELIB
to make that work.
For the time being, there's also still the old one-click installer available which installs into the Program Files directory (this is 32 bit only): pure-0.66.msi. Please note that this distribution is outdated and not supported any longer.
After finishing the installation try running pure
from the command line to invoke the interpreter. At the interpreter's prompt, you can type expressions to be evaluated. For instance:
$ pure
__ \ | | __| _ \ Pure 0.68 (i686-w64-mingw32)
| | | | | __/ Copyright (c) 2008-2018 by Albert Graef
.__/ \__,_|_| \___| (Type 'help' for help, 'help copying'
_| for license information.)
Loaded prelude from C:/msys64/mingw32/lib/pure/prelude.pure.
> map (2^) (1..10);
[2.0,4.0,8.0,16.0,32.0,64.0,128.0,256.0,512.0,1024.0]
To exit the interpreter, type quit
or Ctrl+Z
and Enter at the beginning of the interpreter's command line.
The one-click installer comes with online documentation and examples (unless you deselected the corresponding features during installation). You can find these in your msys2 installation under mingw32/lib/pure/docs/
(documentation in html format) and mingw32/share/doc/pure/
(documentation in pdf format and examples). In addition, the help
command in the Pure interpreter will fire up the online help in a browser. This uses the text-based browser w3m by default, which you should have installed earlier. Note that in Windows, the help
command will pop up w3m in a separate msys2 bash window. Use the q
key to exit from w3m when done reading the online help.
Of course, it's also possible to use your favorite web browser to read the online help instead. Just set the PURE_HELP
environment variable to your preferred browser program. E.g., taking Firefox as an example, you can run this on the Windows command line:
set PATH=%PATH%;"C:\Program Files\Mozilla Firefox"
set PURE_HELP=firefox
After relaunching the Pure interpreter, the help
command will now open help pages in Firefox instead. (If all this seems to be too much hassle, you can also just point your web browser at https://agraef.github.io/pure-docs/ and read the latest documentation on Github instead.)
-
As mentioned above, the online help (
help
command in the interpreter) requires w3m by default, which is available in msys2 (you can install it withpacman -S w3m
), but needs to be run inside msys2 bash to work. This can be achieved by setting thePURE_HELP
environment variable accordingly. The one-click installer sets that variable in Windows, but for msys2 bash this needs to be done manually in your.bashrc
, as follows:export PURE_HELP="c:/msys64/usr/bin/mintty w3m"
Note that this makes w3m pop up in a separate msys2 bash window, but at present this appears to be the only way to make it work on Windows.
-
The pure-gen program won't find dump-ast unless the
DUMP_AST
environment variable is set. Again, the one-click installer does this for Windows, but for msys2 bash this needs to be done manually in your.bashrc
, e.g.:export DUMP_AST=c:/msys64$MINGW_PREFIX/lib/pure-gen/dump-ast
-
PATH
must contain the Pure library directory, so that the dlls of the addon modules are found by (compiled or source) scripts. Again, the one-click installer does this for Windows, but msys2 bash must be handled manually:export PATH=$MINGW_PREFIX/lib/pure:$PATH
-
The mingw readline library apparently does not work in the Windows console, and it also causes various other issues such as input being echoed on the command line. We therefore distribute an interpreter executable which has readline disabled. The Windows command editor will still work, but none of readline's advanced command line editing and completion facilities will be available. An alternative is to just run the Pure interpreter inside Emacs which provides readline-like command editing and completion in pure-eval buffers.
-
Interactive input in the Pure interpreter is not working in msys2 bash; the interpreter just seems to hang, so that you have to bail out with Ctrl+C. This is a well-known bug which also affects other programs, and the best available workaround is to install winpty (readily available as a package in msys2) and invoke pure as
winpty pure
. If you're doing this frequently, you may want to add a corresponding alias to your.bashrc
:alias pure='winpty pure'
-
Msys2 apparently ships a broken freeglut library, which affects the pure-gl GLUT module. Therefore the one-click installer comes with its own freeglut.dll which gets installed into the Pure library directory.
If you can help with any of the above issues or notice any other Windows-specific quirks, please let us know by submitting a bug report.
Due to platform limitations, the Windows version doesn't currently offer as many addon modules as the Linux and Mac versions, but the most important libraries for system, database, graphics, math and multimedia programming are all there. Specifically, the following modules are known to work and are included in the one-click installer:
-
base: pure-doc, pure-ffi, pure-gen, pure-mpfr, pure-readline, pure-sockets, pure-stldict, pure-stllib, pure-xml
-
data: pure-csv, pure-odbc, pure-sql3
-
graphics: pure-gl, pure-gtk, pure-tk
-
math: pure-glpk, pure-gsl, pure-rational, pure-reduce
-
multimedia: pure-audio, pure-faust, pure-midi
In addition, the TeXmacs plugin, the pure-octave module and the pd-pure and pd-faust externals for Pd are available as separate packages, see Pure and TeXmacs, Pure and Octave and Pd and Friends below.
We recommend editing and running Pure scripts using Pure's Emacs mode. This provides you with a comprehensive Pure development environment which supports syntax highlighting, auto indentation and completion, online help, and the ability to invoke the Pure interpreter directly in Emacs.
Following the instructions under One-Click Installer above, you should have already installed emacs and w3m in msys2 (the latter is needed to provide Pure's online help in Emacs, see below). Pure Emacs mode is included in the one-click installer, so you'll be ready to go immediately. (In order to facilitate using Emacs in Windows, you can just locate the runemacs
executable in c:\msys64\mingw32\bin
and create an application launcher for it on the desktop as usual.)
To activate Pure mode in Emacs, you still need to add something like these lines to your .emacs
:
;; Enable w3m and hideshow (this must go before pure-mode to take effect).
(add-to-list 'load-path "/mingw32/share/emacs/site-lisp/w3m/")
(require 'w3m-load)
(require 'hideshow)
;; Enable Pure mode and bind it to the usual file types.
(require 'pure-mode)
(setq auto-mode-alist
(cons '("\\.pure\\(rc\\)?$" . pure-mode) auto-mode-alist))
This enables Pure mode on .pure files in Emacs and also provides the necessary facilities for online help (using w3m) and code folding (collapsing and expanding comments and block structure, using the hideshow package). Note that to use w3m in Emacs, you also need to have the emacs-w3m package installed. Since the latter isn't readily available in msys2, we have included it (as an option) in the one-click installer.
Note that the location of your ~/.emacs
will vary depending on whether you're running Emacs from Windows or inside msys2 bash. In the former case your Emacs tilde directory will be in c:\Users\your-name\AppData\Roaming
(in modern Windows versions at least), in the latter case it's usually c:/msys64/home/your-name
. You can run Emacs in both environments at the same time, but you'll probably want to keep identical copies of .emacs
in both directories.
Pure mode provides a wealth of features and customization options. You can find out about these in Emacs' Pure menu which appears after opening a .pure file. In particular, Describe Pure mode
(C-h m
) shows all the commands that are available, Pure Help
(C-c h
) lets you read the online help, and Customize
lets you tailor the mode to your liking. Pure mode also lets you run entire Pure scripts or individual code snippets from Emacs, using the commands under Pure | Execute
.
Pure can be also run as a plugin in the scientific editor TeXmacs, please check our TeXmacs wiki page for details. The plugin also works on Windows, but isn't included in the one-click installer, so you'll have to install it separately. Here's what you'll need:
-
Install TeXmacs, if you haven't already. (The version that works best for me on Windows is 1.99.4. YMMV, though, so check the link to find a version of the package that suits you.)
-
Install the texmacs-pure package. Make sure that you select the same target directory that you also installed TeXmacs in. Usually this will be something like
c:\Program Files (x86)\TeXmacs
.
Afterwards, launch TeXmacs, run Tools | Update | Plugins
to update the plugin configuration and start kicking the tires. If everything was installed properly then you should be able to find some Pure-related items in TeXmacs' Insert | Session
menu. Create a new document and try the Insert | Session | Pure
command to insert a basic Pure session. The interpreter should start up right inside the TeXmacs document and leave you at its command prompt, where you can start evaluating Pure expressions. More information can be found in TeXmacs' help menu, under Help | Plug-ins | Pure
.
The pure-octave addon allows you to run an embedded version of the Octave interpreter in Pure, please check our Octave wiki page for details. This doesn't work with the official Windows builds of Octave yet, and building Octave in msys2 is no easy undertaking. Therefore we provide a build of pure-octave which is statically linked against Octave 4.0.3 and provides everything that's needed for running Octave code in Pure in a reasonably small and self-contained package (you still have to install some library dependencies, though, see below).
In addition, you'll also need to install the following packages in msys2:
pacman -S --needed mingw-w64-i686-curl mingw-w64-i686-fftw mingw-w64-i686-fontconfig mingw-w64-i686-freetype mingw-w64-i686-glpk mingw-w64-i686-hdf5 mingw-w64-i686-openblas mingw-w64-i686-pcre mingw-w64-i686-readline mingw-w64-i686-portaudio mingw-w64-i686-libsndfile mingw-w64-i686-gcc-libgfortran mingw-w64-i686-zlib
These provide the system libraries (dlls) that the embedded Octave interpreter needs.
Please note that this package is still experimental, so your bug reports are appreciated.
Also note that in order to utilize the plotting functions in gnuplot.pure, you'll need to have gnuplot installed. This is available as a package in msys2, but that version was half-broken when I tried it, so I recommend downloading the latest version from SourceForge instead (5.2.2 at the time of this writing). You'll also have to make sure that the location of the gnuplot binary is in your PATH
so that Octave can find it, or put something like this into your ~/.octaverc
:
gnuplot_binary ("c:/gnuplot/bin/gnuplot.exe")
Pure has very good support for interfacing with Miller Puckette's Pd, a popular graphical multimedia programming environment and free Max/MSP alternative. A brief overview of these facilities can be found on the Pure Data wiki page. The following externals and programs are available as separate MSI packages:
-
The pd-pure package lets you write Pd externals in Pure. Download
-
The pd-faust package provides you with a dynamic Faust module loader for Pd. Download
-
The faust2pd package provides a little helper script which lets you generate Pd GUI patches from Faust programs. This package is largely obsolete as it has been superseded by pd-faust, but it is needed to run the
faust2puredata
script included in the Faust distribution and so we provide this legacy package for those who are still using that. Download
Please note that these are all 32 bit packages, so they also require a 32 bit installation of the Pure interpreter (pure-mingw32 installer). After installation you'll find the pd-pure and pd-faust externals in the extra
subdirectory of the program folder where Pd should be able to find them. Also note that all installers default to the "Purr Data" flavor of Pd nowadays, but you can change the target folder during installation if you'd like to install the externals into the Pd or Pd-extended program folders instead.
Before installing any of these packages, you should already have installed one of the available binary Pd distributions for Windows. Miller Puckette's "vanilla" Pd, Christoph Steiner's Pd-Extended and Jonathan Wilkes' Windows port (nick-named "Purr Data") of Ico Bukvic's Pd-l2ork are all known to work. (As vanilla Pd comes without any 3rd party externals, and Pd-extended hasn't been updated since 2013, we'd recommend Purr Data, which is relatively new, actively maintained, has all the latest bugfixes, and offers pretty much all of Pd-extended's features and much more. A quick introduction to Purr Data can be found here.)
Note that all Pd flavors on Windows are distributed as 32 bit applications at present. Download links for the latest versions and other information can be found under these URLs:
-
Pd-extended: https://sourceforge.net/projects/pure-data/files/pd-extended/
-
Purr Data: https://agraef.github.io/purr-data/
Please note that after installation, pd-pure and, if you installed it, pd-faust still need to be activated by adding them to Pd's startup libraries, as described in the pd-pure and pd-faust documentation. The precise steps are slightly different depending on which Pd version you use, but generally you can just go to the Startup
options in the Preferences
dialog and add pure
and, if you installed it, faust/pdfaust
there, in that order. Another possibility is to add the options -lib pure -lib faust/pdfaust
in the Startup flags
field.
After committing these changes and restarting the Pd application you should see something similar to the following message in the Pd main window, which indicates that pd-pure was loaded and is ready to go:
pd-pure 0.25 (pure-0.67) (c) 2009-2017 Albert Graef <[email protected]>
pd-pure: compiled for pd-0.48 on Feb 17 2018
Likewise, if you installed and activated pd-faust, you'll also see something like this message:
pd-faust 0.16 (c) 2011-2018 Albert Graef <[email protected]>
pd-faust: registered with pd-pure
Opening Pd's help browser from the Help
menu lets you peruse the available examples in the pure
and faust
folders, or you can just open the corresponding folders in Explorer and launch the examples from there.
Note that in order to write your own Faust programs for use with pd-faust, you'll also need Grame's Faust compiler for which we also have a msys2/mingw32 package available; please check the Faust wiki page for details.
The one-click installer includes the necessary addons for Tcl/Tk 8.6 and GTK+ 2 development, including an interface to Peter G. Baum's and William J. Giddings' Tcl-Gnome/GTK+ bridge Gnocl which lets you develop Gnome/GTK+ applications using pure-tk.
Note that you have to leave the graphics feature in the installer enabled to have these available. As noted in One-Click Installer, you'll also need to have the following msys2/mingw32 packages installed:
pacman -S --needed mingw-w64-i686-gtk2 mingw-w64-i686-glade mingw-w64-i686-libnotify mingw-w64-i686-libgnomecanvas mingw-w64-i686-tcl mingw-w64-i686-tk
Check examples/gtk and examples/tk under mingw32/share/doc/pure for some examples -- the latter contains the Gnocl examples, as these are run through the pure-tk module.
In addition, pure-tk also lets you interface to VTK, in order to do advanced 3D graphics and scientific visualizations using VTK's Tcl/Tk bindings. An example can be found in examples/tk/earth.pure.
This requires a VTK version with a proper collection of Tcl modules which can be loaded inside a standard tclsh. The latest such version seems to be VTK 6.3. Since msys2 only ships VTK 8.x at present, we provide a ready-to-use package for VTK 6.3 here: mingw-w64-i686-vtk-6.3.0-1-any.pkg.tar.xz. Install this with pacman as follows:
pacman -U mingw-w64-i686-vtk-6.3.0-1-any.pkg.tar.xz
Afterwards, add the line IgnorePkg = mingw-w64-i686-vtk
to your /etc/pacman.conf, so that pacman doesn't want to upgrade to a newer VTK package (which won't do you much good) when you update your msys2 system.
This package is currently available for mingw32 only, but if you want you can roll your own from the PKGBUILD in this zip archive: mingw-w64-vtk.zip. (This is an older revision of the PKGBUILD from https://github.com/alexpux/mingw-packages, with some modifications to make it compile again. I also removed the Qt dependency which makes the footprint of the installation much smaller.)
NOTE: Before you try any of these examples with the pure-tk module, we recommend that you check that the Gnocl and VTK modules can be loaded by the Tcl interpreter. This can be done by running tclsh
from the command line and entering the following Tcl commands:
package require vtk
package require Gnocl
package require GnoclBuilder
package require GnoclCanvas
If everything is in good working order, then these commands should print the package version numbers (6.3 for vtk
, 0.9.96 for Gnocl
and GnoclBuilder
, 0.9.95 for GnoclCanvas
). If you get a bunch of error messages instead, then most likely some required libraries are missing; double-check that you really have all the aforementioned mingw32 Tcl/Tk, Gnome/GTK and VTK libraries installed.
In addition to the requisite msys2 packages listed under One-Click Installer above, you also need the GNU glob library. Unpack libglob.tar.gz and run make && make install
in the mingw32 environment, then you should be able to compile the Pure interpreter and (at least) the addon modules included in the one-click installer as usual. That is, in theory you can just grab the latest source from https://github.com/agraef/pure-lang and follow the instructions in the Getting Started wiki page.
It wouldn't be Windows, though, if there weren't some specific quirks to deal with. Specifically, the msys2 pkg-config
program insists on tacking on an absolute path prefix like c:/msys64
to the Pure installation prefix, even when running inside msys2 bash. This won't really matter as long as you're doing a straight make install
of any of the addon modules, but it gets in the way when employing the DESTDIR
make variable to do a staged install. To work around this, pkg-config
needs to be run with the --dont-define-prefix
option. This is most easily achieved by replacing pkg-config
with a shell script installed in some directory which comes before /mingw32/bin
in your PATH
(I have it in ~/bin
), with the following contents:
#! /usr/bin/bash
$MINGW_PREFIX/bin/pkg-config --dont-define-prefix "$@"
Also note that in order to compile the dump-ast program in the pure-gen module, you'll need the Haskell language-c parser library (version 0.5 or earlier, later versions don't work at present). To get this up and running, you'll need an installation of the "Haskell Platform for Windows" available at https://www.haskell.org/platform/windows.html. After installing Haskell, add the corresponding bin directory (e.g., /c/Program Files/Haskell Platform/8.0.2a/bin
) to your PATH
. Then run cabal update
and cabal install language-c-0.5.0
to install the required library.
The process sketched out above can be applied in an analogous fashion in the mingw64 environment in order to get a x86_64 build of Pure. Make sure to install the x86_64 development packages using pacman
. You'll also have to install libglob in the mingw64 environment, running make && make install
as explained above. The rest of the compilation process should be literally the same, just running in mingw64 bash instead of mingw32.
Thanks are due to the nice folks at Advanced Installer who kindly provided me with a Free Advanced Installer License for Open-Source which I use to create all the Windows packages.