This file describes how to use and build Julia on Windows. For more information about Julia, please see the main README
Julia runs on Windows XP SP2 or later (including Windows Vista, Windows 7, and Windows 8). Both the 32-bit and 64-bit versions are supported. The 32-bit i686 binary will run on either 32-bit and 64-bit operating systems. The 64-bit x86_64 binary will only run on 64-bit Windows.
-
Download and install 7-Zip. Install the full program, not just the command line version.
-
Download the latest version of Julia. Extract the binary to a reasonable destination folder, e.g.
C:\julia
. -
Double-click the file
julia.bat
to launch Julia.
-
Download and install the full 7-Zip program.
-
Download and install the latest Python 2.x release. Do not install Python 3.x.
-
Install MinGW-builds, a Windows port of GCC. (Do not use the regular MinGW distribution.)
-
Download the MinGW-builds installer from the MinGW-builds homepage.
-
Run the installer. When prompted, choose: - Version: the most recent version (these instructions were tested with 4.8.1) - Architecture: x32 or x64 as desired - Threads: win32 (not posix) - Exception: sjlj (for x32) or seh (for x64). Do not choose dwarf2. - Build revision: most recent available (tested with 5)
-
Do not install to a directory with spaces in the name. You will have to change the default installation path. Choose instead something like
C:\mingw-builds\x64-4.8.1-win32-seh-rev5\mingw64
. -
Download and extract the MSYS distribution for MinGW-builds (e.g. msys+7za+wget+svn+git+mercurial+cvs-rev13.7z) to a directory without spaces in the name, e.g.
C:/mingw-builds/msys
. -
Download the MSYS distribution of make and use this
make.exe
to replace the one in themingw64\bin
subdirectory of the MinGW-builds installation. -
Run the
msys.bat
installed in Step 4. Set up MSYS by running at the MSYS prompt:mount C:/mingw-builds/x64-4.8.1-win32-seh-rev5/mingw64/bin /mingw mount C:/Python27 /python export PATH=$PATH:/mingw/bin:/python
Replace the directories as appropriate.
-
Download the Julia source repository and build it
git clone https://github.com/JuliaLang/julia.git cd julia make
Tips:
- The MSYS build of
make
is fragile and will occasionally corrupt the build process. You can minimize the changes of this occurring by only runningmake
in serial, i.e. avoid the-j
argument. - When the build process fails for no apparent reason, try running
make
again. - Sometimes,
make
will appear to hang, consuming 100% cpu but without apparent progress. If this happens, killmake
from the Task Manager and try again. - Expect this to take a very long time (dozens of hours is not uncommon).
- If
make
fails complaining that./flisp/flisp
is not found, forcemake
to build FemtoLisp before Julia by runningmake -C src/flisp && make
.
- Run Julia with either of:
- Using
make
make run-julia
(the full syntax is `make run-julia[-release|-debug] [DEFAULT_REPL=(basic|readline)]`)
- Using the Julia executables directly
```
usr/bin/julia-readline
(or `julia-basic` if you prefer)
-
Download and install 7-Zip, Python 2.x and MinGW-builds as described in the previous section.
-
Install and configure MSYS2, a minimal POSIX-like environment for Windows.
-
Download the latest base 32-bit or 64-bit distribution as apprpriate.
-
Using 7-Zip, extract the archive to a convenient directory, e.g. C:\msys2\x64-20131126. You may need to extract the tarball in a separate step. This will create an additional
msys32
/msys64
subdirectory. - Some versions of this archive contain zero-byte files that clash with existing files. If prompted, choose to not overwrite all existing files. -
Launch
msys2_shell.bat
, which will initialize MSYS2. -
Install the necessary packages:
pacman-key --init #Download keys
pacman -Syu #Update package database and full system upgrade
pacman -S diffutils git m4 make patch python2 tar
ln -s /usr/bin/python{2.exe,} #Fixes python2 not found error
5. Edit the `/etc/fstab` file and append a line of the form
```
C:/mingw-builds/x64-4.8.1-win32-seh-rev5/mingw64 /mingw ext3 binary 0 0
Use the actual installation directory of MinGW from Step 2c. Consult the Cygwin manual for details of how to enter the directory name.
- Edit the
~/.bashrc
file and append the line
export PATH=$PATH:/mingw/bin
7. `exit` the MSYS2 shell.
3. Build Julia and its dependencies from source.
1. Relaunch the MSYS2 shell and type
```
. ~/.bashrc #Some versions of MSYS2 do not run this automatically
git clone https://github.com/JuliaLang/julia.git
cd julia
make
- Some versions of PCRE (e.g. 8.31) will compile correctly but have a single
test fail with an error like
** Failed to set locale "fr_FR
which will break the entire build. To circumvent the test and allow the rest of the build to continue, create an emptychecked
file in thedeps/pcre*
directory and rerunmake
.
If you prefer to cross-compile, the following steps should get you started.
First, you will need to ensure your system has the required dependencies. We need wine, a system compiler, and some downloaders.
On Ubuntu: apt-get install wine subversion cvs gcc wget p7zip-full
On Mac: Install XCode, XCode command line tools, X11 (now XQuartz),
and MacPorts or Homebrew.
Then run port install wine wget
or brew install wine wget
, as appropriate.
On Both:
Unfortunately, the version of gcc installed by Ubuntu is currently 4.6, which does not compile OpenBLAS correctly. On Mac, the situation is the same: the version in MacPorts is very old and Homebrew does not have it. So first we need to get a cross-compile version of gcc. Most binary packages appear to not include gfortran, so we will need to compile it from source (or ask @vtjnash to send you a tgz of my build). This is typically quite a bit of work, so we will use this script to make it easy.
svn checkout http://mingw-w64-dgn.googlecode.com/svn/trunk/ mingw-w64-dgn
cd mingw-w64-dgn
- edit
rebuild_cross.sh
and make the following two changes: a. uncommentexport MAKE_OPT="-j 2"
, if appropriate for your machine b. addfortran
to the end of--enable-languages=c,c++,objc,obj-c++
bash update_source.sh
bash rebuild_cross.sh
mv cross ~/cross-w64
export PATH=$HOME/cross-w64/bin:$PATH
# NOTE: it is important that you remember to always do this before using make in the following steps!, you can put this line in your .profile to make it easy
Then we can essentially just repeat these steps for the 32-bit compiler, reusing some of the work:
cd ..
cp -a mingw-w64-dgn mingw-w32-dgn
cd mingw-w32-dgn
rm -r cross build
bash rebuild_cross.sh 32r
mv cross ~/cross-w32
export PATH=$HOME/cross-w32/bin:$PATH
# NOTE: it is important that you remember to always do this before using make in the following steps!, you can put this line in your .profile to make it easy
Note: for systems that support rpm-based package managers, the OpenSUSE build service appears to contain a fully up-to-date versions of the necessary dependencies.
- Install the following packages from the official Arch repository:
sudo pacman -S cloog gcc-ada libmpc p7zip ppl subversion zlib
- The rest of the prerequisites consist of the mingw-w64 packages, which are available in the AUR Arch repository. They must be installed exactly in the order they are given or else their installation will fail. The
yaourt
package manager is used for illustration purposes; you may instead follow the Arch instructions for installing packages from AUR or may use your preferred package manager. To start with, installmingw-w64-binutils
via the commandyaourt -S mingw-w64-binutils
yaourt -S mingw-w64-headers-svn
yaourt -S mingw-w64-headers-bootstrap
yaourt -S mingw-w64-gcc-base
yaourt -S mingw-w64-crt-svn
- Remove
mingw-w64-headers-bootstrap
without removing its dependent mingw-w64 installed packages by using the commandyaourt -Rdd mingw-w64-headers-bootstrap
yaourt -S mingw-w64-winpthreads
- Remove
mingw-w64-gcc-base
without removing its installed mingw-w64 dependencies:yaourt -Rdd mingw-w64-gcc-base
- Complete the installation of the required
mingw-w64
packages:yaourt -S mingw-w64-gcc
Finally, the build and install process for Julia:
git clone https://github.com/JuliaLang/julia.git julia-win32
echo override XC_HOST = i686-w64-mingw32 >> Make.user
echo override DEFAULT_REPL = basic >> Make.user
make
make win-extras
(Necessary before runningmake dist
p)make dist
- move the julia-* directory / zip file to the target machine
If you are building for 64-bit windows, the steps are essentially the same. Just replace i686 in XC_HOST with x86_64. (note: on Mac, wine only runs in 32-bit mode)