Re: [xml] The order of arguments when compiling



I have just compiled libxml2 the same way on the two computers :
./configure --prefix=...
make
make install

On the first computer, I got no problem when compile.
On the second computer, I got the compile problem.

So, I think the problem is about gcc on the second computer (but they don't believe me on the gcc mailing 
list).

What should I do to compile fine my program with gcc on both computers?

First computer:
$ gcc --version
gcc (Debian 4.4.5-8) 4.4.
$ xml2-config --cflags
-I/home/.../software/libxml2-2.7.8/include/libxml2
$ xml2-config --libs
-L/home/.../software/libxml2-2.7.8/lib -lxml2 -lz -lm

Second computer:
$ gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1.
$ xml2-config --cflags
-I/home/.../software/libxml2-2.7.8/include/libxml2
$ xml2-config --libs
-L/home/.../software/libxml2-2.7.8/lib -lxml2 -lm

Oh! strange thing : "-lz" is not present... Is it related to my problem?

----- Mail original -----
De: "spam spam spam spam" <spam spam spam spam free fr>
Ã: xml gnome org
EnvoyÃ: Jeudi 16 FÃvrier 2012 16:01:27
Objet: [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.
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml



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