Fix meson uuid header check so it works with MSVC in REL_16_STABLE

From: Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru>
To: andrew(at)dunslane(dot)net
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Fix meson uuid header check so it works with MSVC in REL_16_STABLE
Date: 2024-11-26 06:24:05
Message-ID: 75488477263cbfa0211f8f765059c3b6@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello! Could you backport the commit "Fix meson uuid header check so it
works with MSVC" [1] to REL_16_STABLE please? Building with -Duuid=ossp
fails without it:

Running compile:
Working directory:
C:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpx088n_nb
Code:

#include <uuid.h>
int main(void) {
/* If it's not defined as a macro, try to use as a symbol */
#ifndef uuid_export
uuid_export;
#endif
return 0;
}
-----------
Command line: `cl
C:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpx088n_nb\testfile.c
/FoC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpx088n_nb\output.obj
/nologo /showIncludes /utf-8 /c /nologo /showIncludes /utf-8 /c /Od
/Oi-` -> 2
stdout:
testfile.c
C:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpx088n_nb\testfile.c(2):
fatal error C1083: Cannot open include file: 'uuid.h': No such file or
directory
-----------
Header "uuid.h" has symbol "uuid_export" with dependency -luuid: NO

meson.build:1467:4: ERROR: Problem encountered: uuid library ossp
missing required function uuid_export

With this fix my build and tests with Meson were successful:

Running compile:
Working directory:
C:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpam6tbfwl
Code:

#include <uuid.h>
int main(void) {
/* If it's not defined as a macro, try to use as a symbol */
#ifndef uuid_export
uuid_export;
#endif
return 0;
}
-----------
Command line: `cl
-IC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\src/include
-IC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\src/include
-IC:\gr-builds\6n4KsTYAF\0\pgpro-dev\deps\include
-IC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\src/include/port/win32
-IC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\src/include/port/win32
-IC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\src/include/port/win32_msvc
-IC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\src/include/port/win32_msvc
C:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpam6tbfwl\testfile.c
/FoC:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpam6tbfwl\output.obj
/nologo /showIncludes /utf-8 /c /nologo /showIncludes /utf-8 /c /Od
/Oi-` -> 0
stdout:
testfile.c
Note: including file:
C:\gr-builds\6n4KsTYAF\0\pgpro-dev\deps\include\uuid.h
Note: including file: C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\ucrt\sys/types.h
Note: including file: C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\ucrt\corecrt.h
Note: including file: C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\vcruntime.h
Note: including file: C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\sal.h
Note: including file: C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\concurrencysal.h
Note: including file: C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\vadefs.h
Note: including file: C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\ucrt\string.h
Note: including file: C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\ucrt\corecrt_memory.h
Note: including file: C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\ucrt\corecrt_memcpy_s.h
Note: including file: C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\ucrt\errno.h
Note: including file: C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\vcruntime_string.h
Note: including file: C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\ucrt\corecrt_wstring.h
C:\gr-builds\6n4KsTYAF\0\pgpro-dev\postgrespro\builddir\meson-private\tmpam6tbfwl\testfile.c(6):
warning C4550: expression evaluates to a function which is missing an
argument list
-----------
Header "uuid.h" has symbol "uuid_export" with dependency -luuid: YES

[1]
https://github.com/postgres/postgres/commit/7c655a04a2dc84b59ed6dce97bd38b79e734ecca

--
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message huyajun 2024-11-26 06:26:49 Potential Issue with Redundant Restriction Clauses in get_parameterized_baserel_size for PARTITIONED_REL
Previous Message Pavel Stehule 2024-11-26 06:21:49 Re: proposal: schema variables