Difference between revisions of "Apertium on Mac OS X (Local)"

From Apertium
Jump to navigation Jump to search
(refactored)
Line 1: Line 1:
{{TOCD}}
{{TOCD}}


This page gives instructions on compiling Apertium on Mac OS X, it will presume you are installing into a directory called <code>Local</code> inside your home directory (your home directory will be in <code>/Users/<your user name></code>). This is slightly more complicated, but more contained.
This page gives instructions on compiling Apertium on Mac OS X, it will presume you are installing into a directory called <code>Local</code> inside your home directory (your home directory will be in <code>/Users/<your user name></code>). This is slightly more complicated than [[Apertium on Mac OS X (System)]], but more contained and doesn't require root.


==Preparation==
==Preparation==


First, we create the directories to hold our source and the installed binaries. Then we export these environment variables so that binaries and libraries from your local installation are taken before those from the system installation.
Install the [[Prerequisites for Mac OS X]].

Then


<pre>
<pre>
mkdir Local
$ pwd
$ mkdir Local
mkdir Source
PATH=$HOME/Local/bin/:$PATH
$ mkdir Source
export PATH
PKG_CONFIG_PATH=$HOME/Local/lib/pkgconfig
export PKG_CONFIG_PATH
LD_LIBRARY_PATH=$HOME/Local/lib
export LD_LIBRARY_PATH
cd Source
</pre>
</pre>


Also, put this in your ~/.bashrc so you don't have to paste it in every time you open a new terminal:
==Downloading==

<pre>
<pre>
PATH=$HOME/Local/bin/:$PATH
$ svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk/lttoolbox
export PATH
$ svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium
PKG_CONFIG_PATH=$HOME/Local/lib/pkgconfig
export PKG_CONFIG_PATH
LD_LIBRARY_PATH=$HOME/Local/lib
export LD_LIBRARY_PATH
</pre>
</pre>


1. Install the [[Prerequisites for Mac OS X]].
Then choose a language package and download it the same way, eg.
2. Follow [[Minimal installation from SVN]], using <code>$HOME/Local</code> as your $prefix.
<pre>
$ svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium-es-ca
</pre>


==Compiling==


First export these environment variables so that binaries and libraries from your local installation are taken before those from the system installation.

<pre>
$ export PATH=$HOME/Local/bin/:$PATH
$ export PKG_CONFIG_PATH=$HOME/Local/lib/pkgconfig
$ export LD_LIBRARY_PATH=$HOME/Local/lib
$ cd Source
</pre>

===lttoolbox===
<pre>
$ cd lttoolbox

$ sh autogen.sh --prefix=$HOME/Local/
$ make
$ make install
</pre>

===apertium===
<pre>
$ cd apertium

$ sh autogen.sh --prefix=$HOME/Local/
$ make
$ make install
</pre>

===apertium-es-ca===
<pre>
$ cd apertium-es-ca

$ sh autogen.sh --prefix=$HOME/Local/
$ make
$ make install
</pre>


==Troubleshooting==
==Troubleshooting==

Revision as of 07:46, 21 November 2013

This page gives instructions on compiling Apertium on Mac OS X, it will presume you are installing into a directory called Local inside your home directory (your home directory will be in /Users/<your user name>). This is slightly more complicated than Apertium on Mac OS X (System), but more contained and doesn't require root.

Preparation

First, we create the directories to hold our source and the installed binaries. Then we export these environment variables so that binaries and libraries from your local installation are taken before those from the system installation.

mkdir Local
mkdir Source
PATH=$HOME/Local/bin/:$PATH
export PATH
PKG_CONFIG_PATH=$HOME/Local/lib/pkgconfig
export PKG_CONFIG_PATH
LD_LIBRARY_PATH=$HOME/Local/lib
export LD_LIBRARY_PATH
cd Source

Also, put this in your ~/.bashrc so you don't have to paste it in every time you open a new terminal:

PATH=$HOME/Local/bin/:$PATH
export PATH
PKG_CONFIG_PATH=$HOME/Local/lib/pkgconfig
export PKG_CONFIG_PATH
LD_LIBRARY_PATH=$HOME/Local/lib
export LD_LIBRARY_PATH

1. Install the Prerequisites for Mac OS X. 2. Follow Minimal installation from SVN, using $HOME/Local as your $prefix.


Troubleshooting

Undefined macro #2

Problem
$ sh autogen.sh --prefix=$HOME/Local/
- libtoolize.
You should add the contents of `/usr/share/aclocal/libtool.m4' to `aclocal.m4'.
- aclocal.
- autoconf.
configure.ac:109: error: possibly undefined macro: dnl
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Solution

Re-run the autogen.sh command until it works.

syntax error near unexpected token

Problem

The configure script cannot find the PKG_CHECK_MODULES macro

checking for pkg-config... $HOME/Local/bin//pkg-config
./configure: line 19355: syntax error near unexpected token `LTTOOLBOX,'
./configure: line 19355: `PKG_CHECK_MODULES(LTTOOLBOX, dnl'

or

checking for gawk... (cached) awk
./configure: line 2183: syntax error near unexpected token `APERTIUM,'
./configure: line 2183: `  PKG_CHECK_MODULES(APERTIUM, apertium-1.0 >= 1.0.0,'
Solution

Run:

$ aclocal -I $HOME/Local/share/aclocal
$ automake -a
$ autoconf
$ autoheader
$ automake -a
$ ./configure --prefix=$HOME/Local/

You don't have cg-proc installed

Apertium for Welsh/Breton/Norwegian/Sámi/… now requires this constraint grammar package to help with disambiguation. For install instructions go here.

See also