MXE: Difference between revisions

From Octave
Jump to navigation Jump to search
(Run bootstrap script)
(Updating config options according to https://octave.1599824.n4.nabble.com/mxe-octave-status-td4685260.html.)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
Based on the [http://mxe.cc/ MXE] project there is an [http://hg.octave.org/mxe-octave MXE-Octave] fork available to allow cross compiling Octave to various target systems.
[https://hg.octave.org/mxe-octave MXE-Octave] was forked 2012 from the [https://mxe.cc/ MXE project] and is useful for building Octave in the following scenarios<ref>[https://hg.octave.org/mxe-octave/file/6836b2f08479/README MXE-Octave README] text by [[User:jwe|jwe]].</ref>:


=== Examples of compiling Octave for different platforms ===
# Cross-compilation for MS Windows (see also [[Windows Installer]]) and other platforms.
# Building Octave on outdated Linux systems (e.g. only an old GCC version is available).
# Building Octave without root permission.


* '''Compiling for Windows'''
{{Warning|MXE-Octave is '''not''' the best choice for building Octave, if your system already provides recent versions of GCC and other required build dependencies. See [[:Category:Installation]] for other install options.}}
# There is some further information for using mxe-octave to build an Windows installer here: [[Windows_Installer]].


MXE-Octave is really intended to be used to cross compile Octave along with all dependencies for Windows systems.  It may also be used to do native builds on Windows if you have a minimal set of MinGW tools installed, or to do native builds on Linux systems.  However, it was really only intended as a way to build Octave on systems that lack sufficiently recent versions of tools and libraries to build Octave.
=== Example of compiling MXE-Octave ===


'''For systems that provide packages of recent versions of GCC and required build dependencies, MXE-Octave is NOT the best choice for building Octave.'''
==== Preparation ====


* '''Compiling for your Linux system'''
# [[Windows_Installer#Installing_requirements_of_MXE_Octave|Install all requirements of MXE Octave]].
# Download [http://hg.octave.org/mxe-octave MXE-Octave] as a compressed file.
# Decide for an installation directory (e.g. {{path|~/mxe-octave}}).
# Unpack it in ~ or somewhere suitable.
# <code>cd ~</code>
# Check you have all the [http://mxe.cc/#requirements requirements], gfortran and libgl2ps-dev.
# <code>hg clone https://hg.octave.org/mxe-octave mxe-octave</code>
# cd into the directory (called ~/mxe-octave-123456789 or similiar).
# <code>cd mxe-octave</code>
# Type: ./bootstrap
# <code>./bootstrap</code>
# Type: ./configure --enable-64 --enable-native-build --enable-pic-flag host_alias=gnu-linux --enable-openblas --enable-jit
# Type: make
# Type: make openblas
# cd usr/lib
# mv libblas.so libblas.so.reference
# ln -s libopenblas.so libblas.so
# Octave will exist in ~/mxe-octave-123456789/usr/bin
# Add to your .bashrc file: alias octave=~/mxe-octave-123456789/usr/bin/octave


It's that easy...
==== Configuration ====


* '''Compiling for your Ubuntu Desktop x64 Linux (tested for 14.xx)'''
For a comprehensive list of configuration options with a short explanation, type <code>./configure --help</code>. See also the [[#Known issues|known issues]] below.
# In Ubuntu Desktop Linux 14.10 the above recipe fails during building BLAS library ...
# I have found a working solution how to build Octave 3.8.2 with ---enable-64 in Ubuntu Desktop Linux - see:
# BLOG: http://calaba.tumblr.com/post/107087607479/octave-64
# GitHub: https://github.com/calaba/octave-3.8.2-enable-64-ubuntu-14.04


* '''Compiling for a different Linux system'''
<syntaxhighlight lang="text">
# ...
./configure \
    --prefix=$HOME/mxe-octave \
    --enable-native-build \
    --enable-octave=release \
    --enable-64 \
    --enable-binary-packages \
    --enable-devel-tools \
    --enable-fortran-int64 \
    --enable-lib64-directory \
    --enable-openblas \
    --enable-pic-flag \
    --disable-system-fontconfig \
    --disable-system-gcc \
    --disable-system-opengl \
    --disable-system-x11-libs \
    --with-ccache \
    gnu-linux
</syntaxhighlight>


=== Packaging for distribution ===
==== Build ====


<code>make -j3 JOBS=2 all openblas</code> Adapt the values of the variables <code>-j</code> (parallel package builds) and <code>JOBS</code> (parallel build jobs) to your needs.


=== Note for gnuplot ===
==== Replace reference BLAS by OpenBLAS ====


In general using the [https://www.openblas.net/ OpenBLAS] library results in faster matrix-vector operations compared to the reference BLAS library.


[[Category:Building]]
# <code>cd ~/mxe-octave/usr/lib</code>
The gnuplot built by mxe-octave does not support cairo based terminals and lua/tikz terminals.
# <code>mv libblas.so libblas.so.reference</code>
If you want uses those feature, prepare gnuplot with those features and points its location setting to
# <code>ln -s libopenblas.so libblas.so</code>
"gnuplot_binary" like
 
==== Run ====
 
# MXE-Octave will exist in {{path|~/mxe-octave/usr/bin}}
# Add the command <code>octave</code> as alias to your {{path|.bashrc}} file: <code>alias octave=~/mxe-octave/usr/bin/octave</code>
# Start MXE-Octave by typing <code>octave</code>.
 
=== Known issues ===
 
==== gnuplot ====
 
The gnuplot built by MXE-Octave does not support cairo based terminals and lua/tikz terminals.
If you want uses those features, prepare gnuplot with those features and type in the Octave command prompt


   >> gnuplot_binary /usr/bin/gnuplot
   >> gnuplot_binary /usr/bin/gnuplot
==== Build errors on older systems ====
On some older systems, it might be useful to consider adding the configuration options
* <code>--disable-docs</code>
* <code>--disable-java</code>
in case of building errors.
=== References ===
<references/>
[[Category:Building]]

Latest revision as of 06:39, 10 August 2019

MXE-Octave was forked 2012 from the MXE project and is useful for building Octave in the following scenarios[1]:

  1. Cross-compilation for MS Windows (see also Windows Installer) and other platforms.
  2. Building Octave on outdated Linux systems (e.g. only an old GCC version is available).
  3. Building Octave without root permission.
Warning icon.svg
MXE-Octave is not the best choice for building Octave, if your system already provides recent versions of GCC and other required build dependencies. See Category:Installation for other install options.

Example of compiling MXE-Octave[edit]

Preparation[edit]

  1. Install all requirements of MXE Octave.
  2. Decide for an installation directory (e.g. ~/mxe-octave).
  3. cd ~
  4. hg clone https://hg.octave.org/mxe-octave mxe-octave
  5. cd mxe-octave
  6. ./bootstrap

Configuration[edit]

For a comprehensive list of configuration options with a short explanation, type ./configure --help. See also the known issues below.

./configure \
    --prefix=$HOME/mxe-octave \
    --enable-native-build \
    --enable-octave=release \
    --enable-64 \
    --enable-binary-packages \
    --enable-devel-tools \
    --enable-fortran-int64 \
    --enable-lib64-directory \
    --enable-openblas \
    --enable-pic-flag \
    --disable-system-fontconfig \
    --disable-system-gcc \
    --disable-system-opengl \
    --disable-system-x11-libs \
    --with-ccache \
    gnu-linux

Build[edit]

make -j3 JOBS=2 all openblas Adapt the values of the variables -j (parallel package builds) and JOBS (parallel build jobs) to your needs.

Replace reference BLAS by OpenBLAS[edit]

In general using the OpenBLAS library results in faster matrix-vector operations compared to the reference BLAS library.

  1. cd ~/mxe-octave/usr/lib
  2. mv libblas.so libblas.so.reference
  3. ln -s libopenblas.so libblas.so

Run[edit]

  1. MXE-Octave will exist in ~/mxe-octave/usr/bin
  2. Add the command octave as alias to your .bashrc file: alias octave=~/mxe-octave/usr/bin/octave
  3. Start MXE-Octave by typing octave.

Known issues[edit]

gnuplot[edit]

The gnuplot built by MXE-Octave does not support cairo based terminals and lua/tikz terminals. If you want uses those features, prepare gnuplot with those features and type in the Octave command prompt

 >> gnuplot_binary /usr/bin/gnuplot

Build errors on older systems[edit]

On some older systems, it might be useful to consider adding the configuration options

  • --disable-docs
  • --disable-java

in case of building errors.


References[edit]