[xml] The order of arguments when compiling



Hello,

On a first computer, when I compile a C program using the libxml2 library I do :
$ gcc `xml2-config --cflags` `xml2-config --libs` main.c
or
$ gcc main.c `xml2-config --cflags` `xml2-config --libs`
And it works (but the first method is better because it respects the order of arguments in the gcc manual).

On a second computer, if I compile like this, there is an error :
$ gcc `xml2-config --cflags` `xml2-config --libs` main.c
/tmp/cc7uNwed.o: In function `parseDoc':
main.c:(.text+0xd): undefined reference to `xmlParseFile'
main.c:(.text+0x51): undefined reference to `xmlCleanupParser'
main.c:(.text+0x63): undefined reference to `xmlFreeDoc'
main.c:(.text+0x68): undefined reference to `xmlCleanupParser'
collect2: ld returned 1 exit status
But if I compile like this, there is no error :
$ gcc main.c `xml2-config --cflags` `xml2-config --libs`

I thought this was a gcc problem but someone on the gcc mailing-list tell me that probably I have compiled 
libxml2 on the second computer "statically". And I should compile it "dynamically". It's true that on the 
second computer, I have compiled myself the library (configure, make, make install). On the first computer, 
this is my distro package.

How should I compile libxml2 on the 2nd computer to have the same behavior on the two computers?

Thank you.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]