Building on Microsoft Windows: Difference between revisions

Jump to navigation Jump to search
m
→‎Building natively (MSYS2): More grammar fixes and minor changes
(→‎Building Octave: Clarifiy recommendation)
m (→‎Building natively (MSYS2): More grammar fixes and minor changes)
(3 intermediate revisions by the same user not shown)
Line 96: Line 96:


The following command can be used to install the necessary and optional build and run-time dependencies in MSYS2:
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 \
<syntaxhighlight lang="bash">pacman -S base-devel mingw-w64-x86_64-autotools 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 \
   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 \
   git mercurial mingw-w64-x86_64-ccache mingw-w64-x86_64-icoutils mingw-w64-x86_64-librsvg texinfo \
Line 126: Line 126:
<syntaxhighlight lang="bash">make all -j8</syntaxhighlight>
<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}}):
Windows doesn't have a shebang mechanism to execute scripts with an arbitrary interpreter. But the <code>makeinfo</code> program in MSYS2 is implemented as a perl script. As a work-around, tell Octave to interpret that file with the <code>perl</code> interpreter. You could do that, e.g., by running the following command to append to the global startup file:
<syntaxhighlight lang="bash">make install
<syntaxhighlight lang="bash">echo 'makeinfo_program (sprintf ("%s && cd %s/../usr/bin && perl makeinfo", OCTAVE_HOME ()(1:2), OCTAVE_HOME ()));' >> "${MINGW_PREFIX}/share/octave/site/m/startup/octaverc"</syntaxhighlight>
ln -sf /mingw64/libexec/octave/7.0.0/exec/x86_64-w64-mingw32/octave-gui.exe /mingw64/bin/octave-gui.exe
This has to be done only once.
 
A relocation issue with the graphicsmagick library in MSYS2 might cause Octave to crash on certain commands unless it is installed to the default location. To avoid these possible crashes, install Octave (from the MSYS2 shell in {{Path|.build}}) before using it:
<syntaxhighlight lang="bash">make install</syntaxhighlight>
 
Windows' library lookup mechanism requires that the following executables are installed in the same folder like the libraries they depend on. That can be achieved by creating symlinks to these executables in the "correct" location:
<syntaxhighlight lang="bash">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>
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).
These symlinks are only needed when building the GUI (i.e., Qt is not disabled). This step is no longer necessary with Octave 7 or newer.
 
At this point, Octave's GUI can be started with the command <code>octave --gui</code> at the MSYS2/MINGW64 shell.


Start Octave from a CMD shell (or with a batch script) with the following commands (assuming MSYS2 was installed in its default location):
If you'd like to start Octave from a CMD shell (or with a batch script), the following commands could be used (assuming MSYS2 was installed in its default location):
<syntaxhighlight lang="batch">set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%
<syntaxhighlight lang="batch">set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%
set MSYSTEM=MINGW64
set MSYSTEM=MINGW64
216

edits

Navigation menu