Tutorial :linking/version problem with libxerces-c



Question:

I am trying to make an example of a toolkit work, but after typing make, I got the following error:

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  

I have the following versions installed;

/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  

I tried to make a symbolic linking by:

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

but nothing changed. I think I need to determine the path of the installed directory but I don't have a lot experience in this issue, so I would be very happy if some one can help me to find out.

My makefile is like this;

*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 $@*   

Regards.


Solution:1

You need Xerces 3.0, which you can download and install from http://xerces.apache.org/xerces-c/

Symbolic links to non-existing libraries is a slippery slope, but sometimes it's the easiest (or even the only) solution.

If you have to do this, try adding the directory containing the symbolic link to the list of directories to be searched using gcc's -L flag like this:

(assuming the symbolic link is in the build directory):

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

UPDATE:

In response to the updated question, it should find libxerces-c-3.0.so if it's in /usr/local/lib.

However, try this:

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

and if it doesn't work, post the output of ldd -v taskintro

Also, you shouldn't need -L and the symbolic links anymore while compiling, now that you have installed Xerces 3.0. Please try to recompile without these.


Solution:2

The problem is that /usr/local/lib/liborocos-rtt-gnulinux.so is linked against the libxerces-c-3.0.so.

To see the paths where the linker goes to find the libraries, check the /etc/ld.so.conf file.


Solution:3

I downloaded and installed xerces 3.0. Now it managed to compile but running the output file gives the following:

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

I searched for the file and found it here;

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

I tried again to create a symbolic link to this file and updated the makefile as you suggested (no need for that I guess since it compiled), but nothing changed.

ln -s /usr/local/lib/libxerces-c-3.0.so libxerces-c-3.0.so    ${CC} -L . -o $@ $@.o ${OROLIBS}  

UPDATE:

export command helped me to compile successfully. now running the program seems to have other problems with malloc.c such as;

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  

Checked from other forums as well, but couldn't understand what this is about. Looks like a problem with the program itself, thus have no idea how to solve it.

Gracias anyway.


Solution:4

Try installing the library libxerces-c3.0 as your code is referring version 3.0 libraries but not any other. Use the command mentioned below to install the library.

 sudo apt-get install libxerces-c3.0  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »