Movatterモバイル変換


[0]ホーム

URL:


GitHub

Windows

This file describes how to install, or build, and use Julia on Windows.

For more general information about Julia, please see themain README or thedocumentation.

General Information for Windows

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

Line endings

Julia uses binary-mode files exclusively. Unlike many other Windows programs, if you write\n 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:

git config --global core.eol lfgit config --global core.autocrlf input

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

[core]    eol = lf    autocrlf = input

Binary distribution

For the binary distribution installation notes on Windows please see the instructions athttps://julialang.org/downloads/platform/#windows. Note, however, that on all platformsusingjuliaup is recommended over manually installing binaries.

Source distribution

Cygwin-to-MinGW cross-compiling

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

  1. Download and run Cygwin setup for32 bit or64 bit. 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:

    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

    replacing<url> with a site fromhttps://cygwin.com/mirrors.html or run setup manually first and select a mirror.

  2. Select installation location and a mirror to download from.

  3. At theSelect Packages step, select the following:

    1. From theDevel category:cmake,gcc-g++,git,make,patch
    2. From theNet category:curl
    3. FromInterpreters (orPython) category:m4,python3
    4. From theArchive category:p7zip
    5. For 32 bit Julia, and also from theDevel category:mingw64-i686-gcc-g++ andmingw64-i686-gcc-fortran
    6. For 64 bit Julia, and also from theDevel category:mingw64-x86_64-gcc-g++ andmingw64-x86_64-gcc-fortran
  4. Allow Cygwin installation to finish, then start from the installed shortcut'Cygwin Terminal', or'Cygwin64 Terminal', respectively.

  5. Build Julia and its dependencies from source:

    1. Get the Julia sources

      git clone https://github.com/JuliaLang/julia.gitcd julia

      Tip: If you get anerror: cannot fork() for fetch-pack: Resource temporarily unavailable from git, addalias git="env PATH=/usr/bin git" to~/.bashrc and restart Cygwin.

    2. Set theXC_HOST variable inMake.user to indicate MinGW-w64 cross compilation

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

      make -j 4       # Adjust the number of threads (4) to match your build environment.make -j 4 debug # This builds julia-debug.exe
  6. Run Julia using the Julia executables directly

    usr/bin/julia.exeusr/bin/julia-debug.exe
Pro tip: build both!
make O=julia-win32 configuremake O=julia-win64 configureecho 'XC_HOST = i686-w64-mingw32' > julia-win32/Make.userecho 'XC_HOST = x86_64-w64-mingw32' > julia-win64/Make.userecho 'ifeq ($(BUILDROOT),$(JULIAHOME))        $(error "in-tree build disabled")      endif' >> Make.usermake -C julia-win32  # build for Windows x86 in julia-win32 foldermake -C julia-win64  # build for Windows x86-64 in julia-win64 folder

Compiling with MinGW/MSYS2

MSYS2 is a software distribution and build environment for Windows.

Note: MSYS2 requires64 bit Windows 7 or newer.

  1. Install and configure MSYS2.

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

    2. Open the MSYS2 shell. Update the package database and base packages:

      pacman -Syu

    3. Exit and restart MSYS2. Update the rest of the base packages:

      pacman -Syu

    4. Then install tools required to build julia:

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

      For 64 bit Julia, install the x86_64 version:

      pacman -S mingw-w64-x86_64-gcc

      For 32 bit Julia, install the i686 version:

      pacman -S mingw-w64-i686-gcc

    5. Configuration of MSYS2 is complete. Nowexit the MSYS2 shell.

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

    1. Open a newMINGW64/MINGW32 shell. Currently we can't use both mingw32 and mingw64, so if you want to build the x86_64 and i686 versions, you'll need to build them in each environment separately.

    2. Clone the Julia sources:

      git clone https://github.com/JuliaLang/julia.git cd julia

    3. Start the build

      make -j$(nproc)

Pro tip: build in dir
make O=julia-mingw-w64 configureecho 'ifeq ($(BUILDROOT),$(JULIAHOME))        $(error "in-tree build disabled")      endif' >> Make.usermake -C julia-mingw-w64

Cross-compiling from Unix (Linux/Mac/WSL)

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):

apt-get install wine-stable gcc wget p7zip-full winbind mingw-w64 gfortran-mingw-w64dpkg --add-architecture i386 && apt-get update && apt-get install wine32 # add sudo to each if needed# switch all of the following to their "-posix" variants (interactively):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 $pkgdone

On Mac: Install XCode, XCode command line tools, X11 (nowXQuartz), andMacPorts orHomebrew. Then runport install wine wget mingw-w64, orbrew install wine wget mingw-w64, as appropriate.

Then run the build:

  1. git clone https://github.com/JuliaLang/julia.git julia-win32
  2. cd julia-win32
  3. echo override XC_HOST = i686-w64-mingw32 >> Make.user
  4. make
  5. make win-extras (Necessary before runningmake binary-dist)
  6. make binary-dist thenmake exe to create the Windows installer.
  7. move thejulia-*.exe installer to the target machine

If you are building for 64-bit Windows, the steps are essentially the same. Just replacei686 inXC_HOST withx86_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 availableas part of the MSYS2 project 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 launched from the command line. This can be worked around by prependingwineconsole to the regular GDB invocation.

After compiling

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 usingmake win-extras followed bymake binary-dist andmake exe. Then run the resulting installer.

Windows Build Debugging

GDB hangs with Cygwin mintty

GDB not attaching to the right process

GDB not showing the right backtrace

Build process is slow/eats memory/hangs my computer

Settings


This document was generated withDocumenter.jl version 1.8.0 onWednesday 9 July 2025. Using Julia version 1.11.6.


[8]ページ先頭

©2009-2025 Movatter.jp