Editing Building on Microsoft Windows
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 18: | 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. | |||
==Virtual Machine== | ==Virtual Machine== | ||
Line 95: | Line 93: | ||
Use the "MSYS2 MinGW 64bit" shell for building Octave. | Use the "MSYS2 MinGW 64bit" shell for building Octave. | ||
The following command can be used to install the necessary and optional build | 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 \ | |||
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</pre> | ||
Using ccache is optional. It speeds up compilation time but needs several GiB free | Using ccache is optional. It speeds up compilation time but needs several GiB free disc space for its cache. If disc 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: | ||
< | <pre>export PATH="/mingw64/lib/ccache/bin:$PATH"</pre> | ||
Like installing the build dependencies, this has to be done only once. | 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: | 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 | cd octave | ||
./bootstrap</ | ./bootstrap</pre> | ||
Create a sub-directory to avoid building in the source tree: | Create a sub-directory to avoid building in the source tree: | ||
< | <pre>mkdir .build | ||
cd .build</ | cd .build</pre> | ||
Configure with the following flags: | 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" \ | |||
--disable-docs \ | --disable-docs \ | ||
ac_cv_search_tputs=-ltermcap</pre> | |||
And build with the following flags: | |||
< | <pre>make -C ./.build all -j8 V=1 \ | ||
FLTK_LIBS="-lfltk_gl -lopengl32 -lglu32 -lfltk -lpthread" \ | |||
PORTAUDIO_LIBS="-lportaudio -ldsound -lsetupapi -lwinmm -lm -lole32" | |||
</pre> | |||
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: | |||
<pre>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</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 MSYSTEM=MINGW64 | ||
set TERM=cygwin | set TERM=cygwin | ||
Line 147: | Line 138: | ||
set GS=gs.exe | set GS=gs.exe | ||
set PERL5SHELL=bash -l -c | set PERL5SHELL=bash -l -c | ||
octave-gui --gui</ | octave-gui --gui</pre> | ||
=Footnotes= | =Footnotes= |