fix: Add implicit gcc flag to all feature probes #4074
Merged
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.
Description of changes:
A recent refactor of our feature probes in #3921 correctly caused the rust bindings to probe for more features. However, due to how some of the feature probes work, building s2n-tls-sys currently fails when linked with some libcryptos.
In CMake, a feature is enabled after successfully compiling the feature test and linking it with the libcrypto. Some feature probes, such as
S2N_LIBCRYPTO_SUPPORTS_EVP_MD5_SHA1_HASH
, rely on the linker failing to disable the feature:In the rust bindings, the feature probe is compiled but not linked with the libcrypto. This causes the compilation to produce a warning, but the feature probe is still enabled:
To fix this, the
-Werror=implicit-function-declaration
gcc flag was added, causing the compiler to error when a function isn't declared without relying on the linker to fail. Since this kind of check is common with feature probing, this flag was added to a newGLOBAL.flags
file which gets applied to all of the feature probes.Call-outs:
openssl-sys
to pass to the compiler command, so I left this change out of this PR. It seems like we're able to get the header path from openssl-sys withDEP_OPENSSL_INCLUDE
, but I couldn't find an equivalent environment variable for the library directory.Testing:
This change is tested with a new OpenSSL 1.0.2 generate job added in this PR. OpenSSL 1.0.2 does not define
EVP_md5_sha1
, so theS2N_LIBCRYPTO_SUPPORTS_EVP_MD5_SHA1_HASH
feature should not be enabled. Without this change,S2N_LIBCRYPTO_SUPPORTS_EVP_MD5_SHA1_HASH
is incorrectly enabled and this CI job fails:By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.