Skip to content

Fix OPENSSL_API_COMPAT redefinition warning in gpcloud - #1974

Merged
tuhaihe merged 1 commit into
apache:mainfrom
tuhaihe:fix-gpcloud-openssl-api-compat
Sep 25, 2026
Merged

tuhaihe merged 1 commit into
apache:mainfrom
tuhaihe:fix-gpcloud-openssl-api-compat

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Sep 9, 2026

Copy link
Copy Markdown
Member

s3conf.cpp includes the OpenSSL headers through s3common_headers.h before it includes c.h, so pg_config.h redefines OPENSSL_API_COMPAT with a different value than the one OpenSSL already settled on. On Rocky 8 (gcc 8, OpenSSL 1.1.1) every build of the module prints:

  In file included from ../../src/include/c.h:56,
                   from src/s3conf.cpp:16:
  ../../src/include/pg_config.h:904: warning: "OPENSSL_API_COMPAT" redefined
   #define OPENSSL_API_COMPAT 0x10001000L
  In file included from /usr/include/openssl/opensslconf.h:42,
                   from /usr/include/openssl/hmac.h:13,
                   from include/s3common_headers.h:8,
                   from include/gpcommon.h:4,
                   from include/s3conf.h:4,
                   from src/s3conf.cpp:1:
  /usr/include/openssl/opensslconf-x86_64.h:145: note: this is the location of the previous definition
   # define OPENSSL_API_COMPAT OPENSSL_MIN_API

Undefine it before including c.h. By then the OpenSSL headers are fully parsed, so the macro no longer affects anything and behaviour is unchanged -- only the warning goes away. Reordering the includes so that c.h comes first would also work, but it would move the extern "C" block ahead of the C++ standard headers pulled in by s3common_headers.h.

gpcloud.cpp is the only other file in the module that includes a PostgreSQL header, and it includes postgres.h on its first line, ahead of any OpenSSL header, so it does not have the problem.

Assisted-by: Claude Code
Backpatch-through: REL_2_STABLE

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@leborchuk leborchuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MisterRaindrop MisterRaindrop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tuhaihe
tuhaihe force-pushed the fix-gpcloud-openssl-api-compat branch from b4c40ad to 6ce240b Compare September 25, 2026 00:38
s3conf.cpp includes the OpenSSL headers through s3common_headers.h before
it includes c.h, so pg_config.h redefines OPENSSL_API_COMPAT with a
different value than the one OpenSSL already settled on. On Rocky 8
(gcc 8, OpenSSL 1.1.1) every build of the module prints:

  In file included from ../../src/include/c.h:56,
                   from src/s3conf.cpp:16:
  ../../src/include/pg_config.h:904: warning: "OPENSSL_API_COMPAT" redefined
   #define OPENSSL_API_COMPAT 0x10001000L
  In file included from /usr/include/openssl/opensslconf.h:42,
                   from /usr/include/openssl/hmac.h:13,
                   from include/s3common_headers.h:8,
                   from include/gpcommon.h:4,
                   from include/s3conf.h:4,
                   from src/s3conf.cpp:1:
  /usr/include/openssl/opensslconf-x86_64.h:145: note: this is the location of the previous definition
   # define OPENSSL_API_COMPAT OPENSSL_MIN_API

Undefine it before including c.h. By then the OpenSSL headers are fully
parsed, so the macro no longer affects anything and behaviour is
unchanged -- only the warning goes away. Reordering the includes so that
c.h comes first would also work, but it would move the extern "C" block
ahead of the C++ standard headers pulled in by s3common_headers.h.

gpcloud.cpp is the only other file in the module that includes a
PostgreSQL header, and it includes postgres.h on its first line, ahead
of any OpenSSL header, so it does not have the problem.

Assisted-by: Claude Code
Backpatch-through: REL_2_STABLE
@tuhaihe
tuhaihe force-pushed the fix-gpcloud-openssl-api-compat branch from 6ce240b to 15f0e47 Compare September 25, 2026 04:51
@tuhaihe
tuhaihe merged commit ef8d794 into apache:main Sep 25, 2026
109 of 110 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants