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]

The order of arguments differs


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':
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 a retournà 1 code d'Ãtat d'exÃcution

So, I must put the input file first.

Problem : this is not what is written on my man :
$ man gcc
SYNOPSIS
       gcc [-c|-S|-E] [-std=standard]
           [-g] [-pg] [-Olevel]
           [-Wwarn...] [-pedantic]
           [-Idir...] [-Ldir...]
           [-Dmacro[=defn]...] [-Umacro]
           [-foption...] [-mmachine-option...]
           [-o outfile] [@file] infile...

$ gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright  2011 Free Software Foundation, Inc.
...

2. Second computer

$ gcc src/main.c `xml2-config --libs` `xml2-config --cflags`
$ gcc `xml2-config --libs` `xml2-config --cflags` src/main.c

So it works with any order.

$ gcc --version
gcc (Debian 4.4.5-8) 4.4.5
Copyright  2010 Free Software Foundation, Inc.
...

3. Conclusion

It's a big problem to have a different behaviour on each computer.
My autotools put the input file at the end, so the compile failed on the first computer.
Do you think it's a gcc problem?

Thank you.


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