[QGIS-Developer] precompiled headers, turning off

Greg Troxel gdt at lexort.com
Mon Nov 3 05:17:21 PST 2025


Building 3.44 on NetBSD (using ccache in our compiler wrappers and
disabled in qgis) I'm getting errors about precompiled headers:

  [110/5655] Building CXX object src/core/CMakeFiles/qgis_core.dir/symbology/qgssymbollayerreference.cpp.o
  cc1plus: warning: /tmp/work/geography/qgis/work/qgis-3.44.4/cmake-pkgsrc-build/src/core/CMakeFiles/qgis_core.dir/cmake_pch.hxx.gch: had text segment at different address

>From searching, it seems that gcc pch is buggy in the presence of ASLR,
and that this causes ccache not to cache.  Indeed, I get repeated misses.

So I tried

  CMAKE_CONFIGURE_ARGS+=          -DUSE_PRECOMPILED_HEADERS:BOOL=FALSE

which not surprisingly adds the rhs to the cmake invocation, but no change.


Grepping the diff from 3.40 to 3.44 (I am ignoring 3.42 on purpose), I
see

  $ git diff ..release-3_44  |egrep PRECOM
  +  set(USE_PRECOMPILED_HEADERS OFF)
  +  set(USE_PRECOMPILED_HEADERS ON)
  +if (USE_PRECOMPILED_HEADERS)
  +if (USE_PRECOMPILED_HEADERS)
  +if (USE_PRECOMPILED_HEADERS)
  +if(USE_PRECOMPILED_HEADERS)
  +if (USE_PRECOMPILED_HEADERS)
  +if (USE_PRECOMPILED_HEADERS)

and I don't see an option declaration or a way for the cmake invoker to
say don't do that.

I'm about to patch to always OFF and will see how that goes.

I wonder if people think this is a bug, and if it's turning up on other
systems with ASLR, or if it's only the combination of older gcc (I'm
using 10) and ASLR.



(As an aside, this wasn't listed in NEWS, and I'm finding it to be a
significant user-visible change, as I consider compiling from source to
be a user activity for a Free Software project.  I realize it was
intended to be invisible, but I view pch as hairy and not normal, having
started C with K&R first edition.)


More information about the QGIS-Developer mailing list