Building on Microsoft Windows: Difference between revisions

Jump to navigation Jump to search
→‎Building natively (MSYS2): Don't use cross-compilers
m (→‎Virtual Machine: Some wiki markup.)
(→‎Building natively (MSYS2): Don't use cross-compilers)
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page is directed towards new developers that are interested in contributing to Octave. There should be little requirements to follow these steps.
:''This page is directed towards new developers that are interested in contributing to Octave. If you just want to install Octave, see [[:Category:Installation]].''
 
:''For general Octave build instructions on Linux, read [[Building]].''


=Contributing to Octave=
=Contributing to Octave=
Line 8: Line 10:
If you found something you'd like to fix or improve, check out the [https://savannah.gnu.org/bugs/?group=octave bug tracker]. It might have already been fixed in the development or (unreleased) stable version.
If you found something you'd like to fix or improve, check out the [https://savannah.gnu.org/bugs/?group=octave bug tracker]. It might have already been fixed in the development or (unreleased) stable version.


Octave is version controlled in a [[Mercurial]] repository. There are several Mercurial clients for Windows. One that nicely integrates with the Windows Explorer and that offers an easy to learn user interface is [https://tortoisehg.bitbucket.io/download/index.html TortoiseHg].
Octave is version controlled in a [[Mercurial]] repository at [https://www.octave.org/hg/octave https://www.octave.org/hg/octave].
 
There are several Mercurial clients for Windows. One that nicely integrates with the Windows Explorer and that offers an easy to learn user interface is [https://tortoisehg.bitbucket.io/download/index.html TortoiseHg].
It is also quite easy to create Mercurial patches with that software. Those are the preferred way of contributing to Octave.
It is also quite easy to create Mercurial patches with that software. Those are the preferred way of contributing to Octave.


Line 14: Line 18:
If you want to contribute changes to C++ files or are interested in testing the latest development or (unreleased) stable release, you can build Octave from source.
If you want to contribute changes to C++ files or are interested in testing the latest development or (unreleased) stable release, you can build Octave from source.


There is currently no maintained way to build Octave on Windows directly. But it is still possible to build Octave on Windows machines using virtual machines or Microsoft's Windows Subsystem for Linux.
It seems to be possible to build Octave natively on Windows with the MSYS2 shell. (Be aware that this might take some time.) It is also possible to build Octave on Windows machines using virtual machines or Microsoft's Windows Subsystem for Linux. The latter is the preferred way to build Octave.
 
Building Octave natively on Windows is experimental! The only supported way of creating Windows binaries of Octave is cross-building with MXE Octave ([[Windows Installer]]).


==Virtual Machine==
==Virtual Machine==
Line 81: Line 87:
Because of the basic lack of a graphical user interface (even if somewhat mitigated with the X server), using WSL(2) is not recommended for beginners.
Because of the basic lack of a graphical user interface (even if somewhat mitigated with the X server), using WSL(2) is not recommended for beginners.


==Building natively (MSYS2)==
Octave can also be compiled natively on Windows with the MSYS2 shell.
To set up a native build environment on Windows, download and install MSYS2 following the instructions on [https://www.msys2.org/ their website].
Use the "MSYS2 MinGW 64bit" shell for building Octave.
The following command can be used to install the necessary and optional build and run-time dependencies in MSYS2:
<syntaxhighlight lang="bash">pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-lapack mingw-w64-x86_64-openblas mingw-w64-x86_64-pcre \
  mingw-w64-x86_64-arpack mingw-w64-x86_64-curl mingw-w64-x86_64-fftw mingw-w64-x86_64-fltk mingw-w64-x86_64-gl2ps mingw-w64-x86_64-glpk mingw-w64-x86_64-ghostscript mingw-w64-x86_64-gnuplot mingw-w64-x86_64-graphicsmagick mingw-w64-x86_64-hdf5 mingw-w64-x86_64-libsndfile mingw-w64-x86_64-portaudio mingw-w64-x86_64-qhull mingw-w64-x86_64-qrupdate mingw-w64-x86_64-qscintilla mingw-w64-x86_64-qt5 mingw-w64-x86_64-rapidjson mingw-w64-x86_64-suitesparse mingw-w64-x86_64-sundials \
  git mercurial mingw-w64-x86_64-ccache mingw-w64-x86_64-icoutils mingw-w64-x86_64-librsvg texinfo \
  unzip zip</syntaxhighlight>
Using ccache is optional. It speeds up compilation time but needs several GiB free disk space for its cache. If disk space is an issue, this step can be skipped. To prepend the path to the ccache helper scripts to the front of the PATH variable, add the following line near the end of the {{Path|.bash_profile}} file in your MSYS2 {{Path|$HOME}} directory:
<syntaxhighlight lang="bash">export PATH="/mingw64/lib/ccache/bin:$PATH"</syntaxhighlight>
Additionally, add the following line to the {{Path|.bash_profile}} file in your MSYS2 {{Path|$HOME}} directory to allow successfully calling programs from perl scripts:
<syntaxhighlight lang="bash">export PERL5SHELL="bash -l -c"</syntaxhighlight>
Like installing the build dependencies, this has to be done only once.
To build from the development sources, check out the Mercurial repository and run the {{Path|bootstrap}} script:
<syntaxhighlight lang="bash">hg clone https://www.octave.org/hg/octave
cd octave
./bootstrap</syntaxhighlight>
Create a sub-directory to avoid building in the source tree:
<syntaxhighlight lang="bash">mkdir -p .build
cd .build</syntaxhighlight>
Configure with the following flags:
<syntaxhighlight lang="bash">../configure \
  --disable-docs \
  ac_cv_search_tputs=-ltermcap</syntaxhighlight>
And build with the following command:
<syntaxhighlight lang="bash">make all -j8</syntaxhighlight>
Octave doesn't run correctly from the MSYS2 shell due to issues with readline and backslash as a file separator. To be able to work with it anyway, install it with the following commands (from the MSYS2 shell in {{Path|.build}}):
<syntaxhighlight lang="bash">make install
ln -sf /mingw64/libexec/octave/7.0.0/exec/x86_64-w64-mingw32/octave-gui.exe /mingw64/bin/octave-gui.exe
ln -sf /mingw64/libexec/octave/7.0.0/exec/x86_64-w64-mingw32/octave-svgconvert.exe /mingw64/bin/octave-svgconvert.exe</syntaxhighlight>
The latter two symlinks are only needed when building the GUI (i.e., Qt is not disabled).
Start Octave from a CMD shell (or with a batch script) with the following commands (assuming MSYS2 was installed in its default location):
<syntaxhighlight lang="batch">set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%
set MSYSTEM=MINGW64
set TERM=cygwin
set GNUTERM=wxt
set GS=gs.exe
set PERL5SHELL=bash -l -c
octave-gui --gui</syntaxhighlight>
If Octave was built without GUI, there won't be an {{Path|octave-gui}} executable. In that case, replace the last line with <code>octave-cli</code>.


=Footnotes=
=Footnotes=
216

edits

Navigation menu