GNOME Bugzilla – Bug 664616
girscanner dumper.py gives the arguments in wrong order to gcc when not using libtool
Last modified: 2015-02-07 16:56:06 UTC
Created attachment 201976 [details] [review] The said patch When using g-ir-scanner with --no-libtool it creates link command lines like gcc -o /home/tsdgeos_work/poppler/build/glib/tmp-introspecty1uO45/Poppler-0.18 -L. -Wl,-rpath=. -lpoppler-glib -pthread -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 /home/tsdgeos_work/poppler/build/glib/tmp-introspecty1uO45/Poppler-0.18.o This is wrong, as according to gcc manual: ********************** -llibrary Search the library named library when linking. It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be loaded. ********************** That is, given that /home/tsdgeos_work/poppler/build/glib/tmp-introspecty1uO45/Poppler-0.18.o is going to depend on all the libs, they should be after the .o, not before. The attached patch fixes the linking problems i have in Ubuntu 11.10 by moving the addition of the libraries after the addition of the .o files. I have tested when using libtool and build is unaffected (i.e. still works).
I prefer git format-patch style patches; see: https://live.gnome.org/GnomeLove/SubmittingPatches
The change could also use some comment explaining why it's moved, preferably in a block of comments.
Review of attachment 201976 [details] [review]: This patch looks safe; we're just reordering the libraries to be after the .o file.
Created attachment 202389 [details] [review] Updated patch in git am friendly format
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]