Opened 4 months ago

Closed 2 weeks ago

#839 closed defect (fixed)

CFLAGS ignored by python3/Makefile

Reported by: Дилян Палаузов Owned by: Richard Boulton
Priority: normal Milestone:
Component: Xapian-bindings (Python) Version: 1.4.29
Severity: normal Keywords:
Cc: Дилян Палаузов Blocked By:
Blocking: Operating System: All

Description

I execute

export CFLAGS="-I/usr/local/include/python3.10" 
export LDFLAGS="-L/root/chroot-n/python/lib/"	 
./configure --with-python3 --prefix=/home/mailmanweb PYTHON3_LIB=/home/mailmanweb/lib/python3.10/site-packages 
cd python3 
make

The first command is:

depbase=`echo xapian_wrap.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I/usr/local/include/python3.13  -fno-strict-aliasing -Wall -Wno-unused -Wno-uninitialized -fvisibility=hidden -fvisibility-inlines-hidden -I/usr/local/include -g -O2 -MT xapian_wrap.lo -MD -MP -MF $depbase.Tpo -c -o xapian_wrap.lo xapian_wrap.cc && mv -f $depbase.Tpo $depbase.Plo

so CFLAGS was ignored. Eventually I replaced in python3/Makefile and python3/.deps/xapian_wrap.Plo all 3.13 with 3.10

Change History (3)

comment:1 by Olly Betts, 6 weeks ago

CFLAGS isn't used because the code is C++ not C - you should use CXXFLAGS to specify flags to the C++ compiler.

-I arguably belongs in CPPFLAGS (flags for the C/C++ preprocessor) - that's where configure --help suggests:

  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>

It should also work in CXXFLAGS though.

Last edited 6 weeks ago by Olly Betts (previous) (diff)

comment:2 by Olly Betts, 6 weeks ago

Though it seems you're actually wanting to specify to use a specify Python version instead of what's probed by default?

In that case you should do that by setting PYTHON3 to the interpreter of the version you want to use - then configure will get all the relevant options from that, which would look something like (I'm just guessing the path and name of your Python 3.10 interpreter:

./configure --with-python3 --prefix=/home/mailmanweb PYTHON3=/home/mailmanweb/bin/python3.10

With your current approach of passing -I and -L options so the headers and libraries for 3.10 are used, the interpreter used will still be 3.13. That may happen to work in some cases, but it's potentially problematic.

I'm going to add some explicit notes about CXXFLAGS, etc to INSTALL, then close this as it's not a functionality bug.

comment:3 by Olly Betts, 2 weeks ago

Resolution: fixed
Status: newclosed

ee0572731bf7731b460d196a46aaeecee8a07508 adds a list of commonly used "variable-like" configure options including CXXFLAGS and CPPFLAGS to xapian-core's INSTALL, and 3a0e6449fb52ab406b2da1f36579e8a2d2ade51c rewrites xapian-bindings's INSTALL to be based on xapian-core's.

I've backported these ready for 1.4.30 as 9e55e61bff31a9676062e9752db454779084fd8d and 82062534ab8183d587d0cf133ca943136f5581dd.

Note: See TracTickets for help on using tickets.