GNOME Bugzilla – Bug 313927
-I flags passed to linker
Last modified: 2005-09-18 19:34:27 UTC
Please describe the problem: The flags determined by 'pkgconfig -cflags' are passed as CFLAGS not CPPFLAGS to the makefiles, meaning a boatload of -I are going to the linker phase as well as the C compiler. Steps to reproduce: 1. ./configure 2. make Actual results: During step 1: checking TERM_CFLAGS... -DORBIT2=1 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/orbit-2.0 -I/sw/include/bonobo-activation-2.0 -I/sw/include/gconf/2 -I/sw/include/libbonobo-2.0 -I/sw/include/gnome-vfs-2.0 -I/sw/lib/gnome-vfs-2.0/include -I/sw/include/pango-1.0 -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/sw/include -I/sw/include/startup-notification-1.0 -I/sw/include/libart-2.0 -I/sw/include/libgnome-2.0 -I/sw/include/libgnomecanvas-2.0 -I/sw/include/libxml2 -I/sw/include/libbonoboui-2.0 -I/sw/include/libgnomeui-2.0 -I/sw/include/libglade-2.0 During step 2: /bin/sh ../libtool --tag=CC --mode=link gcc-3.3 -DORBIT2=1 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/includ e -I/sw/include/orbit-2.0 -I/sw/include/bonobo-activation-2.0 -I/sw/include/gcon f/2 -I/sw/include/libbonobo-2.0 -I/sw/include/gnome-vfs-2.0 -I/sw/lib/gnome-vfs- 2.0/include -I/sw/include/pango-1.0 -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/sw/include -I/sw/include/startup-notification-1.0 - I/sw/include/libart-2.0 -I/sw/include/libgnome-2.0 -I/sw/include/libgnomecanvas- 2.0 -I/sw/include/libxml2 -I/sw/include/libbonoboui-2.0 -I/sw/include/libgnomeui -2.0 -I/sw/include/libglade-2.0 -O3 -funroll-loops -fstrict-aliasing -Wall -L /sw/lib -o gnome-terminal encoding.o profile-editor.o skey-popup.o terminal.o t erminal-accels.o terminal-profile.o terminal-screen.o terminal-widget-vte.o term inal-window.o simple-x-font-selector.o eggaccelerators.o eggcellrendererkeys.o -L/usr/X11R6/lib -lSM -lICE -lX11 -L/usr/X11R6/lib -L/sw/lib -lglade-2.0 -lgn omeui-2 -lbonoboui-2 -lxml2 -lpthread -lz -lgnomecanvas-2 -lgnome-2 -lpopt -lart _lgpl_2 -lstartup-notification-1 -lvte -lncurses -lSM -lICE -lgtk-x11-2.0 -lgdk- x11-2.0 -lXrandr -lXinerama -lXext -lXcursor -latk-1.0 -lgdk_pixbuf-2.0 -lpangox ft-1.0 -lXft -lXrender -lpangox-1.0 -lX11 -lpangoft2-1.0 -lfontconfig -lfreetype -lpango-1.0 -lgobject-2.0 -lgnomevfs-2 -lbonobo-2 -lgconf-2 -lbonobo-activation -lORBit-2 -lm -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -liconv skey/libs key.la mkdir .libs gcc-3.3 -DORBIT2=1 -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/sw/inc lude/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/orbit-2.0 -I/sw/include/b onobo-activation-2.0 -I/sw/include/gconf/2 -I/sw/include/libbonobo-2.0 -I/sw/inc lude/gnome-vfs-2.0 -I/sw/lib/gnome-vfs-2.0/include -I/sw/include/pango-1.0 -I/sw /include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/sw/include - I/sw/include/startup-notification-1.0 -I/sw/include/libart-2.0 -I/sw/include/lib gnome-2.0 -I/sw/include/libgnomecanvas-2.0 -I/sw/include/libxml2 -I/sw/include/l ibbonoboui-2.0 -I/sw/include/libgnomeui-2.0 -I/sw/include/libglade-2.0 -O3 -funr oll-loops -fstrict-aliasing -Wall -o gnome-terminal encoding.o profile-editor.o skey-popup.o terminal.o terminal-accels.o terminal-profile.o terminal-screen.o t erminal-widget-vte.o terminal-window.o simple-x-font-selector.o eggaccelerators. o eggcellrendererkeys.o -L/sw/lib -L/usr/X11R6/lib skey/.libs/libskey.a /sw/lib /libglade-2.0.dylib /sw/lib/libgnomeui-2.dylib /sw/lib/libgnome-keyring.dylib /s w/lib/libjpeg.dylib /sw/lib/libbonoboui-2.dylib /sw/lib/libgnomecanvas-2.dylib / sw/lib/libgnome-2.dylib /sw/lib/libesd.dylib /sw/lib/libaudiofile.dylib /sw/lib/ libart_lgpl_2.dylib /sw/lib/libstartup-notification-1.dylib /sw/lib/libvte.dylib -lncurses -lSM -lICE /sw/lib/libgtk-x11-2.0.dylib /sw/lib/libgdk-x11-2.0.dylib -lXrandr -lXinerama -lXext -lXcursor /sw/lib/libatk-1.0.dylib /sw/lib/libgdk_pix buf-2.0.dylib /sw/lib/libpangoxft-1.0.dylib -lXft -lXrender /sw/lib/libpangox-1. 0.dylib -lX11 /sw/lib/libpangoft2-1.0.dylib -lfontconfig -lfreetype /sw/lib/libp ango-1.0.dylib /sw/lib/libgnomevfs-2.dylib /sw/lib/libxml2.dylib -ldl -lpthread -lz /sw/lib/libbonobo-2.dylib /sw/lib/libgconf-2.dylib /sw/lib/libbonobo-activat ion.dylib /sw/lib/libORBitCosNaming-2.dylib /sw/lib/libORBit-2.dylib /sw/lib/lib popt.dylib /sw/lib/libgobject-2.0.dylib -lresolv -lm /sw/lib/libgmodule-2.0.dyli b /sw/lib/libgthread-2.0.dylib /sw/lib/libglib-2.0.dylib /sw/lib/libintl.dylib - lc /sw/lib/libiconv.dylib Expected results: There's no reason to pass -I (or -D) flags when linking a bunch of .o files together. Does this happen every time? Yes. Other information: This is with OS X 10.3.9 (darwin7.9.0/ppc), XCode-1.5 (gcc3.3). Looks like this situation occurs in ./configure, where TERM_CFLAGS is merged into CFLAGS instead of CPPFLAGS. This patch to configure.in: -CFLAGS="$TERM_CFLAGS $CFLAGS" +CPPFLAGS="$TERM_CFLAGS" gives the more normal behavior, where TERM_CFLAGS is passed to libtool during --mode=compile but not during --mode=link and all compiling (still) succeeds. Or is this really a libtool bug, in that libtool should be smart enough not to pass compiler flags to the linker? If you're really paranoid that pkg-config --cflags might give flags that are needed by the linker as well as the compiler, you could separate it into --cflags-only-I that go into CPPFLAGS and --cflags-only-other that go into CFLAGS.
Commited to HEAD. Thanks.