Building on Microsoft Windows: Difference between revisions

Jump to navigation Jump to search
Add instructions for a native build
(→‎Contributing to Octave: Include link to Octave's Mercurial repository)
(Add instructions for a native build)
Line 85: Line 85:
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 dependencies in MSYS2:
<pre>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-cvode 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 \
  libutil-linux-devel \
  ccache git mercurial mingw-w64-x86_64-icoutils mingw-w64-x86_64-librsvg texinfo</pre>
To create scripts that allow it to use ccache easily (for most of the compilers in MSYS2), one can use the following commands:
<pre>cd /usr/lib/ccache/bin
scripts=(c++ cc cpp gcc g++ gfortran x86_64-w64-mingw32-g++ x86_64-w64-mingw32-c++ x86_64-w64-mingw32-gcc x86_64-w64-mingw32-gfortran)
for fn in ${scripts[*]}; do
  echo -e '#!/bin/bash\n\nccache /mingw64/bin/'$fn' "$@"' > $fn
done</pre>
Additionally, add the path to these helper scripts to the front of the PATH variable by adding the following line near the end of the {{Path|.bashrc}} file in your MSYS2 {{Path|$HOME}} directory:
<pre>export PATH="/usr/lib/ccache/bin:$PATH"</pre>
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:
<pre> hg clone https://www.octave.org/hg/octave && \
cd octave && \
./bootstrap</pre>
Configure with the following flags:
<pre>../configure CC="x86_64-w64-mingw32-gcc" CXX="x86_64-w64-mingw32-g++" F77="x86_64-w64-mingw32-gfortran" PORTAUDIO_LDFLAGS="-LC:/msys64/mingw64/lib -LC:/msys64/usr/lib" --disable-docs ac_cv_search_tputs=-ltermcap</pre>
And build with the following flags:
<pre>make all -j8 FLTK_LIBS="-lfltk_gl -lopengl32 -lglu32 -lfltk -lpthread" PERL5SHELL="bash -l -c"</pre>
Octave doesn't run correctly from the MSYS2 shell due to issues with readline. To be able to work with it anyway, install it with the following commands:
<pre>make install
ln -sf /mingw64/libexec/octave/7.0.0/exec/x86_64-w64-mingw32/octave-gui.exe /mingw64/bin/octave-gui.exe</pre>
Start Octave from a CMD shell (or with a batch script) with the following content (assuming MSYS2 was installed in its default location):
<pre>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</pre>


=Footnotes=
=Footnotes=
240

edits

Navigation menu