Friday, September 04, 2026

Re: python: set CXX to prevent sccache detection in meson via

I think it would be better to set it all the time, like MODSIMPLE_configure does in bsd.port.mk.

-- 
  Sent from a phone, apologies for poor formatting.


On 4 September 2026 18:56:52 Klemens Nanni <kn@openbsd.org> wrote:

graphics/py-matplotlib with MODPY_PYBUILD=mesonpy via

  /usr/local/lib/python3.14/site-packages/mesonbuild/envconfig.py:        return ExternalProgram('sccache', silent=True)                      

detects /usr/local/bin/sccache and uses that over default "c++",
leading to build failure with PORTS_PRIVSEP=yes:

  sccache: error: failed to create directory `/py-matplotlib-3.10.8_writes_to_HOME/.cache/sccache/preprocessor`: Permission denied (os error 13)

Environmental CXX takes priority, but is not set compared to CC,
which is how I tracked this down not knowing anything about how
Python builds C++ code.

Setting CXX where CC comes from fixes it and seems safe.

tb@ mentioned COMPILER_LANGS, but I don't fully understand the
implications of having CXX in the environment for Python ports
doing COMPILER_LANGS=C (if they exist), so I just gated it.

This fixes matplotlib for me when sccache is installed.

Feedback? OK?


Index: python.port.mk
===================================================================
RCS file: /cvs/ports/lang/python/3/python.port.mk,v
diff -u -p -r1.28 python.port.mk
--- python.port.mk 19 Jun 2026 13:49:04 -0000 1.28
+++ python.port.mk 4 Sep 2026 16:56:30 -0000
@@ -224,6 +224,9 @@ MODPY_DISTUTILS_INSTALL ?= install --pre
  --root=${DESTDIR}
 
 MAKE_ENV += CC=${CC}
+.if ${COMPILER_LANGS:Mc++}
+MAKE_ENV += CXX=${CXX}
+.endif
 CONFIGURE_ENV += PYTHON="${MODPY_BIN}"
 .if ${CONFIGURE_STYLE:Mgnu}
 CONFIGURE_ENV += ac_cv_prog_PYTHON="${MODPY_BIN}" \

No comments:

Post a Comment