This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The order of arguments differs


On 12-02-15 09:41 AM, spam.spam.spam.spam@free.fr 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]