与libxerces-c链接/版本问题

时间:2010-07-05 10:40:33

标签: c++ linux drivers xerces-c

我正在尝试制作工具包工作的示例,但在输入make之后,我收到以下错误:

g++ -o taskintro taskintro.o `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config orocos-ocl-gnulinux orocos-rtt-gnulinux --libs` 
/usr/bin/ld: warning: libxerces-c-3.0.so, needed by /usr/local/lib/liborocos-rtt-gnulinux.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/liborocos-rtt-gnulinux.so: undefined reference to `xercesc_3_0::XMLUni::fgXercesContinueAfterFatalError'
.
.
.
collect2: ld returned 1 exit status
make: *** [taskintro] Error 1

我安装了以下版本;

/usr/lib/libxerces-c.so
/usr/lib/libxerces-c.so.28
/usr/lib/libxerces-c.so.28.0
/usr/lib/libxerces-c-3.1.so

我试图通过以下方式进行符号链接:

ln -s /usr/lib/libxerces-c-3.1.so libxerces-c-3.0.so

但没有改变。我想我需要确定已安装目录的路径,但我在这个问题上没有太多经验,所以如果有人能帮我找到,我会很高兴。

我的makefile是这样的;

*OROCOS_TARGET = gnulinux
OROPATH = /usr/local
CC = g++
LD = ld
OROFLAGS= -Wall -g `PKG_CONFIG_PATH=${OROPATH}/lib/pkgconfig pkg-config orocos-ocl-${OROCOS_TARGET} orocos-rtt-${OROCOS_TARGET} --cflags` 
OROLIBS = `PKG_CONFIG_PATH=${OROPATH}/lib/pkgconfig pkg-config orocos-ocl-${OROCOS_TARGET} orocos-rtt-${OROCOS_TARGET} --libs` 
all: taskintro
taskintro.o: TaskIntro.cxx ${OROPATH}/include/rtt/os/fosi.h *.hpp
    ${CC} -c ${OROFLAGS} $< -o $@* 

问候。

4 个答案:

答案 0 :(得分:1)

您需要Xerces 3.0,您可以从http://xerces.apache.org/xerces-c/

下载并安装

与不存在的库的符号链接是一个滑坡,但有时它是最简单的(甚至是唯一的)解决方案。

如果来执行此操作,请尝试使用gcc的-L标记将包含符号链接的目录添加到要搜索的目录列表中,如下所示:

(假设符号链接在构建目录中):

g++ -L . -o taskintro taskintro.o `...`

<强>更新

为了回应更新的问题,应该找到libxerces-c-3.0.so,如果它在/ usr / local / lib中。

然而,试试这个:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
./taskintro

如果不起作用,请发布ldd -v taskintro

的输出

此外,在编译时,您不应再需要-L和符号链接,因为您已经安装了Xerces 3.0。如果没有这些,请尝试重新编译。

答案 1 :(得分:0)

问题是/usr/local/lib/liborocos-rtt-gnulinux.so与libxerces-c-3.0.so相关联。

要查看链接器查找库的路径,请检查/etc/ld.so.conf文件。

答案 2 :(得分:0)

我下载并安装了xerces 3.0。现在它设法编译但运行输出文件提供以下内容:

./taskintro: error while loading shared libraries: libxerces-c-3.0.so: cannot open shared object file: No such file or directory

我搜索了该文件并在此处找到了它;

/usr/local/lib/libxerces-c-3.0.so

我再次尝试创建一个指向此文件的符号链接,并按照您的建议更新了makefile(我猜它不需要编译),但没有任何改变。

ln -s /usr/local/lib/libxerces-c-3.0.so libxerces-c-3.0.so

${CC} -L . -o $@ $@.o ${OROLIBS}

<强>更新

export命令帮助我成功编译。现在运行该程序似乎还有malloc.c的其他问题,如;

taskintro: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
Aborted

也从其他论坛查看,但无法理解这是什么。看起来像程序本身的问题,因此不知道如何解决它。

无论如何,格拉西亚斯。

答案 3 :(得分:0)

尝试安装库 libxerces-c3.0 您的代码是指3.0版库,但不是任何其他库。使用下面提到的命令安装库。

 sudo apt-get install libxerces-c3.0