python和java api的freeling错误:未定义的符号:_ZN5boost6system15system_categoryEv

时间:2013-11-18 20:23:50

标签: boost compilation

我在Ubuntu 13.10中安装了freeling,我正在尝试使用python或java apis,但每次尝试时都会出错:

    matias@matias-IdeaPad-U430-Touch:~/Programas/Tools/freeling/freeling-3.1/APIs/python$ ./sample.py <test.txt >out.txt
Traceback (most recent call last):
  File "./sample.py", line 10, in <module>
    import freeling
  File "/home/matias/Programas/Tools/freeling/freeling-3.1/APIs/python/freeling.py", line 26, in <module>
    _freeling = swig_import_helper()
  File "/home/matias/Programas/Tools/freeling/freeling-3.1/APIs/python/freeling.py", line 22, in swig_import_helper
    _mod = imp.load_module('_freeling', fp, pathname, description)
  File "/usr/lib/python3.3/imp.py", line 188, in load_module
    return load_dynamic(name, filename, file)
ImportError: /usr/local/lib/libfreeling-3.1.so: undefined symbol: _ZN5boost6system15system_categoryEv

对于Java:

matias@matias-IdeaPad-U430-Touch:~/Programas/Tools/freeling/freeling-3.1/APIs/python$ ./sample.py <test.txt >out.txt
Traceback (most recent call last):
  File "./sample.py", line 10, in <module>
    import freeling
  File "/home/matias/Programas/Tools/freeling/freeling-3.1/APIs/python/freeling.py", line 26, in <module>
    _freeling = swig_import_helper()
  File "/home/matias/Programas/Tools/freeling/freeling-3.1/APIs/python/freeling.py", line 22, in swig_import_helper
    _mod = imp.load_module('_freeling', fp, pathname, description)
  File "/usr/lib/python3.3/imp.py", line 188, in load_module
    return load_dynamic(name, filename, file)
ImportError: /usr/local/lib/libfreeling-3.1.so: undefined symbol: _ZN5boost6system15system_categoryEv

奇怪的是,java文件编译没有错误。

当我安装Freeling时,我确实收到以下错误:

 /bin/bash ../../libtool --tag=CXX   --mode=link g++ -O3 -Wall   -L../../src/libfreeling  -o dicc2phon corrector/dicc2phon-dicc2phon.o -lfreeling -lboost_regex    -lz 
libtool: link: g++ -O3 -Wall -o .libs/dicc2phon corrector/dicc2phon-dicc2phon.o  -L../../src/libfreeling /home/matias/Programas/Tools/freeling/freeling-3.1/src/libfreeling/.libs/libfreeling.so -lboost_regex -lz
corrector/dicc2phon-dicc2phon.o: In function `_GLOBAL__sub_I_main':
dicc2phon.cc:(.text.startup+0x23): undefined reference to `boost::system::generic_category()'
dicc2phon.cc:(.text.startup+0x2f): undefined reference to `boost::system::generic_category()'
dicc2phon.cc:(.text.startup+0x3b): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status

但是当我调用它时,analyze命令工作得很好。

我正在使用libboost1.53,我尝试安装另一个版本,但一直遇到未解决的依赖项和破坏的包的错误,所以我无法尝试使用任何其他版本。

1 个答案:

答案 0 :(得分:32)

您缺少链接:libboost_system.a(或libboost_system.so),因此Makefile规则(用于链接)最后应包含以下内容:-lboost_system(这应该已经在搜索路径中克++