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

From Apertium
Jump to navigation Jump to search
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{TOCD}}
{{TOCD}}
These instructions will help you install Apertium on a system running Mac OS/X.
These instructions will help you install Apertium on a system running Mac OS X. Use this page if you have root access to your system.


==Requirements==
==Requirements==
Line 9: Line 9:
$ sudo port install autoconf automake expat flex \
$ sudo port install autoconf automake expat flex \
gettext gperf help2man libiconv libtool \
gettext gperf help2man libiconv libtool \
libxml2 libxslt m4 ncurses ncursesw p5-locale-gettext \
libxml2 libxslt m4 ncurses p5-locale-gettext \
pcre perl5.8 pkgconfig zlib gawk
pcre perl5 pkgconfig zlib gawk subversion
</pre>
</pre>


(Some of them are necessary just because Macports wants it)
(Some of them are necessary just because Macports wants it)


You will also need to edit the file <code>~/.bash_profile</code> and add <code>/opt/local/bin</code> to the <code>PATH</code> variable. This can also be done each time from the command line as follows:


Note: you can now install both apertium and lttoolbox from Macports (<code>sudo port install lttoolbox apertium</code>), although this won't give you the very newest version. Not recommended if you want to do development.
<pre>
$ export PATH=/opt/local/bin:$PATH
</pre>

Note: you can now install both apertium and lttoolbox from Macports:
$ sudo port install lttoolbox apertium


==Downloading==
==Downloading==
Line 31: Line 25:
</pre>
</pre>


Then choose a language package.
Then choose a language package and download it the same way, eg.
<pre>
$ svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium-es-ca
</pre>


==Compilation==
==Compilation==
Line 38: Line 35:


<pre>
<pre>
$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ ./autogen.sh --prefix /opt/local
$ export PKG_CONFIG_PATH
$ make
$ ./autogen.sh
$ sudo make install
</pre>

If the above does not work, try:

<pre>
$ aclocal -I /opt/local/share/aclocal
$ glibtoolize --force
$ aclocal -I /opt/local/share/aclocal
$ automake -a
$ autoconf
$ autoheader
$ automake -a
$ ./configure --prefix=/opt/local/
$ make
$ make
$ sudo make install
$ sudo make install
Line 77: Line 61:


<pre>
<pre>
$ aclocal -I /opt/local/share/aclocal
$ aclocal -I /usr/local/share/aclocal
$ automake -a
$ automake -a
$ autoconf
$ autoconf
$ autoheader
$ autoheader
$ automake -a
$ automake -a
$ ./configure --prefix=/opt/local
$ ./configure
</pre>
</pre>


Line 93: Line 77:
; Solution
; Solution


Try installing <code>gawk</code>
Try installing <code>gawk</code> (<code>sudo port install gawk</code>)


===No package 'lttoolbox-3.2' found===
===No package 'lttoolbox-3.2' found===
Line 105: Line 89:
</pre>
</pre>
; Solution
; Solution
do
<pre>
<pre>
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
export PKG_CONFIG_PATH
</pre>
</pre>
before autogen.sh


===autogen/make "does not work"===
;Problem: some problem during autogen/make (what was the problem?)

;Solution:

<pre>
$ aclocal -I /usr/local/share/aclocal
$ glibtoolize --force
$ aclocal -I /usr/local/share/aclocal
$ automake -a
$ autoconf
$ autoheader
$ automake -a
$ ./configure --prefix=/usr/local/
$ make
$ sudo make install
</pre>
===endian_double_util.cc:38: error: ‘fread_unlocked’ was not declared in this scope===
===endian_double_util.cc:38: error: ‘fread_unlocked’ was not declared in this scope===
Just change the code to use fread instead of fread_unlocked (the latter is just faster).
Just change the code to use fread instead of fread_unlocked (the latter is just faster).
Line 124: Line 127:
[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Installation]]
[[Category:Installation]]
[[Category:Documentation in English]]

Revision as of 15:41, 22 August 2012

These instructions will help you install Apertium on a system running Mac OS X. Use this page if you have root access to your system.

Requirements

The requirements are a full installation of XCode (http://developer.apple.com/tools/xcode/) and Macports (http://www.macports.org/install.php). Then install with Macports the following packages:

$ sudo port install autoconf automake expat flex \
gettext gperf help2man libiconv libtool \
libxml2 libxslt m4 ncurses p5-locale-gettext \
pcre perl5 pkgconfig zlib gawk subversion

(Some of them are necessary just because Macports wants it)


Note: you can now install both apertium and lttoolbox from Macports (sudo port install lttoolbox apertium), although this won't give you the very newest version. Not recommended if you want to do development.

Downloading

$ svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk/lttoolbox
$ svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium

Then choose a language package and download it the same way, eg.

$ svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium-es-ca

Compilation

For each package (i.e., within their directories lttoolbox, etc.), lttoolbox, apertium and a language package, do:

$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ export PKG_CONFIG_PATH
$ ./autogen.sh
$ make
$ sudo make install

Troubleshooting

syntax error near unexpected token

Problem

The configure script cannot find the PKG_CHECK_MODULES macro

checking for pcre_compile in -lpcrecpp... yes
./configure: line 19995: syntax error near unexpected token `APERTIUM,'
./configure: line 19995: `PKG_CHECK_MODULES(APERTIUM, dnl'
Solution

Run:

$ aclocal -I /usr/local/share/aclocal
$ automake -a
$ autoconf
$ autoheader
$ automake -a
$ ./configure 

modes not generated

Problem

Everything works fine except the .mode files aren't being generated.

Solution

Try installing gawk (sudo port install gawk)

No package 'lttoolbox-3.2' found

Problem
No package 'lttoolbox-3.2' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Solution

do

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

before autogen.sh

autogen/make "does not work"

Problem
some problem during autogen/make (what was the problem?)
Solution
$ aclocal -I /usr/local/share/aclocal
$ glibtoolize --force
$ aclocal -I /usr/local/share/aclocal
$ automake -a
$ autoconf
$ autoheader
$ automake -a
$ ./configure --prefix=/usr/local/
$ make
$ sudo make install

endian_double_util.cc:38: error: ‘fread_unlocked’ was not declared in this scope

Just change the code to use fread instead of fread_unlocked (the latter is just faster).

Or, do this when compiling:

CPPFLAGS=" -Dfread_unlocked=fread " ./autogen.sh && make && sudo make install

See also