Installation troubleshooting

From Apertium
Jump to navigation Jump to search

Errors which may be encountered during installation and their solutions.


Configure / autogen.sh errors

../ltmain.sh not found

configure.ac:115: required file `../ltmain.sh' not found

The clue here is the "..". Autotools is looking for an auxiliary file in the parent directory of this one. This will happen if you check out one project folder inside another one (e.g. check out the lttoolbox folder inside apertium-en-es, or similar).

Solution: make a new subdirectory in your home folder and check out again there (e.g. mkdir ~/src && cd ~/src && svn co …)

No package lttoolbox/apertium found

When running configure script for Apertium

You may encounter an error similar to the following, the particular packages in error may differ (i.e., the error list here was on Mandriva Linux 2009).

checking pkg-config is at least version 0.9.0... yes
checking for APERTIUM... configure: error: Package
requirements (lttoolbox-3.0 >= 3.0.0 libxml-2.0 >= 2.6.17
libpcre >= 6.4) were not met:

No package 'lttoolbox-3.0' found

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

Alternatively, you may set the environment variables
APERTIUM_CFLAGS and APERTIUM_LIBS to avoid the need to
call pkg-config. See the pkg-config man page for more details.

This is because Apertium cannot find the location where the lttoolbox-3.0.pc file was installed. If you have installed lttoolbox (which you should have done prior to attempting to install Apertium) in a non-standard prefix (or sometimes even /usr/local) the configure script will not be able to find it.

First find the location of this file (it should be in $(PREFIX)/lib/pkgconfig) and then run this command:

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

Replace /usr/local with the appropriate prefix.

When running configure script for language pair data

checking pkg-config is at least version 0.9.0... yes
checking for APERTIUM... configure: error: Package
requirements (apertium >= 3.0.0) were not met:

No package 'apertium' found

Similar to when running configure script for Apertium installation, but now the apertium.pc is not being found. Adjust PKG_CONFIG_PATH environment variable to the correct path location. First find the location of this file (it should be in $(PREFIX)/lib/pkgconfig) and then run this command:

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

(Replace /usr/local if you set a --prefix when installing apertium.)


Workaround when language pairs need updated configure.ac's

Some language pairs say that they "require" an older version of apertium. The best solution is to fix their configure.ac's so they accept the new version, but here's a quick workaround:

cd /usr/local/lib/pkgconfig/
sudo cp lttoolbox-3.1.pc lttoolbox-3.0.pc
sudo cp apertium-3.1.pc apertium-3.0.pc

(or 3.2 or 3.3. or whatever)

AP_CHECK_LING not found when running configure or autogen.sh

./configure: line 3124: syntax error near unexpected token `1,'
./configure: line 3124: `AP_CHECK_LING(1, apertium-khk)'

The m4 macro AP_CHECK_LING was not found. It is in the file apertium.m4, installed by apertium into $prefix/share/aclocal (/usr/local/share/aclocal/ if you did not specify a prefix when installing apertium). First of all, check that you have that file. If it's not there, installing the latest version of apertium should fix it. If not, read on.

For the configure script to find apertium.m4, the ACLOCAL_PATH variable should be set to $prefix/share/aclocal (where $prefix is typically /usr/local). If you've set PKG_CONFIG_PATH as mentioned in the above sections, the autogen.sh script should set ACLOCAL_PATH based off that. If it doesn't, you can do

ACLOCAL_PATH=/usr/local/share/aclocal
export ACLOCAL_PATH

(Replace /usr/local if you set a --prefix when installing apertium.)


This might still not work if you're running an old version of aclocal that doesn't support ACLOCAL_PATH (e.g. aclocal 1.11, used on e.g. Ubuntu 11.10 and older). If so, you can use a line like this instead of autogen.sh:

autoreconf -I/usr/local/share/aclocal -fi && ./configure --with-lang2=../../languages/apertium-bar

replacing /usr/local for your $prefix if you installed into a prefix.

You don't have cg-proc / cg-comp installed

Many Apertium pairs (Welsh, Breton, Norwegian, Sámi, …) now require the Constraint Grammar package to help with disambiguation. For install instructions go here.

PCRE

checking for pcreposix.h... no
configure: error: *** unable to locate pcreposix.h include
file ***

You don't have the PCRE (Posix-compatible regular expressions) library header files installed, if you're in Debian or Ubuntu, do:

# apt-get install libpcre3-dev

on Fedora, do:

# yum install pcre-devel

syntax error near unexpected token PKG_CHECK_MODULES

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'

or

configure.ac:112: error: possibly undefined macro: dnl
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Solution

Run:

autoreconf -I/usr/local/share/aclocal && ./configure

or, if you installed into a prefix:

autoreconf -I"$prefix/share/aclocal" && ./configure --prefix "$prefix"

Compilation errors

/bin/ld: cannot find -lapertium3

how do we fix this?

Command not found

When running make for language pair data

you may encounter an error like the following when attempting to compile the language pair data (example: en-fr):

$ make
make  all-am
make[1]: Entering directory `/<path>/apertium-en-fr'
apertium-validate-dictionary apertium-en-fr.en.dixtmp1
make[1]: apertium-validate-dictionary: Command not found
make[1]: *** [en-fr.automorf.bin] Error 127
make[1]: Leaving directory `/<path>/apertium-en-fr'
make: *** [all] Error 2

This occurs because the Apertium application(s) are not on your path. Add it to your path (e.g., for BASH shell use export PATH=$PATH:/usr/local/bin on command line or similar in your user .bash_profile file.


Shared libraries

lt-comp: error while loading shared libraries:
liblttoolbox3-3.0.so.0: cannot open shared object file:
No such file or directory

This is because lt-comp cannot find where your liblttoolbox libs are installed. You may need to do one of several things:

  1. If you have installed it to some $prefix, do: export LD_LIBRARY_PATH=$prefix/lib
  2. If you have installed it in /usr/local
    1. Check to see if /usr/local/lib is in /etc/ld.so.conf, if it is, run ldconfig
    2. If it isn't, either add /usr/local/lib to /etc/ld.so.conf and re-run ldconfig, or do step 1.

Error in pcre_compile

Error
apertium-preprocess-transfer apertium-es-gl.es-gl.t1x es-gl.t1x.bin
Error: pcre_compile make[1]: *** [es-gl.t1x.bin] Error 1
Reason

Probably you have an old version of PCRE installed, or a version without unicode support.

Solution

If you have compiled PCRE from source, remember that you need to pass the option --enable-utf8 to the configure script. If you have only the binary package of your distribution installed, check the version, if it is before 7.4 then try to install an updated version.

Warning: unsupported locale, fallback to "C""

If you get

Warning: unsupported locale, fallback to "C""

when running a command, it means that your installation doesn't have the required locale enabled.

In Ubuntu at least, you can try something like

locale-gen es_EN.UTF-8

//replace es_EN.UTF-8 with whichever locale you should have installed

For example, if

LANG=es_ES.utf8 /usr/local/bin/apertium-deshtml /tmp/URLMH0f38

gave you the error : 'Warning: unsupported locale, fallback to "C"'. Then you could try

locale-gen es_EN.UTF-8

also see this link for an alternate method : http://tlug.dnho.net/node/237

‘rpl_malloc’ was not declared in this scope

If you get:

make check output
apertium_destxt.o apertium_destxt.cc
apertium_destxt.cc: In function ‘void* yyalloc(yy_size_t)’:
apertium_destxt.cc:2017: error: ‘rpl_malloc’ was not declared in this scope
apertium_destxt.cc: In function ‘void* yyrealloc(void*, yy_size_t)’:
apertium_destxt.cc:2029: error: ‘rpl_realloc’ was not declared in this scope
make[1]: *** [apertium_destxt.o] Error 1
make[1]: Leaving directory `/home/surge/Resources/apertium/apertium-3.1.0/apertium'

Then the best thing to do is comment out the lines:

AC_FUNC_MALLOC
AC_FUNC_REALLOC

From the configure.ac and then re-run autogen.sh.

ldconfig fails on a Mac

If you're on a Mac, you don't have to run ldconfig.

modes not generated on a Mac

Problem

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

Solution

Check that you've installed gawk (sudo port install gawk)

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

Either 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

Macports pcre conflict with Homebrew

If you use homebrew as well as macports, you might get an error like

dyld: Symbol not found: _pcre_free

from apertium-preprocess-transfer

In that case, it's likely that apertium is using the wrong pcre.

Possible solution: export LD_LIBRARY_PATH=/opt/local/lib and reconfigure/recompile apertium/lttoolbox.

Runtime errors

Missing pair

$  echo "Eso es un test" | apertium es-ca
Error: Mode es-ca does not exist. Try one of:
README

Looks like you don't have any language pairs installed, did you run make install in the language pair directory?

If you did, email the output of

$ cat /usr/local/bin/apertium | grep -e APERTIUM -e DEFAULT

...obviously replace /usr/local/bin/apertium with the location of the $(prefix)/bin/apertium

and the steps you took to compile apertium to the apertium-stuff mailing list.