From: Paolo Bonzini Subject: Re: [PATCH] pass $($*.o-cflags) first to gcc/g++ Date: Wed, 09 Jul 2014 23:11:15 +0200 Message-ID: <53BDAFF3.1080007@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Stefano Stabellini , Peter Maydell Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org List-Id: xen-devel@lists.xenproject.org Il 09/07/2014 22:34, Stefano Stabellini ha scritto: > rules.mak adds cflags specific to the target source file ($($@-cflags)) > for last on the compiler command line. > > As a consequence when compiling arm-a64.o, g++ might end up picking the > wrong utils.h header file, because it looks for utils.h on all the other > include paths first. > > Fix the issue by passing the source file specific cflags first. > Do it consisently for *.c, *.cc, etc. > > Signed-off-by: Stefano Stabellini You can just as well have a bug that requires you to put the option last (for example adding -Wno-something or -O0), which is why $($@-cflags)/$($*.o-cflags) comes last. What package is it that has the conflicting utils.h file? Any chance to get it fixed in your distro? Here I get: $ find /usr/include/ -name utils.h /usr/include/libnl3/netlink/utils.h /usr/include/libnl3/netlink/cli/utils.h /usr/include/id3/utils.h /usr/include/octave-3.6.4/octave/utils.h but none of them have the path in -I. Paolo