Meson doesn't define HAVE_LOCALE_T for mscv

Started by Juan José Santamaría Flechaalmost 4 years ago8 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t46910
psql -h localhost -U postgres

Built from patchset v4 (message #4), August 18, 2026 at 03:39 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t46910_4 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t46910_4 && git checkout t46910_4

Patchset v4 (message #4) is on t46910_4

Jump to latest
#1Juan José Santamaría Flecha
juanjo.santamaria@gmail.com

Hello all,

Meson doesn't see the redefinition of locale_t done
in src/include/port/win32_port.h, so is not defining
HAVE_LOCALE_T, HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the
current src/tools/msvc/build.pl script does.

Please find attached a patch for so.

Regards,

Juan José Santamaría Flecha

Attachments:

0001-meson-define-HAVE_LOCALE_T-for-mscv.patchapplication/octet-stream; name=0001-meson-define-HAVE_LOCALE_T-for-mscv.patchDownload+8-1
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Juan José Santamaría Flecha (#1)
Re: Meson doesn't define HAVE_LOCALE_T for mscv

On 10.11.22 10:59, Juan José Santamaría Flecha wrote:

Meson doesn't see the redefinition of locale_t done
in src/include/port/win32_port.h, so is not defining
HAVE_LOCALE_T, HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the
current src/tools/msvc/build.pl <http://build.pl&gt; script does.

Please find attached a patch for so.

committed

#3Andres Freund
andres@anarazel.de
In reply to: Juan José Santamaría Flecha (#1)
Re: Meson doesn't define HAVE_LOCALE_T for mscv

Hi,

On 2022-11-10 10:59:41 +0100, Juan Jos� Santamar�a Flecha wrote:

Meson doesn't see the redefinition of locale_t done
in src/include/port/win32_port.h, so is not defining
HAVE_LOCALE_T, HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the
current src/tools/msvc/build.pl script does.

Please find attached a patch for so.

Hm. Is it right that the changes are only done for msvc? win32_port.h defines
the types for mingw as well afaict.

Greetings,

Andres Freund

#4Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andres Freund (#3)
Re: Meson doesn't define HAVE_LOCALE_T for mscv

On Tue, Nov 15, 2022 at 1:49 AM Andres Freund <andres@anarazel.de> wrote:

Hm. Is it right that the changes are only done for msvc? win32_port.h
defines
the types for mingw as well afaict.

Yes, it does, but configure does nothing with them, so adding those

defines is a new feature for MinGW but a correction for MSVC.

PFA a patch for MinGW.

I've seen that when building with meson on MinGW the output for version()
is 'PostgreSQL 16devel on x86_64, compiled by gcc-12.2.0', which is not
wrong but I cannot tell that it was done on MinGW. Should we include the
'host_system' in PG_VERSION_STR?

Regards,

Juan José Santamaría Flecha

Attachments:

t46910_4
0001-meson-define-HAVE_LOCALE_T-for-MinGW.patchapplication/octet-stream; name=0001-meson-define-HAVE_LOCALE_T-for-MinGW.patchDownload+2-3
#5Andres Freund
andres@anarazel.de
In reply to: Juan José Santamaría Flecha (#4)
Re: Meson doesn't define HAVE_LOCALE_T for mscv

Hi,

On 2022-11-15 15:35:31 +0100, Juan Jos� Santamar�a Flecha wrote:

I've seen that when building with meson on MinGW the output for version()
is 'PostgreSQL 16devel on x86_64, compiled by gcc-12.2.0', which is not
wrong but I cannot tell that it was done on MinGW. Should we include the
'host_system' in PG_VERSION_STR?

I don't think we should print mingw - that's really just redundant with
gcc. But including host_system seems like a good idea. Not sure why I didn't
do that.

Greetings,

Andres Freund

#6Andres Freund
andres@anarazel.de
In reply to: Juan José Santamaría Flecha (#4)
Re: Meson doesn't define HAVE_LOCALE_T for mscv

Hi,

Hm, the quoting was odd, making me think you had written a separate email
about the define issue. Hence the separate email...

On 2022-11-15 15:35:31 +0100, Juan Jos� Santamar�a Flecha wrote:

On Tue, Nov 15, 2022 at 1:49 AM Andres Freund <andres@anarazel.de> wrote:

Hm. Is it right that the changes are only done for msvc? win32_port.h
defines the types for mingw as well afaict.

Yes, it does, but configure does nothing with them, so adding those
defines is a new feature for MinGW but a correction for MSVC.

Any chance you checked if autoconf already detects locale_t with mingw?
Possible that mingw supplies one of the relevant headers...

Otherwise it looks like a sensible improvement to me.

Greetings,

Andres Freund

#7Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andres Freund (#5)
Re: Meson doesn't define HAVE_LOCALE_T for mscv

On Tue, Nov 15, 2022 at 8:53 PM Andres Freund <andres@anarazel.de> wrote:

I don't think we should print mingw - that's really just redundant with
gcc. But including host_system seems like a good idea. Not sure why I
didn't
do that.

I'll open a new thread for this. Also, I think this is skipping

collate.linux.utf.sql and infinite_recurse.sql tests in their intended
platforms.

Regards,

Juan José Santamaría Flecha

#8Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andres Freund (#6)
Re: Meson doesn't define HAVE_LOCALE_T for mscv

On Tue, Nov 15, 2022 at 9:02 PM Andres Freund <andres@anarazel.de> wrote:

On 2022-11-15 15:35:31 +0100, Juan José Santamaría Flecha wrote:

On Tue, Nov 15, 2022 at 1:49 AM Andres Freund <andres@anarazel.de>

wrote:

Hm. Is it right that the changes are only done for msvc? win32_port.h
defines the types for mingw as well afaict.

Yes, it does, but configure does nothing with them, so adding those
defines is a new feature for MinGW but a correction for MSVC.

Any chance you checked if autoconf already detects locale_t with mingw?
Possible that mingw supplies one of the relevant headers...

Otherwise it looks like a sensible improvement to me.

I've checked the autoconf version of pg_config.h and it's not detected.

Also, manually inspecting <locale.h> I see no definition of locale_t in
MinGW.

Regards,

Juan José Santamaría Flecha