1,847
edits
m (Use internal wiki link for MXE.) |
|||
(10 intermediate revisions by 7 users not shown) | |||
Line 2: | Line 2: | ||
GNU Octave is primarily developed on GNU/Linux and other POSIX conformal systems. There have been many efforts in the past to build ports of GNU Octave for Windows. Take a look at the various ports of Octave available for Windows [http://wiki.octave.org/Octave_for_Windows here]. | GNU Octave is primarily developed on GNU/Linux and other POSIX conformal systems. There have been many efforts in the past to build ports of GNU Octave for Windows. Take a look at the various ports of Octave available for Windows [http://wiki.octave.org/Octave_for_Windows here]. | ||
Recently some work has been done in maintaining a unified build system [ | Recently some work has been done in maintaining a unified build system [[MXE|'''mxe-octave''']] (a fork of [http://mxe.cc/ MXE]) which anyone can use to produce cross as well as native builds of GNU Octave for Windows and Mac OS X platforms. This page contains instructions about creating a Windows installer using mxe-octave. | ||
==Steps to create Windows Installer== | ==Steps to create Windows Installer== | ||
Line 9: | Line 9: | ||
# <code>hg clone http://hg.octave.org/mxe-octave/</code> | # <code>hg clone http://hg.octave.org/mxe-octave/</code> | ||
# <code>cd mxe-octave</code> | # <code>cd mxe-octave</code> | ||
# <code> | # <code>./bootstrap</code> | ||
# <code>./configure</code> | # <code>./configure</code> | ||
# <code>make nsis-installer</code> | # <code>make all nsis-installer</code> | ||
===Tweaks=== | ===Tweaks=== | ||
* Use <code>make tar-dist</code> or <code>make zip-dist</code> instead of <code>nsis-installer</code> if you want to build just an archive of the files to install on 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, 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. | * 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. | ||
* Use <code>./configure --disable-strip-dist-files</code> if you want to keep debug symbols in the installed binaries for debugging on Windows. | * Use <code>./configure --disable-strip-dist-files</code> if you want 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. | ||
* 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. | ||
Line 29: | Line 29: | ||
====Step 1: Prepare mxe-octave==== | ====Step 1: Prepare mxe-octave==== | ||
Clone the mxe-octave | Clone the mxe-octave repo to some directory of your choice: | ||
http://hg | http://hg.octave.org/mxe-octave <name of mxe-octave build dir> | ||
where <name of mxe-octave build dir> is some other name than just the default "mxe-octave". | where <name of mxe-octave build dir> is some other name than just the default "mxe-octave". | ||
Once downloaded, go into the <name of mxe-octave build dir> subdir and do: | Once downloaded, go into the <name of mxe-octave build dir> subdir and do: | ||
. | ./bootstrap | ||
./configure <options you want> | ./configure <options you want> | ||
make nsis-installer JOBS=<some number> | make all nsis-installer JOBS=<some number> | ||
Your author usually has "--enable-devel-tools | Your author usually has "--enable-devel-tools --enable-octave=default --enable-binary-packages --enable-ccache" as configure options and use JOBS=7 on my core i5 system. | ||
* | For stable branch it is "--enable-devel-tools --enable-octave=stable --enable-binary-packages --enable-64 --enable-fortran-int64 --enable-ccache" or "--enable-devel-tools --enable-octave=stable --enable-binary-packages --enable-windows64 --enable-ccache" | ||
* | * The first configure option also includes gdb and an MSYS shell in the binary. | ||
* | * The second avoids the ~700 MB max. array size limit for 32-bit executables but Octave will only run on 64-bit Windows (most Windows systems are 64 bit anyway these days). Note: this option does NOT imply 64-bit indexing. | ||
* the fourth option cross-compiles the binary modules in Octave-Forge packages, which | * The third option is just for a placeholder; it'll invoke src/default-octave.mk (one of the three octave .mk files in mxe: src/stable-octave.mk and src/octave.mk, corresponding to the "--enable-octave=" configure option), I found that octave.mk lags a bit behind | ||
* the fourth option cross-compiles the binary modules in Octave-Forge packages, which will save time when installing them once in Windows. | |||
If you seriously want to work with gdb, also have --disable-strip-dist-files as configure option. However, in that case chances are that you cannot build an .exe installer anymore as it becomes too big for NSIS (that has a 2 GB installer file size limit) so instead of "make nsis-installer" you'll need to invoke | If you seriously want to work with gdb, also have --disable-strip-dist-files as configure option. However, in that case chances are that you cannot build an .exe installer anymore as it becomes too big for NSIS (that has a 2 GB installer file size limit) so instead of "make nsis-installer" you'll need to invoke | ||
make zip-dist <options> | make zip-dist <options> | ||
Line 51: | Line 52: | ||
====Step 2: To build your first Octave-for Windows development version:==== | ====Step 2: To build your first Octave-for Windows development version:==== | ||
* build Octave on Linux (in separate source and build trees) including your favorite mods and patches. | * build Octave on Linux (in separate source and build trees) including your favorite mods and patches. | ||
* once Octave runs fine in Linux (using make check and trying your mods using ./run-octave & from the build dir, all of this still on the Linux side), do: | * once Octave runs fine in Linux (using make check and trying your mods using ./run-octave --gui & from the build dir, all of this still on the Linux side), do: | ||
make | <code>make dist-lzip DIST_IGNORE_HG_STATE=1</code> | ||
* This will produce a dist archive called "octave-<version>.tar. | * This will produce a dist archive called "octave-<version>.tar.lz" in the top build directory. Move or copy this dist archive to the <mxe-octave build>/pkg folder (or symlink to it from there) | ||
Note that this step requires the Octave be configured with Java (i.e., you need javac and jar on your system). | Note that this step requires the Octave be configured with Java (i.e., you need javac and jar on your system). | ||
{{Note|If you skip this step, mxe-octave will build using the source available from from the [http://hydra.nixos.org/job/gnu/octave-default/tarball/latest/download hydra site]. | |||
This archive is always slightly behind the latest development branch of the source repository and is missing the metadata that indicates which Mercurial revision it was built from.}} | |||
==== Step 3: Building the Octave installer==== | ==== Step 3: Building the Octave installer==== | ||
* be sure to adapt <mxe-octave build>/src/default-octave.mk to read "## No Checksum" at the $(PKG)_CHECKSUM line and | * be sure to adapt <mxe-octave build>/src/default-octave.mk to read "## No Checksum" at the $(PKG)_CHECKSUM line and check octave version and archive type (tar.lz rather than tar.bz2). The checksum is only needed when you download a dist archive from the Internet, not so much when you copy it within your own home network, let alone your own computer. | ||
* check if in the top of the main Makefile "default-octave" is mentioned for OCTAVE_TARGET rather than "stable-octave" of just "octave" (that name refers to the .mk filename in the src folder). | * check if in the top of the main Makefile "default-octave" is mentioned for OCTAVE_TARGET rather than "stable-octave" of just "octave" (that name refers to the .mk filename in the src folder). | ||
* ... and then run (in the <mxe-octave build> folder) | * ... and then run (in the <mxe-octave build> folder) | ||
make nsis-installer <options> | make all nsis-installer <options> | ||
-or- | -or- | ||
make | make all 7z-dist <options> | ||
====Step 3A (second and later builds)==== | ====Step 3A (second and later builds)==== | ||
For next builds, mxe-octave is already configured and all dependencies have been built so the only thing to do is having a new Octave version + installer built: | For next builds, mxe-octave is already configured and all dependencies have been built so the only thing to do is having a new Octave version + installer built: | ||
Line 70: | Line 75: | ||
(to be sure mxe-octave picks up the new Octave archive). If you've renamed the dist archive, be sure it matches with the package name in src/default-octave.mk. | (to be sure mxe-octave picks up the new Octave archive). If you've renamed the dist archive, be sure it matches with the package name in src/default-octave.mk. | ||
Then do: | Then do: | ||
make nsis-installer | make all nsis-installer | ||
-or- | -or- | ||
make | make all 7z-dist | ||
====Step 4: Install on Windows==== | ====Step 4: Install on Windows==== | ||
* move the installer in <mxe-octave build>/dist/ to the Windows side (USB thumb drive, LAN copy, whatever). | * move the installer in <mxe-octave build>/dist/ to the Windows side (USB thumb drive, LAN copy, whatever). | ||
* install it there. | * install it there. | ||
If you've made a | If you've made a 7z-dist you'll have to manually create the desktop and Start Menu shortcuts (for octave and the MSYS-shell). | ||
====Remarks==== | ====Remarks==== | ||
Line 85: | Line 90: | ||
hg -v update | hg -v update | ||
* 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 a la Step 1. | * 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 a la Step 1. | ||
* In the mean time, regularly clean up <mxe-octave build>/log to save disk space. After a first successful build there's no more use for the log subdirs for each package, so you can wipe them all. | * In the mean time, regularly clean up <mxe-octave build>/log to save disk space. After a first successful build there's no more use for the log subdirs for each package, so you can wipe them all. | ||
Line 118: | Line 119: | ||
If you are using Ubuntu, then you can do <code>apt-get install foo</code> instead of <code>aptitude install -R foo</code>. | If you are using Ubuntu, then you can do <code>apt-get install foo</code> instead of <code>aptitude install -R foo</code>. | ||
On a | On a fresh Linux Mint 16 x86_64, in addition to the above also install: | ||
sudo apt-get install libc6-dev-i386 gcc-multilib libgmp3-dev libmpfr4 libmpfr-dev | sudo apt-get install libc6-dev-i386 gcc-multilib libgmp3-dev libmpfr4 libmpfr-dev | ||
Line 203: | Line 204: | ||
==Creating an NSIS based installer== | ==Creating an NSIS based installer== | ||
The <code>make nsis-installer</code> command produces a NSIS installer that is ready to be distributed. | The <code>make nsis-installer</code> command produces a NSIS installer that is ready to be distributed. | ||
==Trying out cross-built Octave on Linux through VirtualBox== | |||
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. | |||
There are several advantages: | |||
* Rebooting from Linux to Windows isn't needed; | |||
* 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. | |||
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. | |||
Then: | |||
* Either install (or unpack) Octave into Windows 10, or | |||
* Create a shortcut to octave.vbs in the dist/octave subdir on Linux. | |||
Hints: | |||
* 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 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. | |||
[[Category:Packaging]] | [[Category:Packaging]] |