[PLUG] help required for static linking libxml2

Shridhar Daithankar ghodechhap at ghodechhap.net
Thu May 25 13:15:53 IST 2006


On Thursday 25 May 2006 12:44, sachin sonone wrote:
> Hi,
> thanks for helping.
>
> g++ -o program main.o /usr/local/lib/libxml.a
> this will increase my binary size.
> I like to link libxml.so.

That is dynamic/shared linking. Not static linking.
>
> g++ -o program main.o /usr/local/lib/new_libxml.so

First of all, new_libxml.so is not correct name for a library. It should 
always read lib*.so.

Then, It should read 
g++ -o program main.o -L/usr/local/lib -lxml

> application compiles properly. then I copy new_libxml.so to /usr/lib
> while executing appliation it uses old version of libxml and gives error
> for new API.

It should work. Do 'ldd program' to find out what library it is looking for 
and where it is getting the same. 

Try adding /usr/local/lib to LD_LIBRARY_PATH instead of copying the library 
to /usr/lib. 

man ld for more information.

HTH
 
 Shridhar




More information about the Plug-mail mailing list