Talk:Build from source: Difference between revisions

Jump to navigation Jump to search
 
(11 intermediate revisions by one other user not shown)
Line 57: Line 57:


====Build tools====
====Build tools====
The following is lifted from the manual ([http://www.gnu.org/software/octave/doc/interpreter/Build-Tools.html G.1.2]) and [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING etc/HACKING] the 2013-06-14, if the current date is much different and your build fails because of missing requirements, please follow the links and see if they have been updated.
The following is lifted from the manual ([http://www.gnu.org/software/octave/doc/interpreter/Build-Tools.html G.1.2]) and [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING etc/HACKING] the '''2013-06-14''', if the current date is much different and your build fails because of missing requirements, please follow the links and see if they have been updated.


The following tools are required:  
The following tools are required:  
C++, C, and Fortran compilers
 
The Octave sources are primarily written in C++, but some portions are also written in C and Fortran. The Octave sources are intended to be portable. Recent versions of the GNU compiler collection (GCC) should work (http://gcc.gnu.org). If you use GCC, you should avoid mixing versions. For example, be sure that you are not using the obsolete g77 Fortran compiler with modern versions of gcc and g++.  
{| class="wikitable"
GNU Make
|'''C++, C, and Fortran compilers'''|| The Octave sources are primarily written in C++, but some portions are also written in C and Fortran. The Octave sources are intended to be portable. Recent versions of the GNU compiler collection (GCC) should work (http://gcc.gnu.org). If you use GCC, you should avoid mixing versions. For example, be sure that you are not using the obsolete g77 Fortran compiler with modern versions of gcc and g++.  
Tool for building software (http://www.gnu.org/software/make). Octave's build system requires GNU Make. Other versions of Make will not work. Fortunately, GNU Make is highly portable and easy to install.  
|-
AWK, sed, and other Unix utilities
|'''GNU Make'''||Tool for building software (http://www.gnu.org/software/make). Octave's build system requires GNU Make. Other versions of Make will not work. Fortunately, GNU Make is highly portable and easy to install.  
Basic Unix system utilities are required for building Octave. All will be available with any modern Unix system and also on Windows with either Cygwin or MinGW and MSYS.  
|-
|'''AWK, sed, and other Unix utilities'''||Basic Unix system utilities are required for building Octave. All will be available with any modern Unix system and also on Windows with either Cygwin or MinGW and MSYS.  
|}


Additionally, the following tools may be needed:  
Additionally, the following tools may be needed:  
Bison
 
Parser generator (http://www.gnu.org/software/bison). You will need Bison if you modify the oct-parse.yy source file or if you delete the files that are generated from it.  
{| class="wikitable"
Flex
|'''Bison'''||Parser generator (http://www.gnu.org/software/bison). You will need Bison if you modify the oct-parse.yy source file or if you delete the files that are generated from it.  
Lexer analyzer (http://www.gnu.org/software/flex). You will need Flex if you modify the lex.ll source file or if you delete the files that are generated from it.  
|-
Autoconf
|'''Flex'''||Lexer analyzer (http://www.gnu.org/software/flex). You will need Flex if you modify the lex.ll source file or if you delete the files that are generated from it.  
Package for software configuration (http://www.gnu.org/software/autoconf). Autoconf is required if you modify Octave's configure.ac file or other files that it requires.  
|-
Automake
|'''Autoconf'''||Package for software configuration (http://www.gnu.org/software/autoconf). Autoconf is required if you modify Octave's configure.ac file or other files that it requires.  
Package for Makefile generation (http://www.gnu.org/software/automake). Automake is required if you modify Octave's Makefile.am files or other files that they depend on.  
|-
Libtool
|'''Automake'''||Package for Makefile generation (http://www.gnu.org/software/automake). Automake is required if you modify Octave's Makefile.am files or other files that they depend on.  
Package for building software libraries (http://www.gnu.org/software/libtool). Libtool is required by Automake.
|-
|'''Libtool'''||Package for building software libraries (http://www.gnu.org/software/libtool). Libtool is required by Automake.
|-
|'''Gnulib'''||<http://www.gnu.org/software/gnulib/>
|-
|'''gperf'''||<http://www.gnu.org/software/gperf/>
|-
|'''Gzip'''||<http://www.gnu.org/software/gzip/>
|-
|'''Mercurial'''||<http://mercurial.selenic.com/>
|-
|'''Perl'''||<http://www.cpan.org/>
|-
|'''Rsync'''||<http://samba.anu.edu.au/rsync/>
|-
|'''Tar'''||<http://www.gnu.org/software/tar/>
|}


===Run the bootstrap script===
===Run the bootstrap script===
The following are abridged instructiongs from etc/HACKING.
After cloning Octave, you will need to run the bootstrap script:
$ ./bootstrap
Running this script will result in the creation of the configure script.
The bootstrap script comes from gnulib, but is kept in the Octave source archive.
It should be updated from the gnulib sources as necessary.
If you have a copy of gnulib in some directory apart from the Octave
source tree, then pass the name of the directory containing gnulib-tool
to the bootstrap script using the option:
--gnulib-srcdir=DIRNAME
Additional options besides --gnulib-srcdir can be passed to bootstrap and
they will be forwarded without modification to the gnulib bootstrap script.
Once the bootstrap script completes successfully, you may configure and
build Octave.


===Configure the build===
===Configure the build===
It is very recommended that you build Octave in a separate directory tree from the sources. 
For convenience we recommend a subdirectory to the main octave directory.
For example, after you finished running the bootstrap script (takes a few seconds), run the
following commands to create a build tree, configure, and build Octave:
$ mkdir octave_build_directory
$ cd octave_build_directory
$ ../configure
configure takes many command line arguments that allow some customization of the resulting makefile, and they are detailed in the [http://www.gnu.org/software/octave/doc/interpreter/Running-Configure-and-Make.html manual].
Running configure will take about half a minute. After it's finished, and if you are satisfied with the result, just run make
$ make
Building octave will take something on the scale of hours,
the exact amount depending on if the programmers or cpu engineers are ahead in the eternal race of performance versus cruft.
The best thing to do is to leave it over lunch, or possibly overnight if it's late. You probably should sleep more anyway Jonathan.


====Build dependencies====
====Build dependencies====
The [http://www.gnu.org/software/octave/doc/interpreter/External-Packages.html manual] lists the following as required packages:
{| class="wikitable"
|'''BLAS'''|| Basic Linear Algebra Subroutine library (http://www.netlib.org/blas). Accelerated BLAS libraries such as ATLAS (http://math-atlas.sourceforge.net) are recommeded for better performance.
|-
|'''LAPACK'''||Linear Algebra Package (http://www.netlib.org/lapack).
|-
|'''PCRE'''||The Perl Compatible Regular Expression library (http://www.pcre.org).
|-
|'''GNU Readline'''||Command-line editing library (www.gnu.org/s/readline). Readline is technically optional, but it is strongly recommended.
|}
Beyond these, there are several more optional dependencies that configure will complain about, look in the [http://www.gnu.org/software/octave/doc/interpreter/External-Packages.html manual] for the complete list. If you are installing the dependencies with synaptic, you need to get the development versions of the libraries or configure will not find them.


===Run make===
===Run make===
You will need a recent version of GNU Make as Octave relies on certain features not generally available in all versions of make. Octave requires approximately 1.4 GB of disk storage to unpack and compile from source (significantly less, 400 MB, if you don't compile with debugging symbols). To compile without debugging symbols try the command
$ make CFLAGS=-O CXXFLAGS=-O LDFLAGS=
If you encounter errors while compiling Octave, first search the web to see if there is a workaround or solution for your problem. If not, see [http://www.gnu.org/software/octave/doc/interpreter/Reporting-Bugs.html Trouble], for information about how to report bugs.
Once you have successfully compiled Octave, run
$ make install
This will install a copy of Octave, its libraries, and its documentation in the destination directory. As distributed, Octave is installed in the following directories. In the table below, prefix defaults to /usr/local, version stands for the current version number of the interpreter, and arch is the type of computer on which Octave is installed (for example, ‘i586-unknown-gnu’).
{| class="wikitable"
|'''prefix/bin'''|| Octave and other binaries that people will want to run directly.
|-
|'''prefix/lib/octave-version'''||Libraries like libcruft.a and liboctave.a.
|-
|'''prefix/octave-version/include/octave'''||Include files distributed with Octave.
|-
|'''prefix/share'''||Architecture-independent data files.
|-
|'''prefix/share/man/man'''||Unix-style man pages describing Octave.
|-
|'''prefix/share/info'''||Info files describing Octave.
|-
|'''prefix/share/octave/version/m'''||Function files distributed with Octave. This includes the Octave version, so that multiple versions of Octave may be installed at the same time.
|-
|'''prefix/libexec/octave/version/exec/arch'''||Executables to be run by Octave rather than the user.
|-
|'''prefix/lib/octave/version/oct/arch'''||Object files that will be dynamically loaded.
|-
|'''prefix/share/octave/version/imagelib'''||Image files that are distributed with Octave.
|}
Anonymous user

Navigation menu