Building on Microsoft Windows: Difference between revisions

Jump to navigation Jump to search
→‎Building natively (MSYS2): Update instructions
(→‎Building natively (MSYS2): Add autotools to build dependencies)
(→‎Building natively (MSYS2): Update instructions)
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
 
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 this 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 executable are installed in the same folder like the libraries they depend on. That can be achieved by creating symlinks to these executable 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 can be started with the command <code>octave</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
240

edits

Navigation menu