For more general information about Julia, please see the main README or the .

We highly recommend running Julia using a modern terminal application, in particular Windows Terminal, which can be installed from the .

Julia uses binary-mode files exclusively. Unlike many other Windows programs, if you write to a file, you get a \n in the file, not some other bit pattern. This matches the behavior exhibited by other operating systems. If you have installed Git for Windows, it is suggested, but not required, that you configure your system Git to use the same convention:

or edit %USERPROFILE%\.gitconfig and add/edit the lines:

  1. [core]
  2. eol = lf
  3. autocrlf = input

Binary distribution

For the binary distribution installation notes on Windows please see the instructions at .

Cygwin-to-MinGW cross-compiling

The recommended way of compiling Julia from source on Windows is by cross compiling from , using versions of the MinGW-w64 compilers available through Cygwin’s package manager.

  1. Download and run Cygwin setup for 32 bit or . Note, that you can compile either 32 or 64 bit Julia from either 32 or 64 bit Cygwin. 64 bit Cygwin has a slightly smaller but often more up-to-date selection of packages.

    Advanced: you may skip steps 2-4 by running:

    1. setup-x86_64.exe -s <url> -q -P cmake,gcc-g++,git,make,patch,curl,m4,python3,p7zip,mingw64-i686-gcc-g++,mingw64-i686-gcc-fortran,mingw64-x86_64-gcc-g++,mingw64-x86_64-gcc-fortran
    2. :: replace <url> with a site from https://cygwin.com/mirrors.html
    3. :: or run setup manually first and select a mirror
  2. At the ‘Select Packages’ step, select the following:

    1. From the Devel category: cmake, gcc-g++, git, make, patch
    2. From the Net category: curl
    3. From Interpreters (or Python) category: m4, python3
    4. From the Archive category: p7zip
    5. For 32 bit Julia, and also from the Devel category: mingw64-i686-gcc-g++ and mingw64-i686-gcc-fortran
    6. For 64 bit Julia, and also from the Devel category: mingw64-x86_64-gcc-g++ and mingw64-x86_64-gcc-fortran
  3. At the ‘Resolving Dependencies’ step, be sure to leave ‘Select required packages (RECOMMENDED)’ enabled.

  4. Allow Cygwin installation to finish, then start from the installed shortcut a ‘Cygwin Terminal’, or ‘Cygwin64 Terminal’, respectively.

  5. Build Julia and its dependencies from source:

    1. Get the Julia sources

    2. Set the XC_HOST variable in Make.user to indicate MinGW-w64 cross compilation

      1. echo 'XC_HOST = i686-w64-mingw32' > Make.user # for 32 bit Julia
      2. # or
      3. echo 'XC_HOST = x86_64-w64-mingw32' > Make.user # for 64 bit Julia
    3. Start the build

      1. make -j 4 # Adjust the number of threads (4) to match your build environment.
  1. 1. Run Julia using the Julia executables directly
  1. usr/bin/julia.exe
  2. usr/bin/julia-debug.exe
  3. ```

Note: MSYS2 requires 64 bit Windows 7 or newer.

  1. Install and configure , Software Distribution and Building Platform for Windows.

    1. Download and run the latest installer for the 64-bit distribution. The installer will have a name like msys2-x86_64-yyyymmdd.exe.

    2. Exit and restart MSYS2, Update the rest of the base packages: sh pacman -Syu

    3. Then install tools required to build julia: ```sh

      tools

      pacman -S cmake diffutils git m4 make patch tar p7zip curl python

      For 64 bit Julia, install x86_64

      pacman -S mingw-w64-x86_64-gcc

      For 32 bit Julia, install i686

      pacman -S mingw-w64-i686-gcc ```

    4. Configuration of MSYS2 is complete. Now exit the MSYS2 shell.

  2. Build Julia and its dependencies with pre-build dependencies.

    1. and clone the Julia sources sh git clone https://github.com/JuliaLang/julia.git cd julia

    2. Start the build sh make -j$(nproc)

    Protip: build in dir

)

You can also use MinGW-w64 cross compilers to build a Windows version of Julia from Linux, Mac, or the Windows Subsystem for Linux (WSL).

First, you will need to ensure your system has the required dependencies. We need wine (>=1.7.5), a system compiler, and some downloaders. Note: a cygwin install might interfere with this method if using WSL.

On Ubuntu (on other Linux systems the dependency names are likely to be similar):

  1. apt-get install wine-stable gcc wget p7zip-full winbind mingw-w64 gfortran-mingw-w64
  2. dpkg --add-architecture i386 && apt-get update && apt-get install wine32 # add sudo to each if needed
  3. # switch all of the following to their "-posix" variants (interactively):
  4. for pkg in i686-w64-mingw32-g++ i686-w64-mingw32-gcc i686-w64-mingw32-gfortran x86_64-w64-mingw32-g++ x86_64-w64-mingw32-gcc x86_64-w64-mingw32-gfortran; do sudo update-alternatives --config $pkg; done

On Mac: Install XCode, XCode command line tools, X11 (now XQuartz), and or Homebrew. Then run port install wine wget mingw-w64, or brew install wine wget mingw-w64, as appropriate.

Then run the build:

  1. cd julia-win32
  2. echo override XC_HOST = i686-w64-mingw32 >> Make.user
  3. make
  4. make win-extras (Necessary before running make binary-dist)
  5. make binary-dist then make exe to create the Windows installer.
  6. move the julia-*.exe installer 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).

Debugging a cross-compiled build under wine

The most effective way to debug a cross-compiled version of Julia on the cross-compilation host is to install a windows version of gdb and run it under wine as usual. The pre-built packages available are known to work. Apart from the GDB package you may also need the python and termcap packages. Finally, GDB’s prompt may not work when launch from the command line. This can be worked around by prepending wineconsole to the regular GDB invocation.

Compiling using one of the options above creates a basic Julia build, but not some extra components that are included if you run the full Julia binary installer. If you need these components, the easiest way to get them is to build the installer yourself using make win-extras followed by make binary-dist and make exe. Then running the resulting installer.

Windows Build Debugging

  • Run gdb under the windows console (cmd) instead. gdb may not function properly under mintty with non- cygwin applications. You can use cmd /c start to start the windows console from mintty if necessary.

GDB not attaching to the right process

  • Use the PID from the windows task manager or WINPID from the ps command instead of the PID from unix style command line tools (e.g. pgrep). You may need to add the PID column if it is not shown by default in the windows task manager.
  • When attaching to the julia process, GDB may not be attaching to the right thread. Use info threads command to show all the threads and thread <threadno> to switch threads.
  • Be sure to use a 32 bit version of GDB to debug a 32 bit build of Julia, or a 64 bit version of GDB to debug a 64 bit build of Julia.

  • Disable the Windows Superfetch and services, as they are known to have spurious interactions with MinGW/Cygwin.

    As mentioned in the link above: excessive memory use by svchost specifically may be investigated in the Task Manager by clicking on the high-memory svchost.exe process and selecting . Disable child services one-by-one until a culprit is found.

  • Beware of . The vmmap tool is indispensable for identifying such software conflicts. Use vmmap to inspect the list of loaded DLLs for bash, mintty, or another persistent process used to drive the build. Essentially any DLL outside of the Windows System directory is potential BLODA.