Обсуждение: [PATCH] Add `headerscheck` run_target to meson

Поиск
Список
Период
Сортировка

[PATCH] Add `headerscheck` run_target to meson

От
Miłosz Bieniek
Дата:
Hi,
While reviewing a patch I noticed that we have a `make -s headerscheck` but there is no equivalent in meson.
I prepared a small patch that adds `headerscheck` and `cpluspluscheck` targets.

Best Regards,
Miłosz Bieniek 
Вложения

Re: [PATCH] Add `headerscheck` run_target to meson

От
Peter Eisentraut
Дата:
On 27.11.25 10:28, Miłosz Bieniek wrote:
> While reviewing a patch I noticed that we have a `make -s headerscheck` 
> but there is no equivalent in meson.
> I prepared a small patch that adds `headerscheck` and `cpluspluscheck` 
> targets.

This would be good to have, but I don't think your patch works.  It 
seems you need to add the srcdir and builddir command-line arguments to 
the invocations.




Re: [PATCH] Add `headerscheck` run_target to meson

От
Miłosz Bieniek
Дата:
pt., 28 lis 2025 o 12:53 Peter Eisentraut <peter@eisentraut.org> napisał(a):
>
> On 27.11.25 10:28, Miłosz Bieniek wrote:
> > While reviewing a patch I noticed that we have a `make -s headerscheck`
> > but there is no equivalent in meson.
> > I prepared a small patch that adds `headerscheck` and `cpluspluscheck`
> > targets.
>
> This would be good to have, but I don't think your patch works.  It
> seems you need to add the srcdir and builddir command-line arguments to
> the invocations.
>

I think you are right. I added srcdir and builddir arguments.

Вложения

Re: [PATCH] Add `headerscheck` run_target to meson

От
Nazir Bilal Yavuz
Дата:
Hi,

Thank you for working on this!

On Fri, 28 Nov 2025 at 17:03, Miłosz Bieniek <bieniek.milosz0@gmail.com> wrote:
>
> pt., 28 lis 2025 o 12:53 Peter Eisentraut <peter@eisentraut.org> napisał(a):
> >
> > On 27.11.25 10:28, Miłosz Bieniek wrote:
> > > While reviewing a patch I noticed that we have a `make -s headerscheck`
> > > but there is no equivalent in meson.
> > > I prepared a small patch that adds `headerscheck` and `cpluspluscheck`
> > > targets.
> >
> > This would be good to have, but I don't think your patch works.  It
> > seems you need to add the srcdir and builddir command-line arguments to
> > the invocations.
> >
>
> I think you are right. I added srcdir and builddir arguments.

The headerscheck script pulls some information from Makefile.global
after the configure [1] but meson does not generate a full version of
Makefile.global [2], so it does not have the required information to
check perl and python headers. If you run 'meson compile
headerscheck', you get errors like:

In file included from
/home/nbyavuz/Desktop/projects/postgres/src/pl/plperl/plperl.h:25,
                 from /tmp/headerscheck.YxsZhn/test.c:2:
/home/nbyavuz/Desktop/projects/postgres/src/pl/plperl/plperl_system.h:85:10:
fatal error: EXTERN.h: No such file or directory
   85 | #include <EXTERN.h>
      |          ^~~~~~~~~~
compilation terminated.

In file included from
/home/nbyavuz/Desktop/projects/postgres/src/pl/plpython/plpython.h:39,
                 from
/home/nbyavuz/Desktop/projects/postgres/src/pl/plpython/plpy_plpymodule.h:8,
                 from /tmp/headerscheck.YxsZhn/test.c:2:
/home/nbyavuz/Desktop/projects/postgres/src/pl/plpython/plpython_system.h:50:10:
fatal error: Python.h: No such file or directory
   50 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.

-----

[1.1] src/tools/pginclude/headerscheck
# Needs to be run after configuring and creating all generated headers.
# It's advisable to configure --with-perl --with-python, else you're
# likely to get errors from associated headers.

