Opened 4 months ago

Last modified 3 weeks ago

#839 new defect

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 (2)

comment:1 by Olly Betts, 3 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 3 weeks ago by Olly Betts (previous) (diff)

comment:2 by Olly Betts, 3 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.

Note: See TracTickets for help on using tickets.