链接外部库时出错

时间:2013-09-18 20:01:05

标签: c++ c linux ubuntu ubuntu-12.04

我从http://grid.hust.edu.cn/triplebit/TripleBit.tar.gz下载了TripleBit的源代码。 它要求我安装两个库:

i)  boost-1.39.0.tar.gz
ii) raptor-1.4.21.tar.gz

我使用以下方式安装它们:

sudo apt-get install libboost-dev
sudo apt-get install libraptor-dev

然而,在我进入TripleBit的目录并运行“make”之后。我发现以下错误:

/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:38: undefined reference to `raptor_init'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:39: undefined reference to `raptor_new_parser'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:40: undefined reference to `raptor_set_statement_handler'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:42: undefined reference to `raptor_uri_filename_to_uri_string'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:43: undefined reference to `raptor_new_uri'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:44: undefined reference to `raptor_uri_copy'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:45: undefined reference to `raptor_parse_file'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:47: undefined reference to `raptor_free_parser'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:48: undefined reference to `raptor_free_uri'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:49: undefined reference to `raptor_free_uri'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:50: undefined reference to `raptor_free_memory'
/home/TripleBit/BuildTripleBitFromRDF/BuildTripleBit.cpp:52: undefined reference to `raptor_finish'
collect2: ld returned 1 exit status
make: *** [bin/lrelease/buildTripleBitFromRDF] Error 1

驻留在/ usr / local / lib中的库文件是:

libboost_filesystem.so, libraptor.a, libraptor.la, libraptor.so, libraptor.so.1 
and libraptor.so.1.2.0

驻留在/ usr / lib中的文件也是:

libraptor.a, libraptor.la, libraptor.so, libraptor.so.1, libraptor.so.1.2.0, 
libraptor2.so.0, libraptor2.so.0.0.0, librasqal.so.3, librasqal.so.3.0.0, librdf.so.0, 
librdf.so.0.0.0, librest-0.7.so.0, librest-0.7.so.0.0.0.

有人可以帮我找出错误。

我在ubuntu 12.04上运行它

2 个答案:

答案 0 :(得分:1)

查看TripleBit Makefile。您缺少-lraptor链接器选项。此条目应由raptor-config --libs返回。 您还可以对libraptor.a文件运行nm工具,并检查它是否未使用RAPTOR_DISABLE_V1选项进行编译。

答案 1 :(得分:1)

查看TripleBit Makefile,您可以删除第82行中的“BuildTripleBitFromRDF”(modules:= ..),以便您可以转义错误,但“BuildTripleBitFromRDF”不会构建到可执行文件中。因此,当您下载的数据集是RDF数据集时,您可以使用raptor将RDF数据集转换为N3数据集,然后使用buildTripleBitFromN3工具继续。 可能的问题是在猛禽中安装错误。