Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the OpenSSL 3.x symbols not found on macOS build #145

Merged

Conversation

BewareMyPower
Copy link
Contributor

Motivation

Recently after the runner image was upgraded, the macOS build failed with symbol not found in flat namespace (_EVP_PKEY_get_bn_param).

See https://github.com/apache/pulsar-client-python/actions/runs/5805986979/job/15740588663?pr=134

There are actually two issues.

One is that when building the C++ client on macOS, /usr/local/opt/openssl/ will be firstly searched if OPENSSL_ROOT_DIR is not defined.

https://github.com/apache/pulsar-client-cpp/blob/1e7d259bb94379ef6e4618fdac283912d0be6861/CMakeLists.txt#L136

It should be fixed at the C++ client side but we can also have a workaround here by defining the OPENSSL_ROOT_DIR variable.

The other is that when building the libcurl, the headers from /usr/local/include/openssl/ were included, see the logs:

/usr/local/include/openssl/macros.h:193:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
#   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)

It's a strange error because we have already configured the --with-ssl option to specify the OpenSSL directory. I tried adding -I/path/to/my/openssl to the CFLAGS env variable but it didn't work.

Modifications

To resolve the 1st issue, specifying OPENSSL_ROOT_DIR to the DEPS_PREFIX path when building the C++ client.

To resolve the 2nd issue, since I cannot find an elegant way to do that, I just copied the OpenSSL headers from the dependency header directory to the libcurl include directory.

### Motivation

Recently after the runner image was upgraded, the macOS build failed
with `symbol not found in flat namespace (_EVP_PKEY_get_bn_param)`.

See https://github.com/apache/pulsar-client-python/actions/runs/5805986979/job/15740588663?pr=134

There are actually two issues.

One is that when building the C++ client on macOS,
`/usr/local/opt/openssl/` will be firstly searched if `OPENSSL_ROOT_DIR`
is not defined.

https://github.com/apache/pulsar-client-cpp/blob/1e7d259bb94379ef6e4618fdac283912d0be6861/CMakeLists.txt#L136

It should be fixed at the C++ client side but we can also have a
workaround here by defining the `OPENSSL_ROOT_DIR` variable.

The other is that when building the libcurl, the headers from
`/usr/local/include/openssl/` were included, see the logs:

```
/usr/local/include/openssl/macros.h:193:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
#   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
```

It's a strange error because we have already configured the `--with-ssl`
option to specify the OpenSSL directory. I tried adding
`-I/path/to/my/openssl` to the `CFLAGS` env variable but it didn't work.

### Modifications

To resolve the 1st issue, specifying `OPENSSL_ROOT_DIR` to the
`DEPS_PREFIX` path when building the C++ client.

To resolve the 2nd issue, since I cannot find an elegant way to do that,
I just copied the OpenSSL headers from the dependency header directory
to the libcurl include directory.
@BewareMyPower BewareMyPower added bug Something isn't working build labels Aug 11, 2023
@BewareMyPower BewareMyPower added this to the 3.3.0 milestone Aug 11, 2023
@BewareMyPower BewareMyPower self-assigned this Aug 11, 2023
@BewareMyPower BewareMyPower merged commit 0de92b0 into apache:main Aug 11, 2023
@BewareMyPower BewareMyPower deleted the bewaremypower/fix-openssl-link-error branch August 11, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants