From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Pau Monne Subject: Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c Date: Thu, 17 May 2012 15:02:28 +0100 Message-ID: <4FB504F4.5050408@citrix.com> References: <1337256990-51913-1-git-send-email-roger.pau@citrix.com> <1337256990-51913-3-git-send-email-roger.pau@citrix.com> <1337261146.7781.75.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1337261146.7781.75.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Christoph Egger , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Campbell wrote: > On Thu, 2012-05-17 at 13:16 +0100, Roger Pau Monne wrote: >> genwrap.py generates _pyxl_types.c, which includes libxl.h, but if >> libxl.h is already present in the include search path, the old one was >> included instead of the new one, giving compilation errors. Since >> _pyxl_types.c is generated at compilation time, we can safely set >> the path to libxl.h include. >> >> I've only experienced this problem when compiling Xen on NetBSD with >> old header files in the include path, Linux seems to not have this >> problem. > > Should this be include<> and not "", since libxl.h isn't in the current > dir in this case? > > Is the right fix to make sure that the in-tree -I lines come first? > Ian. Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by python build tools (distutils & friends...), so we cannot touch much of this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this. > >> Cc: Ian Jackson >> Cc: Christoph Egger >> Signed-off-by: Roger Pau Monne >> --- >> tools/python/genwrap.py | 6 ++++-- >> 1 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/tools/python/genwrap.py b/tools/python/genwrap.py >> index af8a5e9..0d7cc98 100644 >> --- a/tools/python/genwrap.py >> +++ b/tools/python/genwrap.py >> @@ -309,10 +309,12 @@ _hidden int genwrap__defbool_set(PyObject *v, libxl_defbool *db); >> #include >> #include >> #include >> -#include "libxl.h" /* gah */ >> +#include "%s" /* gah */ >> #include "%s" >> >> -""" % tuple((' '.join(sys.argv),) + (os.path.split(decls)[-1:]),)) >> +""" % tuple((' '.join(sys.argv),) + >> + (os.path.dirname(sys.argv[1]) + "/libxl.h",) + >> + (os.path.split(decls)[-1:]),)) >> for ty in types: >> if ty.private: >> continue > >