pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: laurence.tews@gmail.com
Subject: BUG #18841: pgflex fails during build when Flex uses dynamic m4
Date: Thu, 13 Mar 2025 00:52:51 +0000
Message-ID: <18841-19af9c81fe3ae298@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18841
Logged by:          Laurence Tews
Email address:      laurence.tews@gmail.com
PostgreSQL version: 17.4
Operating system:   Ubuntu x86_64
Description:        

When building PostgreSQL from source, using a flex binary that is built with
./configure m4=m4 (a common configuration for hermetic build systems, or
where remote execution is used e.g. bazel) pgflex fails due to being unable
to locate an m4 executable.

FAILED: src/fe_utils/psqlscan.c
/usr/bin/python3 ../src/tools/pgflex --builddir . --srcdir .. --privatedir
src/fe_utils/psqlscan.c.p --flex /home/user/build_home/bin/flex --perl
/usr/bin/perl -i ../src/fe_utils/psqlscan.l -o src/fe_utils/psqlscan.c
--no-backup --fix-warnings -- -Cfe -p -p
flex: fatal internal error, exec of m4 failed

This appears to be due to the fact when m4=m4 is provided, flex uses the
PATH env to locate an m4 executable. Within src/tools/pgflex, the env is
replaced in the subprocess call, so any existing PATH env is not passed to
the subprocess. One possible fix is to create a copy of the existing env,
append FLEX_TMP_DIR, and pass the whole environment to the flex subprocess.



Message-ID: <18841-19af9c81fe3ae298@postgresql.org>
Permalink:  ../18841-19af9c81fe3ae298@postgresql.org/
Also on:    postgresql.org/message-id/18841-19af9c81fe3ae298@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, laurence.tews@gmail.com
  Subject: Re: BUG #18841: pgflex fails during build when Flex uses dynamic m4
  In-Reply-To: <18841-19af9c81fe3ae298@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox