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

From Apertium
Jump to navigation Jump to search
(add link to updated instructions)
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
  +
[[Installation locale sur Mac OS X|En français]]
{{TOCD}}
 
   
  +
<div style="background-color:pink; text-align:center; line-height:2.5; border: 1px solid crimson;">Are you sure this is the page you want?<br/>If not, you probably actually want [[Apertium_on_Mac_OS_X]]<br/>If you're here because the instructions on that page didn't work for you, log on to [[IRC]] and describe what went wrong.</div>
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. Please replace <code>spectie</code> with the name of your user. You can find the name of your user by typing <code>whoami</code>.
 
   
==Preparation==
 
   
  +
{{TOCD}}
First you need a '''full installation of XCode (http://developer.apple.com/tools/xcode/)''' and '''Macports (http://www.macports.org/install.php)'''.
 
   
  +
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.
The following packages from MacPorts are required:
 
   
  +
==The procedure==
<pre>
 
$ sudo port install autoconf automake expat flex \
 
gettext gperf help2man libiconv libtool \
 
libxml2 libxslt m4 ncurses ncursesw p5-locale-gettext \
 
pcre perl5.8 pkgconfig zlib gawk svn
 
</pre>
 
   
  +
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.
(Some of these are necessary just because Macports wants them.)
 
 
Then continue...
 
   
 
<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>
   
  +
Now the standard steps:
==Compiling==
 
  +
# Install the [[Prerequisites for Mac OS X]].
 
  +
# Follow [[Install Apertium core by compiling]], using <code>$HOME/Local</code> as your $prefix.
First export these environment variables so that binaries and libraries from your local installation are taken before those from the system installation.
 
  +
# See [[Installation_troubleshooting]] if you have problems.
 
<pre>
 
$ export PATH=/Users/spectie/Local/bin/:$PATH
 
$ export PKG_CONFIG_PATH=/Users/spectie/Local/lib/pkgconfig
 
$ export LD_LIBRARY_PATH=/Users/spectie/Local/lib
 
$ cd Source
 
</pre>
 
 
===lttoolbox===
 
<pre>
 
$ cd lttoolbox
 
 
$ sh autogen.sh --prefix=/Users/spectie/Local/
 
$ make
 
$ make install
 
</pre>
 
 
===apertium===
 
<pre>
 
$ cd apertium
 
 
$ sh autogen.sh --prefix=/Users/spectie/Local/
 
$ make
 
$ make install
 
</pre>
 
 
==Troubleshooting==
 
 
===Undefined macro #1===
 
 
; Problem
 
 
The <code>autogen.sh</code> script complains about an undefined macro when encountering the <code>dnl</code> (comment) string.
 
 
<pre>
 
configure.ac:112: error: possibly undefined macro: dnl
 
If this token and others are legitimate, please use m4_pattern_allow.
 
See the Autoconf documentation.
 
</pre>
 
 
; Solution
 
 
Run <code>automake -a</code> then <code>autoconf</code>, then <code>autoheader</code>, then <code>./configure --prefix=/Users/spectie/Local/</code>.
 
 
===Undefined macro #2===
 
 
;Problem
 
 
<pre>
 
$ sh autogen.sh --prefix=/Users/spectie/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.
 
</pre>
 
 
;Solution
 
 
Re-run the <code>autogen.sh</code> command until it works.
 
 
===syntax error near unexpected token===
 
 
; Problem
 
 
The <code>configure</code> script cannot find the <code>PKG_CHECK_MODULES</code> macro
 
 
<pre>
 
checking for pkg-config... /Users/spectie/Local/bin//pkg-config
 
./configure: line 19355: syntax error near unexpected token `LTTOOLBOX,'
 
./configure: line 19355: `PKG_CHECK_MODULES(LTTOOLBOX, dnl'
 
</pre>
 
 
or
 
 
<pre>
 
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,'
 
</pre>
 
 
;Solution
 
 
Run:
 
 
<pre>
 
$ aclocal -I /Users/spectie/Local/share/aclocal
 
$ automake -a
 
$ autoconf
 
$ autoheader
 
$ automake -a
 
$ ./configure --prefix=/Users/spectie/Local/
 
</pre>
 
 
===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 [http://wiki.apertium.org/wiki/Apertium_and_Constraint_Grammar#Installing_VISL_CG3 here].
 
   
 
== See also==
 
== See also==
Line 142: Line 45:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Installation]]
 
[[Category:Installation]]
  +
[[Category:Documentation in English]]

Latest revision as of 19:35, 12 May 2019

En français

Are you sure this is the page you want?
If not, you probably actually want Apertium_on_Mac_OS_X
If you're here because the instructions on that page didn't work for you, log on to IRC and describe what went wrong.


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.

The procedure[edit]

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

Now the standard steps:

  1. Install the Prerequisites for Mac OS X.
  2. Follow Install Apertium core by compiling, using $HOME/Local as your $prefix.
  3. See Installation_troubleshooting if you have problems.

See also[edit]