[1.2] src/tools/pginclude/headerscheck
# Pull some info from configure's results.
MGLOB="$builddir/src/Makefile.global"
CPPFLAGS=`sed -n 's/^CPPFLAGS[     ]*=[     ]*//p' "$MGLOB"`
CFLAGS=`sed -n 's/^CFLAGS[     ]*=[     ]*//p' "$MGLOB"`
ICU_CFLAGS=`sed -n 's/^ICU_CFLAGS[     ]*=[     ]*//p' "$MGLOB"`
CC=`sed -n 's/^CC[     ]*=[     ]*//p' "$MGLOB"`
CXX=`sed -n 's/^CXX[     ]*=[     ]*//p' "$MGLOB"`
PG_SYSROOT=`sed -n 's/^PG_SYSROOT[     ]*=[     ]*//p' "$MGLOB"`
perl_includespec=`sed -n 's/^perl_includespec[     ]*=[     ]*//p' "$MGLOB"`
python_includespec=`sed -n 's/^python_includespec[     ]*=[     ]*//p' "$MGLOB"`

[2] src/meson.build
makefile_global = configure_file(
  input: 'Makefile.global.in',
  output: 'Makefile.global',
  configuration: pgxs_cdata,
  install: true,
  install_dir: dir_pgxs / 'src',
)
configure_files += makefile_global

--
Regards,
Nazir Bilal Yavuz
Microsoft



Re: [PATCH] Add `headerscheck` run_target to meson

От
Nazir Bilal Yavuz
Дата:
Hi,

On Fri, 28 Nov 2025 at 18:05, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
>
> On Fri, 28 Nov 2025 at 17:03, Miłosz Bieniek <bieniek.milosz0@gmail.com> wrote:
> >
> > pt., 28 lis 2025 o 12:53 Peter Eisentraut <peter@eisentraut.org> napisał(a):
> > >
> > > On 27.11.25 10:28, Miłosz Bieniek wrote:
> > > > While reviewing a patch I noticed that we have a `make -s headerscheck`
> > > > but there is no equivalent in meson.
> > > > I prepared a small patch that adds `headerscheck` and `cpluspluscheck`
> > > > targets.
> > >
> > > This would be good to have, but I don't think your patch works.  It
> > > seems you need to add the srcdir and builddir command-line arguments to
> > > the invocations.
> > >
> >
> > I think you are right. I added srcdir and builddir arguments.
>
> The headerscheck script pulls some information from Makefile.global
> after the configure [1] but meson does not generate a full version of
> Makefile.global [2], so it does not have the required information to
> check perl and python headers. If you run 'meson compile
> headerscheck', you get errors like:

Sorry, I clicked send early.

Two solutions came to my mind but I am not sure which one is better:

1) We can add missing information to the generated Makefile.global in
the meson.build.

2) We can send required information as arguments to the headerscheck script.

Any thoughts or suggestions?

--
Regards,
Nazir Bilal Yavuz
Microsoft



Re: [PATCH] Add `headerscheck` run_target to meson

От
Miłosz Bieniek
Дата:
pt., 28 lis 2025 o 16:17 Nazir Bilal Yavuz <byavuz81@gmail.com> napisał(a):
>
> Hi,
>
> On Fri, 28 Nov 2025 at 18:05, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
> >
> > On Fri, 28 Nov 2025 at 17:03, Miłosz Bieniek <bieniek.milosz0@gmail.com> wrote:
> > >
> > > pt., 28 lis 2025 o 12:53 Peter Eisentraut <peter@eisentraut.org> napisał(a):
> > > >
> > > > On 27.11.25 10:28, Miłosz Bieniek wrote:
> > > > > While reviewing a patch I noticed that we have a `make -s headerscheck`
> > > > > but there is no equivalent in meson.
> > > > > I prepared a small patch that adds `headerscheck` and `cpluspluscheck`
> > > > > targets.
> > > >
> > > > This would be good to have, but I don't think your patch works.  It
> > > > seems you need to add the srcdir and builddir command-line arguments to
> > > > the invocations.
> > > >
> > >
> > > I think you are right. I added srcdir and builddir arguments.
> >
> > The headerscheck script pulls some information from Makefile.global
> > after the configure [1] but meson does not generate a full version of
> > Makefile.global [2], so it does not have the required information to
> > check perl and python headers. If you run 'meson compile
> > headerscheck', you get errors like:
>
> Sorry, I clicked send early.
>
> Two solutions came to my mind but I am not sure which one is better:
>
> 1) We can add missing information to the generated Makefile.global in
> the meson.build.
>
> 2) We can send required information as arguments to the headerscheck script.
>
> Any thoughts or suggestions?

Thank you for the detailed response.
I initially thought the errors with `#include <Python.h>` and
`#include <EXTREN.h>` were only an issue with my local setup.
If I understand correctly, your first proposal would address this
problem without requiring integration with the headerscheck script,
which in my opinion would be a cleaner solution.
However, I would definitely like to hear what others think as well.