Windows Installer: Difference between revisions
No edit summary |
|||
(84 intermediate revisions by 26 users not shown) | |||
Line 1: | Line 1: | ||
GNU Octave is primarily developed on GNU/Linux and other POSIX | :''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]].'' | ||
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 means, '''the MS Windows installer is [https://en.wikipedia.org/wiki/Cross_compiler cross-compiled] using a GNU/Linux system'''. | |||
==Creating the MS Windows Installer== | |||
== | ===General steps=== | ||
MXE | # Reassure you have the package libffi-dev installed or the Python build will silently be incomplete | ||
# Install the MXE build requirements.<ref>The requirements for each system are listed in the repository https://hg.octave.org/mxe-octave/file/tip/index.html. Start with the second step to read the {{Path|index.html}} file on your local machine.</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>./bootstrap</code> (Among other things, the <code>bootstrap</code> script creates the <code>configure</code> script for the next step.) | |||
# <code>./configure</code> | |||
# <code>make all nsis-installer</code> | |||
=== | ===Step details=== | ||
====<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"'''). | |||
{| class="wikitable" | |||
! "w64" (recommended) | |||
! "w64-64" | |||
! "w32" | |||
|-style="vertical-align:top;" | |||
| <pre style="min-width:330px;"> | |||
./configure \ | |||
--enable-devel-tools \ | |||
--enable-binary-packages \ | |||
--with-ccache \ | |||
--enable-octave=<octave version> | |||
</pre> | |||
| <pre style="min-width:330px;"> | |||
./configure \ | |||
--enable-devel-tools \ | |||
--enable-binary-packages \ | |||
--with-ccache \ | |||
--enable-octave=<octave version> \ | |||
--enable-fortran-int64 | |||
</pre> | |||
| <pre style="min-width:330px;"> | |||
./configure \ | |||
--enable-devel-tools \ | |||
--enable-binary-packages \ | |||
--with-ccache \ | |||
--enable-octave=<octave version> \ | |||
--disable-windows-64 | |||
</pre> | |||
|} | |||
The individual options have the following meaning (see also <code>./configure --help</code>): | |||
= | * <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. | |||
* <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>--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>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>--disable-windows-64</code>: Build for 32-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>--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>--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>==== | |||
* 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. | |||
* 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. | |||
** '''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. | |||
=== | ===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]]. | |||
# 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>). | |||
# 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>. | |||
# Move the final installer in {{Path|<mxe-octave build>/dist}} to some Microsoft Windows machine (USB thumb drive, LAN copy, whatever) and install it "as usual". If you created an archive, using <code>make all 7z-dist</code> for example, you'll have to manually create the desktop and start menu shortcuts (for GNU Octave and the MSYS-shell). | |||
For next builds, mxe-octave is already configured and all dependencies have been built so the only thing to do is to create a new '''"octave-<version>.tar.lz"''' and repeating the steps above. This should be much faster than the first run. If the new '''"octave-<version>.tar.lz"''' is not build and ignored, try the following: | |||
touch src/default-octave.mk | |||
If you've renamed '''"octave-<version>.tar.lz"''', be sure it matches with the package name in {{Path|src/default-octave.mk}}. | |||
=== | ===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. | |||
* 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: | |||
hg -v pull | |||
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]]. | |||
* 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. | |||
* 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. | |||
** 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.) | |||
=== | ===Troubleshooting=== | ||
* The error message displayed by <code>make</code> is simply the last lines of the log file. This may truncate the actual error message. Find the full error messages in the {{Path|<mxe-octave build>/log}} directory. | |||
* Sometimes running <code>make</code> a second time without changing anything will fix the problem. In particular, <code>autotools</code> rebuilds some files in the first call <code>make</code>, which may cause the second call of <code>make</code> to succeed. | |||
* If it is building Octave that failed, the source will be left in {{Path|<mxe-octave build>/tmp-default-octave}} and it is possible to run "configure && make" in that directory. | |||
* The configuration will be for the target system, not your own. In particular, if you have not installed all of the packages that mxe-octave installs, then your configuration will be different. However, some configuration variables will differ even if you have the same packages, and some compiler features may be available on the host system that are not available in cross-compile mode. | |||
* A possible causes for build failure is having files in your local source or build directory that are not listed in the {{Path|module.mk}} files; these are not copied into the dist archive. | |||
* 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== | ||
Microsoft provides several virtual machine (e.g. VirtualBox) disk images of MS Windows for about one month of testing | |||
* https://developer.microsoft.com/en-us/windows/downloads/virtual-machines | |||
* https://developer.microsoft.com/en-us/microsoft-edge/tools/vms (primarily meant for testing the MS-Edge browser) | |||
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 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. | |||
Some advantages: | |||
* No dedicated MS Windows machine or rebooting from Linux is needed; | |||
* The <strike>latest</strike> MS Windows 10 version is always available; | |||
* 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: | |||
* 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. | |||
* 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. | |||
==Footnotes== | |||
<references/> | |||
[[Category:Building]] | |||
[[Category:Microsoft Windows]] |
Latest revision as of 17:50, 19 April 2023
- 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.
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-octave (a fork of MXE). This means, the MS Windows installer is cross-compiled using a GNU/Linux system.
Creating the MS Windows Installer[edit]
General steps[edit]
- Reassure you have the package libffi-dev installed or the Python build will silently be incomplete
- Install the MXE build requirements.[1]
hg clone https://hg.octave.org/mxe-octave
[2]cd mxe-octave
./bootstrap
(Among other things, thebootstrap
script creates theconfigure
script for the next step.)./configure
make all nsis-installer
Step details[edit]
./configure
[edit]
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").
"w64" (recommended) | "w64-64" | "w32" |
---|---|---|
./configure \ --enable-devel-tools \ --enable-binary-packages \ --with-ccache \ --enable-octave=<octave version> |
./configure \ --enable-devel-tools \ --enable-binary-packages \ --with-ccache \ --enable-octave=<octave version> \ --enable-fortran-int64 |
./configure \ --enable-devel-tools \ --enable-binary-packages \ --with-ccache \ --enable-octave=<octave version> \ --disable-windows-64 |
The individual options have the following meaning (see also ./configure --help
):
--enable-devel-tools
: Include gdb and an MSYS shell in the binary.- If you seriously want to work with gdb, you need
--disable-strip-dist-files
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
--enable-binary-packages
: 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.--with-ccache
: The usage of ccache may speed up repetitive compilation drastically.--enable-octave=<octave version>
: Build a specific version of GNU Octave, which can be one of:release
use src/release-octave.mk, download and build the latest GNU Octave release.stable
ordefault
uses src/stable-octave.mk or src/default-octave.mk, respectively. This builds from a self-created distribution tarball from the "stable" or "default" development branch of GNU Octave. See below for details.
--disable-windows-64
: Build for 32-bit MS Windows.--enable-fortran-int64
: 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 for details.--disable-system-opengl
: Include software OpenGL libraries. This might help when working with buggy graphics card drivers, but might be slower than hardware accelerated rendering.--with-pkg-dir=../mxe-octave-pkg
: If you are working with several build trees, you can share a common package directory.
make
[edit]
- Use
make all 7z-dist
,make all tar-dist
ormake all zip-dist
instead ofmake all nsis-installer
if you want to build just an archive of the files to install on MS Windows instead of an installer wizard. - By default, packages will be built one at a time without parallelization. You may use
make JOBS=4
(choose a number other than 4 that is appropriate for your system) to build each individual package in parallel.- Avoid using the
-j
option formake
: Using-j
enables building packages in parallel, which can mess up the mxe build system. Use this option with care! Another pitfall is the examplemake -j4 JOBS=4
, which can result in as many as 16 jobs running at once.
- Avoid using the
- Include gdb in the installer by running
make gdb
before making thensis-installer
target.
Build installers for Octave development versions[edit]
- 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.
- Verify that Octave runs fine in Linux (for example using
make check
and by trying to run your build./run-octave --gui
). - Create a distribution archive called "octave-<version>.tar.lz" in the top build directory with
make dist-lzip DIST_IGNORE_HG_STATE=1
.lzip
needs to be available for this step. (On Debian-like systems, it can be installed withapt-get install lzip
). - Move or copy "octave-<version>.tar.lz" to the <mxe-octave build>/pkg folder (or create a symbolic link to it).
- Follow the general steps and ensure the configuration with either of
--enable-octave=stable
or--enable-octave=default
. - Move the final installer in <mxe-octave build>/dist to some Microsoft Windows machine (USB thumb drive, LAN copy, whatever) and install it "as usual". If you created an archive, using
make all 7z-dist
for example, you'll have to manually create the desktop and start menu shortcuts (for GNU Octave and the MSYS-shell).
For next builds, mxe-octave is already configured and all dependencies have been built so the only thing to do is to create a new "octave-<version>.tar.lz" and repeating the steps above. This should be much faster than the first run. If the new "octave-<version>.tar.lz" is not build and ignored, try the following:
touch src/default-octave.mk
If you've renamed "octave-<version>.tar.lz", be sure it matches with the package name in src/default-octave.mk.
Remarks[edit]
- 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 pkg directory using the configure flag
--with-pkg-dir=path_to_common_pkg_directory
. That way downloading the packages for each build tree can be avoided. Thus, potentially saving a lot of downloading bandwidth. - As of late December 2015, 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:
hg -v pull hg -v update
- However, some package updates might need a clean build tree. If an incremental build fails after an update, consider running
make clean
or starting with a fresh clone, see General steps. - In the mean time, you might want to regularly clean up <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.
- 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.
- Java include files for MS Windows. They should reside in <mxe-octave build dir>/usr/x86_64-w64-mingw32/include/java/win32 or <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.)
Troubleshooting[edit]
- The error message displayed by
make
is simply the last lines of the log file. This may truncate the actual error message. Find the full error messages in the <mxe-octave build>/log directory. - Sometimes running
make
a second time without changing anything will fix the problem. In particular,autotools
rebuilds some files in the first callmake
, which may cause the second call ofmake
to succeed. - If it is building Octave that failed, the source will be left in <mxe-octave build>/tmp-default-octave and it is possible to run "configure && make" in that directory.
- The configuration will be for the target system, not your own. In particular, if you have not installed all of the packages that mxe-octave installs, then your configuration will be different. However, some configuration variables will differ even if you have the same packages, and some compiler features may be available on the host system that are not available in cross-compile mode.
- A possible causes for build failure is having files in your local source or build directory that are not listed in the module.mk files; these are not copied into the dist archive.
- 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[edit]
Microsoft provides several virtual machine (e.g. VirtualBox) disk images of MS Windows for about one month of testing
- https://developer.microsoft.com/en-us/windows/downloads/virtual-machines
- https://developer.microsoft.com/en-us/microsoft-edge/tools/vms (primarily meant for testing the MS-Edge browser)
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 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 octave.vbs in the <mxe-octave build dir>/dist/octave subdirectory on the Linux side.
Some advantages:
- No dedicated MS Windows machine or rebooting from Linux is needed;
- The
latestMS Windows 10 version is always available; - 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:
- It is possible to adapt mxe-octave/binary-dist-rules.mk to have a consistent name for the <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 mxe-octave/binary-dist-rules.mk had a rule to create a symlink <mxe-octave build dir>/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.
Footnotes[edit]
- ↑ The requirements for each system are listed in the repository https://hg.octave.org/mxe-octave/file/tip/index.html. Start with the second step to read the index.html file on your local machine.
- ↑ Use
hg clone https://hg.octave.org/mxe-octave <name of mxe-octave build dir>
to choose another directory.