GNOME Bugzilla – Bug 684637
libxslt-1.1.27: --with-python build fails with "Python.h: No such file or directory"
Last modified: 2012-11-21 06:36:12 UTC
Commit a2cd8a03 moved the includes in python/Makefile.am from INCLUDES to AM_CPPFLAGS. This change breaks the build when using --with-python. This happens because automake does not use AM_CPPFLAGS for tagets which have a target-specific *_CPPFLAGS variable. And at least when using automake-1.12.3 on Gentoo, a basic definition of libxsltmod_la_CPPFLAGS automatically gets added python/Makefile.am: libxsltmod_la_CPPFLAGS = -shared As a result, the rule for building libxsltmod_la-libxslt.lo gets expanded to libxsltmod_la-libxslt.lo: libxslt.c $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxsltmod_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxsltmod_la-libxslt.lo `test -f 'libxslt.c' || echo '$(srcdir)/'`libxslt.c and the build fails with /bin/sh ../libtool --tag=CC --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -shared -I/usr/include/libxml2 -march=native -O2 -pipe -Wall -c -o libxsltmod_la-libxslt.lo `test -f 'libxslt.c' || echo './'`libxslt.c libtool: compile: x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/libxml2 -march=native -O2 -pipe -Wall -c libxslt.c -fPIC -DPIC -o .libs/libxsltmod_la-libxslt.o libxslt.c:14:20: fatal error: Python.h: No such file or directory compilation terminated. The build failure can be avoided by appending the includes to libxsltmod_la_CPPFLAGS instead of assigning to AM_CPPFLAGS.
Created attachment 225003 [details] [review] proposed patch
I'm surprized by the automatic addition, but we can try to cope with this. The patch as is is actually broken because it use += while libxsltmod_la_CPPFLAGS is never set earlier in the makefile.am . So i am changing this to = , i assume that the automatic addition you are mentioning is intelligent enough to detect if there is already a declaration, if not we it's broken and that need fixing, not libxslt Makefiles. So applied with that small change: http://git.gnome.org/browse/libxslt/commit/?id=358bd4e46c2a17b7856401e206150bd17b538cfe thanks, Daniel