Loading...

gcc-help@gcc.gnu.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: The order of arguments differs spam . spam . spam . spam Fri Feb 17 00:00:55 2012

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

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

So, I think the problem is about gcc on the first computer.

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

----- Mail original -----
De: "Ryan Mansfield" <[EMAIL PROTECTED]>
À: [EMAIL PROTECTED]
Envoyé: Mercredi 15 Février 2012 15:49:04
Objet: Re: The order of arguments differs

On 12-02-15 09:41 AM, [EMAIL PROTECTED] wrote:
> Hello,
>
> I am compiling a program on 2 computers.
>
> Table of contents
> 1. First computer
> 2. Second computer
> 3. Conclusion
>
> 1. First computer
>
> $ gcc src/main.c `xml2-config --libs` `xml2-config --cflags`
>
> Now with a different order of arguments :
> $ gcc `xml2-config --libs` `xml2-config --cflags` src/main.c
> /tmp/ccXlXfPu.o: In function `parseDoc':

> 3. Conclusion
>
> It's a big problem to have a different behaviour on each computer.

You're likely linking statically against libxml2 on the first computer,
and dynamically on the second. Check with -Wl,-t. Link order matters
when statically linking; the reference always has to come before the
symbol definition (unless you use -start-group/--end-group to have ld
make a second pass)

> Do you think it's a gcc problem?

No.

Regards,

Ryan Mansfield