-
Notifications
You must be signed in to change notification settings - Fork 246
Fix OPENSSL_API_COMPAT redefinition warning in gpcloud - #1974
Open
tuhaihe wants to merge 1 commit into
Open
Conversation
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
leborchuk
leborchuk
approved these changes
Sep 9, 2026
@leborchuk
leborchuk
left a comment
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions