Editing Windows Installer

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

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 1: Line 1:
:''This article is about how to make the Microsoft Windows installer; if you'd like just to use the installer, see [[Octave for Microsoft Windows]].''
:''This article is about how to make the Windows installer; if you'd like just to use the installer, see [[Octave for Microsoft Windows]].''
GNU Octave is primarily developed on GNU/Linux and other POSIX compliant systems. There have been many efforts in the past to build ports of GNU Octave for Microsoft Windows.
GNU Octave is primarily developed on GNU/Linux and other POSIX compliant systems. There have been many efforts in the past to build ports of GNU Octave for Microsoft Windows.
This page contains instructions about creating a MS Windows installer using [[MXE|mxe-octave]] (a fork of [http://mxe.cc/ MXE]).
This page contains instructions about creating a Windows installer using [[MXE|mxe-octave]] (a fork of [http://mxe.cc/ MXE]).
This means, '''the MS Windows installer is [https://en.wikipedia.org/wiki/Cross_compiler cross-compiled] using a GNU/Linux system'''.
This means, '''the Microsoft Windows installer is [https://en.wikipedia.org/wiki/Cross_compiler cross-compiled] using a GNU/Linux system'''.


==Creating the MS Windows Installer==
==Steps to create Windows Installer==


===General steps===
===General steps===
Line 11: Line 11:
# <code>hg clone https://hg.octave.org/mxe-octave</code><ref>Use <code>hg clone https://hg.octave.org/mxe-octave <name of mxe-octave build dir></code> to choose another directory.</ref>
# <code>hg clone https://hg.octave.org/mxe-octave</code><ref>Use <code>hg clone https://hg.octave.org/mxe-octave <name of mxe-octave build dir></code> to choose another directory.</ref>
# <code>cd mxe-octave</code>
# <code>cd mxe-octave</code>
# <code>./bootstrap</code> (Among other things, the <code>bootstrap</code> script creates the <code>configure</code> script for the next step.)
# <code>./bootstrap</code>
# <code>./configure</code>
# <code>./configure</code>
# <code>make all nsis-installer</code>
# <code>make all nsis-installer</code>
Line 19: Line 19:
====<code>./configure</code>====
====<code>./configure</code>====


The current Microsoft Windows installers are build in three "flavors": for common 64- and 32-bit systems ('''"w64"''' and '''"w32"''') and for 64-bit systems exceeding 32 GB of main memory to store large data structures ('''"w64-64"''').
The current Windows installers are build in three "flavors": for common 64- and 32-bit systems ('''"w64"''' and '''"w32"''') and for 64-bit systems exceeding 32 GB of main memory to store large data structures ('''"w64-64"''').


{| class="wikitable"
{| class="wikitable"
Line 31: Line 31:
   --enable-binary-packages        \
   --enable-binary-packages        \
   --with-ccache                    \
   --with-ccache                    \
   --enable-octave=<octave version>
   --enable-octave=<octave version> \
  --enable-windows-64              \
  --enable-64
</pre>
</pre>
| <pre style="min-width:330px;">
| <pre style="min-width:330px;">
Line 39: Line 41:
   --with-ccache                    \
   --with-ccache                    \
   --enable-octave=<octave version> \
   --enable-octave=<octave version> \
  --enable-windows-64              \
  --enable-64                      \
   --enable-fortran-int64
   --enable-fortran-int64
</pre>
</pre>
Line 54: Line 58:


* <code>--enable-devel-tools</code>: Include gdb and an MSYS shell in the binary.
* <code>--enable-devel-tools</code>: Include gdb and an MSYS shell in the binary.
** If you seriously want to work with gdb, you need <code>--disable-strip-dist-files</code> as configure option to keep debug symbols in the installed binaries for debugging on MS Windows. Beware as the total Octave distribution will be > 2 GB, the max. size for an NSIS installer. Your only options are to make 7z-dist, zip-dist or tar-dist installers.
** If you seriously want to work with gdb, you need <code>--disable-strip-dist-files</code> as configure option to keep debug symbols in the installed binaries for debugging on Windows. Beware as the total Octave distribution will be > 2 GB, the max. size for an NSIS installer. Your only options are to make 7z-dist, zip-dist or tar-dist installers.
* <code>--enable-binary-packages</code>: Cross-compile binary modules in [[Octave Forge]] packages. This saves time when installing them once the installation runs on Microsoft Windows. Furthermore, some packages require patches to cross-compile successfully (or with current Octave versions). Those additional patches would be missing when compiling the original packages from Octave Forge on Windows later on. Some Octave Forge packages require a working Octave during compilation. Therefore, the correct version(!) of Octave must be installed on the host system.
* <code>--enable-binary-packages</code>: Cross-compile binary modules in [[Octave Forge]] packages. This saves time when installing them once the installation runs on Microsoft Windows.
* <code>--with-ccache</code>: The usage of [https://ccache.dev/ ccache] may speed up repetitive compilation drastically.
* <code>--with-ccache</code>: The usage of [https://ccache.dev/ ccache] may speed up repetitive compilation drastically.
* <code>--enable-octave=<octave version></code>: Build a specific version of GNU Octave, which can be one of:  
* <code>--enable-octave=<octave version></code>: Build a specific version of GNU Octave, which can be one of:  
** <code>release</code> use {{Path|src/release-octave.mk}}, download and build the latest GNU Octave release.
** <code>release</code> use {{Path|src/release-octave.mk}}, download and build the latest GNU Octave release.
** <code>stable</code> or <code>default</code> uses {{Path|src/stable-octave.mk}} or {{Path|src/default-octave.mk}}, respectively. This builds from a self-created distribution tarball from the "stable" or "default" development branch of GNU Octave.  See [[#Build installers for Octave development versions|below]] for details.
** <code>stable</code> or <code>default</code> uses {{Path|src/stable-octave.mk}} or {{Path|src/default-octave.mk}}, respectively. This builds a self-created distribution tarball from the "stable" or "default" development branch of GNU Octave.  See [[#Build installers for Octave development versions|below]] for details.
* <code>--disable-windows-64</code>: Build for 32-bit MS Windows.
* <code>--enable-windows-64</code>: Build for 64-bit MS Windows.
* <code>--enable-fortran-int64</code>: Use 64-bit integers in Fortran code and especially in numerical library code.  This option only affects the size of integers used in Fortran code like the BLAS and LAPACK libraries.  On 64-bit systems, Octave always uses 64-bit integers for indexing and basic array operations.  See [[Enable large arrays: Build octave such that it can use arrays larger than 2Gb.|Enable large arrays]] for details.
* <code>--enable-64</code>: Let Octave use 64-bit integers for indexing.
* <code>--disable-system-opengl</code>: Include software OpenGL libraries. This might help when working with buggy graphics card drivers, but might be slower than hardware accelerated rendering.
* <code>--enable-fortran-int64</code>: Use 64-bit integers in Fortran code and especially in numerical library code.
* <code>--with-pkg-dir=../mxe-octave-pkg</code>: If you are working with several build trees, you can share a common package directory.


====<code>make</code>====
====<code>make</code>====


* Use <code>make all 7z-dist</code>, <code>make all tar-dist</code> or <code>make all zip-dist</code> instead of <code>make all nsis-installer</code> if you want to build just an archive of the files to install on MS Windows instead of an installer wizard.
* Use <code>make all 7z-dist</code>, <code>make all tar-dist</code> or <code>make all zip-dist</code> instead of <code>make all nsis-installer</code> if you want to build just an archive of the files to install on Windows instead of an installer wizard.
* By default, packages will be built one at a time '''without parallelization'''. You may use <code>make JOBS=4</code> (choose a number other than 4 that is appropriate for your system) to build each individual package in parallel.
* By default, packages will be built one at a time, but you may use <code>make JOBS=4</code> (choose a number other than 4 that is appropriate for your system) to build each package in parallel. You may also combine this with the <code>-j</code> option for Make to build more than one package at a time, but be careful as using <code>make -j4 JOBS=4</code> can result in as many as 16 jobs running at once.
** '''Avoid using the <code>-j</code> option for <code>make</code>:''' Using <code>-j</code> enables building packages in parallel, which can mess up the mxe build system.  Use this option with care!  Another pitfall is the example <code>make -j4 JOBS=4</code>, which can result in as many as 16 jobs running at once.
* Include gdb in the installer by running <code>make gdb</code> before making the <code>nsis-installer</code> target.
* Include gdb in the installer by running <code>make gdb</code> before making the <code>nsis-installer</code> target.


===Build installers for Octave development versions===
===Build installers for Octave development versions===


# Build the "stable" or "default" Octave development branch on Linux (in separate source and build trees) including your favorite modifications and patches.  Octave must be configured with Java support.  How to do this depends on your Linux distribution, see [[Building]].
# Build the "stable" or "default" Octave development branch on Linux (in separate source and build trees) including your favorite modifications and patches.  Octave must be configured with Java support.  How to do this depends on your Linux distribution, see [[Octave for GNU/Linux]].
# Verify that Octave runs fine in Linux (for example using <code>make check</code> and by trying to run your build <code>./run-octave --gui</code>).
# Verify that Octave runs fine in Linux (for example using <code>make check</code> and by trying to run your build <code>./run-octave --gui</code>).
# Create a distribution archive called '''"octave-<version>.tar.lz"''' in the top build directory with <code>make dist-lzip DIST_IGNORE_HG_STATE=1</code>. <code>lzip</code> needs to be available for this step. (On Debian-like systems, it can be installed with <code>apt-get install lzip</code>).
# Create a distribution archive called '''"octave-<version>.tar.lz"''' in the top build directory with <code>make dist-lzip DIST_IGNORE_HG_STATE=1</code>.
# Move or copy '''"octave-<version>.tar.lz"''' to the {{Path|<mxe-octave build>/pkg}} folder (or create a symbolic link to it).
# Move or copy '''"octave-<version>.tar.lz"''' to the {{Path|<mxe-octave build>/pkg}} folder (or create a symbolic link to it).
# Follow the [[#General steps|general steps]] and ensure the configuration with either of <code>--enable-octave=stable</code> or <code>--enable-octave=default</code>.
# Follow the [[#General steps|general steps]] and ensure the configuration with either of <code>--enable-octave=stable</code> or <code>--enable-octave=default</code>.
Line 89: Line 92:
===Remarks===
===Remarks===


* If you have several MXE-Octave build dirs (for e.g., stable and several development versions, or build trees for 32bit and 64bit Windows targets), it is possible to point to a common {{Path|pkg}} directory using the configure flag <code>--with-pkg-dir=path_to_common_pkg_directory</code>. That way downloading the packages for each build tree can be avoided. Thus, potentially saving a lot of downloading bandwidth.
* If you have several mxe-octave build dirs (for e.g., stable and several development versions) it is handy to have a separate {{Path|pkg}} subdirectory where all mxe-octave build directories link to via an symbolic link, for example. That saves a lot of downloading bandwidth.
* As of late December 2015, [https://hg.octave.org/mxe-octave/rev/0962acdde3be MXE-Octave allows out-of-tree builds]. This makes it easier to build separate Octave versions with the same MXE-Octave tree.
* As of late December 2015, [https://hg.octave.org/mxe-octave/rev/0962acdde3be mxe-octave allows out-of-tree builds]. This makes it easier to build separate Octave versions with the same mxe-octave tree.
* To keep MXE-Octave up-to-date, from time to time run the following commands in the MXE-Octave repository:
* To keep mxe-octave up-to-date, from time to time do:
  hg -v pull
  hg -v pull
  hg -v update
  hg -v update
* However, some package updates might need a clean build tree. If an incremental build fails after an update, consider running <code>make clean</code> or starting with a fresh clone, see [[#General steps|General steps]].
* However, do not keep mxe-octave build dirs for too long. I'd suggest to wipe a build dir after at most two or three months and start over with a fresh clone, see [#General steps|general steps].
* In the mean time, you might want to regularly clean up {{Path|<mxe-octave build dir>/log}} to save disk space. The logs are of informational value only and are not needed after the build completes. They can safely be deleted.
* In the mean time, regularly clean up {{Path|<mxe-octave build>/log}} to save disk space. After a first successful build there is no more use for the log subdirectories for each package. One can safely wipe them all.
* It can happen that you meet problems with Java. To build Octave with Java support built-in, MXE-Octave needs:
* It can happen that you meet problems with Java. To build Octave with Java support built-in, mxe-octave needs:
** A Java JDK (Java Development Kit) on the '''build''' system. In other words, the javac (Java compiler) and jar (Java archiver) executables should be in the PATH-system-variable.
** A Java JDK (Java Development Kit) on the '''host''' system. In other words, the javac (Java compiler) and jar (Java archiver) executables should be in the PATH-system-variable.
** Java include files for MS Windows. They should reside in {{Path|<mxe-octave build dir>/usr/x86_64-w64-mingw32/include/java/win32}} or {{Path|<mxe-octave build dir>/usr/i686-w64-mingw32/include/java/win32}}, respectively. If they are not present, MXE-Octave downloads them automatically. However, this might fail occasionally (e.g. if the server cannot be reached). On a multi-boot system, a solution (note: dirty hack warning!) is symlinking to the MS Windows include files on the MS Windows partition from the MXE-Octave location. (Don't do this unless you are sure what you are doing.)
** Java include files for windows ("w32", even for "w64" builds). They should reside in {{Path|<mxe-octave build dir>/usr/x86_64-w64-mingw32/include/java/win32}}. If they are not present, mxe-octave downloads them automatically, but this can occasionally go wrong. On a multi-boot system a solution (note: dirty hack warning!) is symlinking to the Windows include files on the Windows partition from the mxe-octave location.


===Troubleshooting===
===Troubleshooting===
Line 109: Line 112:
* Sometimes mxe-octave builds fail at "libmng".  This may be due to a race condition related to disk I/O when using a fast SSD harddisk. A way to get past this is by specifying "make nsis-installer JOBS=1", if required repeatedly (sometimes 5 or 6 times), interrupting the build in the next step/dependency once "libmng" has been built fine, and restarting with "make nsis-installer JOBS=<higher number>". As of December 2015 it is only libmng that has this issue.
* Sometimes mxe-octave builds fail at "libmng".  This may be due to a race condition related to disk I/O when using a fast SSD harddisk. A way to get past this is by specifying "make nsis-installer JOBS=1", if required repeatedly (sometimes 5 or 6 times), interrupting the build in the next step/dependency once "libmng" has been built fine, and restarting with "make nsis-installer JOBS=<higher number>". As of December 2015 it is only libmng that has this issue.


==Testing using virtual machines==
==Trying out cross-built Octave on Linux through VirtualBox==


Microsoft provides several virtual machine (e.g. VirtualBox) disk images of MS Windows for about one month of testing  
Micosoft makes pre-built Windows 10 virtual disk images available for testing. While primarily meant for testing the MS-Edge browser, the license for these images does not limit the use of these images to just MS-Edge. So it is perfectly possible to also test Octave.
* https://developer.microsoft.com/en-us/windows/downloads/virtual-machines
There are several advantages:
* https://developer.microsoft.com/en-us/microsoft-edge/tools/vms (primarily meant for testing the MS-Edge browser)
* Rebooting from Linux to Windows isn't needed;
The license (given on that page) for these images does not limit the use of these images. So it is perfectly possible to also test GNU Octave.
* The latest Windows 10 version is always available;
* Building the installer or zip/7z/<whatever> archives itself isn't needed. One can interrupt the build process after the entire installation of Octave has been made in the dist/octave subdirectory of mxe-octave, i.e., when the message "generating installer" (or "zip...") is shown, saving ~10-15 minutes.
Of course one an also install (or unpack) octave into the virtualized Windows 10.


The key idea is to create a shared folder inside the virtual machine to the mxe-octave build directory. It is advised to make it read-only.  Either install (or unpack) Octave into MS Windows 10, or create a shortcut to {{Path|octave.vbs}} in the {{Path|<mxe-octave build dir>/dist/octave}} subdirectory on the Linux side.
Steps:
* Install Virtualbox
* Grab a copy of the Windows 10 image here:  https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
* Unpack and import the disk image into VirtualBox.
* In VirtualBox, select Settings | Shared folders and setup access from Windows 10 to the Linux subdir where you but mxe-octave. It is advised to make it read-only.


Some advantages:
Then:
* No dedicated MS Windows machine or rebooting from Linux is needed;
* Either install (or unpack) Octave into Windows 10, or
* The <strike>latest</strike> MS Windows 10 version is always available;
* Create a shortcut to octave.vbs in the dist/octave subdir on Linux.
* Building the installer archives (zip, 7z, ...) isn't needed. One can interrupt the build process after the local installation of Octave has been made in the dist/octave subdirectory of mxe-octave, i.e., when the message "generating installer" (or "zip...") is shown. This saves about 10-15 minutes. Of course one can also use the common distribution formats for the virtual MS Windows machine.


Hints:
Hints:
* It is possible to adapt {{Path|mxe-octave/binary-dist-rules.mk}} to have a consistent name for the {{Path|<mxe-octave build dir>/dist/octave}} subdirectory (i.e., without time/date/bitwidth suffixes). This way, in MS Windows the shortcut doesn't need adaptation after each cross-build action. Maybe it would be better if {{Path|mxe-octave/binary-dist-rules.mk}} had a rule to create a symlink {{Path|<mxe-octave build dir>/dist/octave}} pointing to the latest cross-build.
* I adapted mxe-octave/binary-dist-rules.mk to have a consistent name for the dist/octave subdir (i.e., without time/date/bitwidth suffixes) so that in Windows the shortcut doesn't need adaptation after each cross-build action. Maybe it is better if binary-dist-rules.mk has a rule to create a symlink "dist/octave/" pointing to the latest cross-build.
* The image expires after 30 days. But if you make a VirtualBox snapshot before starting the VM the first time, you can revert to that snapshot (essentially, the image will last longer). This way, you also won't need to uninstall Octave each time before installing a new build.
* The image expires after 90 days. But if you make a VirtualBox snapshot it will last longer, and you don't need to uninstall Octave each time before installing a new build.


==Footnotes==
==Footnotes==
Line 131: Line 139:
<references/>
<references/>


[[Category:Building]]
[[Category:Packaging]]
[[Category:Microsoft Windows]]
Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: