Hi I am submitting two new patches. We can undefine the macro at two locations
1). As be-secure-openssl.c [1] was the actual file where the conflict happened so I undefined the macro here before the ssl includes. I changed the comment a little to make it understandable. I am also attaching the error generated with ninja build. OR 2). Right after the gssapi includes in libpq-be.h Thanks Imran Zaheer Bitnine [1]: https://github.com/postgres/postgres/blob/00ac25a3c365004821e819653c3307acd3294818/src/backend/libpq/be-secure-openssl.c#L46 On Sun, Jun 9, 2024 at 7:21 AM Tom Lane <[email protected]> wrote: > > Andrew Dunstan <[email protected]> writes: > > On 2024-06-08 Sa 06:22, Imran Zaheer wrote: > >> Now this can either be solved by just just undefine the macro defined > >> by wincrypt.h as done here [3] > >> Or we should rearrange our headers. Openssl header should be at the > >> bottom (after the gssapi includes). > > > Let's be consistent and use the #undef from [3]. > > +1. Depending on header order is not great, especially when you have > to make it depend on an order that is directly contradictory to > project conventions [0]. > > regards, tom lane > > [0] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Found ninja-1.11.1.git.kitware.jobserver-1 at
C:\Users\Imran\AppData\Local\Programs\Python\Python311\Scripts\ninja.EXE
ninja: Entering directory `build'
[439/2267] Linking target src/interfaces/libpq/libpq.dll
Creating library src/interfaces/libpq\libpq.lib
[841/2267] Compiling C object
src/backend/postgres_lib.a.p/libpq_be-secure-openssl.c.obj
FAILED: src/backend/postgres_lib.a.p/libpq_be-secure-openssl.c.obj
"C:\Program Files\Microsoft Visual
Studio\2022\Preview\VC\Tools\MSVC\14.39.33218\bin\Hostx64\x64\cl.exe"
"-Isrc\backend\postgres_lib.a.p" "-Isrc\include" "-I..\src\include"
"-I..\src\include\port\win32" "-I..\src\include\port\win32_msvc"
"-ID:\kbr\include" "-ID:\kbr\include\krb5" "-IC:/Program
Files/OpenSSL-Win64/include" "/MDd" "/FIpostgres_pch.h" "/Yupostgres_pch.h"
"/Fpsrc\backend\postgres_lib.a.p\postgres_pch.pch" "/nologo" "/showIncludes"
"/utf-8" "/W2" "/Od" "/Zi" "/DWIN32" "/DWINDOWS" "/D__WINDOWS__" "/D__WIN32__"
"/D_CRT_SECURE_NO_DEPRECATE" "/D_CRT_NONSTDC_NO_DEPRECATE" "/wd4018" "/wd4244"
"/wd4273" "/wd4101" "/wd4102" "/wd4090" "/wd4267" "-DBUILDING_DLL" "/FS"
"/FdC:\Users\Imran\Desktop\agens-tmp\compile\postgres\pg\postgres\build\src\backend\postgres_lib.pdb"
/Fosrc/backend/postgres_lib.a.p/libpq_be-secure-openssl.c.obj "/c"
../src/backend/libpq/be-secure-openssl.c
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(140): error C2059:
syntax error: '('
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(147): error C2059:
syntax error: '<parameter-list>'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(152): error C2059:
syntax error: '}'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(153): error C2059:
syntax error: '}'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(157): error C2061:
syntax error: identifier 'GENERAL_NAME'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(158): error C2059:
syntax error: '}'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2143:
syntax error: missing ')' before '*'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2143:
syntax error: missing '{' before '*'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): warning C4228:
nonstandard extension used: qualifiers after comma in declarator list are
ignored
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2143:
syntax error: missing ';' before '*'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2059:
syntax error: ')'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2373: 'a':
redefinition; different type modifiers
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): note: see
declaration of 'a'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2146:
syntax error: missing ')' before identifier 'compare'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2061:
syntax error: identifier 'compare'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2059:
syntax error: ';'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2449:
found '{' at file scope (missing function header?)
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2059:
syntax error: '}'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2059:
syntax error: ','
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2081:
'GENERAL_NAME': name in formal parameter list illegal
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2054:
expected '(' to follow 'ptr'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2146:
syntax error: missing ')' before identifier 'freefunc'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2081:
'sk_GENERAL_NAME_freefunc': name in formal parameter list illegal
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2061:
syntax error: identifier 'freefunc'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2146:
syntax error: missing ')' before identifier 'copyfunc'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2081:
'sk_GENERAL_NAME_copyfunc': name in formal parameter list illegal
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2061:
syntax error: identifier 'copyfunc'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2061:
syntax error: identifier 'sk_GENERAL_NAME_set_cmp_func'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(166): error C2059:
syntax error: '<parameter-list>'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): error C2143:
syntax error: missing ')' before '*'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): error C2143:
syntax error: missing '{' before '*'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): warning C4228:
nonstandard extension used: qualifiers after comma in declarator list are
ignored
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): error C2143:
syntax error: missing ';' before '*'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): error C2059:
syntax error: ')'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): error C2373: 'a':
redefinition; different type modifiers
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): note: see
declaration of 'a'
C:\Program Files\OpenSSL-Win64\include\openssl/x509v3.h(170): fatal error
C1003: error count exceeds 100; stopping compilation
[858/2267] Compiling C object
src/backend/postgres_lib.a.p/optimizer_path_costsize.c.obj
ninja: build stopped: subcommand failed.
v01-0001-approach02-undefine-macro-after-gssapi-includes.patch
Description: Binary data
v01-0001-approach03-undefine-macro-before-ssl-includes.patch
Description: Binary data
