-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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][cpp] Fix libcurl build failure when building deb package #17614
Merged
lhotari
merged 5 commits into
apache:master
from
BewareMyPower:bewaremypower/fix-cpp-deb-build
Sep 13, 2022
Merged
[fix][cpp] Fix libcurl build failure when building deb package #17614
lhotari
merged 5 commits into
apache:master
from
BewareMyPower:bewaremypower/fix-cpp-deb-build
Sep 13, 2022
Conversation
This file contains 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
### Motivation See apache#17538 (comment) The root cause is when libcurl is built from source, it uses [`ld`](https://linux.die.net/man/1/ld) to check if the `libcurl.so` links to the correct dependencies in runtime. In Linux, a dynamic library links to the paths of `/etc/ld.so.conf` by default. However, different from other images like `centos:7` and `alpine`, this file includes `/usr/lib/x86_64-linux-gnu` in `debian:9`. ```bash $ cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf $ cat /etc/ld.so.conf.d/*.conf /usr/lib/x86_64-linux-gnu/libfakeroot # libc default configuration /usr/local/lib # Multiarch support /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu ``` When libcurl is compiled, it links to the install path of libopenssl via the `--with-ssl` option: https://github.com/apache/pulsar/blob/1f50366768e76f1a5f7084f7972167f989ddd0af/pulsar-client-cpp/pkg/deb/Dockerfile#L85 i.e. `/usr/local/ssl/lib/libopenssl.so`. However, after the `libcurl.so` is built, it links to `/usr/lib/x86_64-linux-gnu/libssl.so.1.1`, see the following output: ```bash $ ldd /usr/local/lib/libcurl.so /usr/local/lib/libcurl.so: /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/local/lib/libcurl.so) ``` In `debian:9`, the default libopenssl version is 1.1.0: ```bash $ strings /usr/lib/x86_64-linux-gnu/libssl.so.1.1 | grep OpenSSL OpenSSL 1.1.0l 10 Sep 2019 ``` The ABI compatibility is not guaranteed between 1.1.0l and 1.1.1n, see https://abi-laboratory.pro/index.php?view=timeline&l=openssl. ### Modifications Set the `LD_LIBRARY_PATH` to `/usr/local/ssl/lib` in the Dockerfile to build deb package. Actually it's not required for other images like `centos:7`, but it's also good to add the `LD_LIBRARY_PATH` to them. So this PR set the environment variable to them as well.
BewareMyPower
added
type/bug
The PR fixed a bug or issue reported a bug
component/client-c++
labels
Sep 13, 2022
BewareMyPower
requested review from
merlimat,
lhotari,
codelipenghui and
RobertIndie
September 13, 2022 10:29
lhotari
approved these changes
Sep 13, 2022
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.
Thank you. Great explanations too.
nicoloboschi
approved these changes
Sep 13, 2022
4 tasks
RobertIndie
approved these changes
Sep 13, 2022
This PR fixes the broken master branch. The GitHub Actions workflow was also broken in a recently merged change (#17571 |
tisonkun
pushed a commit
to tisonkun/pulsar
that referenced
this pull request
Sep 14, 2022
…e#17614) * [fix][cpp] Fix libcurl build failure when building deb package ### Motivation See apache#17538 (comment) The root cause is when libcurl is built from source, it uses [`ld`](https://linux.die.net/man/1/ld) to check if the `libcurl.so` links to the correct dependencies in runtime. In Linux, a dynamic library links to the paths of `/etc/ld.so.conf` by default. However, different from other images like `centos:7` and `alpine`, this file includes `/usr/lib/x86_64-linux-gnu` in `debian:9`. ```bash $ cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf $ cat /etc/ld.so.conf.d/*.conf /usr/lib/x86_64-linux-gnu/libfakeroot # libc default configuration /usr/local/lib # Multiarch support /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu ``` When libcurl is compiled, it links to the install path of libopenssl via the `--with-ssl` option: https://github.com/apache/pulsar/blob/1f50366768e76f1a5f7084f7972167f989ddd0af/pulsar-client-cpp/pkg/deb/Dockerfile#L85 i.e. `/usr/local/ssl/lib/libopenssl.so`. However, after the `libcurl.so` is built, it links to `/usr/lib/x86_64-linux-gnu/libssl.so.1.1`, see the following output: ```bash $ ldd /usr/local/lib/libcurl.so /usr/local/lib/libcurl.so: /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/local/lib/libcurl.so) ``` In `debian:9`, the default libopenssl version is 1.1.0: ```bash $ strings /usr/lib/x86_64-linux-gnu/libssl.so.1.1 | grep OpenSSL OpenSSL 1.1.0l 10 Sep 2019 ``` The ABI compatibility is not guaranteed between 1.1.0l and 1.1.1n, see https://abi-laboratory.pro/index.php?view=timeline&l=openssl. ### Modifications Set the `LD_LIBRARY_PATH` to `/usr/local/ssl/lib` in the Dockerfile to build deb package. Actually it's not required for other images like `centos:7`, but it's also good to add the `LD_LIBRARY_PATH` to them. So this PR set the environment variable to them as well. * Fix workflow so that cpp-tests isn't skipped * Revisit workflow fix to cover doc only workflows too * Fix multi-line condition Co-authored-by: Lari Hotari <[email protected]>
4 tasks
Jason918
pushed a commit
that referenced
this pull request
Sep 17, 2022
* [fix][cpp] Fix libcurl build failure when building deb package See #17538 (comment) The root cause is when libcurl is built from source, it uses [`ld`](https://linux.die.net/man/1/ld) to check if the `libcurl.so` links to the correct dependencies in runtime. In Linux, a dynamic library links to the paths of `/etc/ld.so.conf` by default. However, different from other images like `centos:7` and `alpine`, this file includes `/usr/lib/x86_64-linux-gnu` in `debian:9`. ```bash $ cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf $ cat /etc/ld.so.conf.d/*.conf /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu ``` When libcurl is compiled, it links to the install path of libopenssl via the `--with-ssl` option: https://github.com/apache/pulsar/blob/1f50366768e76f1a5f7084f7972167f989ddd0af/pulsar-client-cpp/pkg/deb/Dockerfile#L85 i.e. `/usr/local/ssl/lib/libopenssl.so`. However, after the `libcurl.so` is built, it links to `/usr/lib/x86_64-linux-gnu/libssl.so.1.1`, see the following output: ```bash $ ldd /usr/local/lib/libcurl.so /usr/local/lib/libcurl.so: /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/local/lib/libcurl.so) ``` In `debian:9`, the default libopenssl version is 1.1.0: ```bash $ strings /usr/lib/x86_64-linux-gnu/libssl.so.1.1 | grep OpenSSL OpenSSL 1.1.0l 10 Sep 2019 ``` The ABI compatibility is not guaranteed between 1.1.0l and 1.1.1n, see https://abi-laboratory.pro/index.php?view=timeline&l=openssl. Set the `LD_LIBRARY_PATH` to `/usr/local/ssl/lib` in the Dockerfile to build deb package. Actually it's not required for other images like `centos:7`, but it's also good to add the `LD_LIBRARY_PATH` to them. So this PR set the environment variable to them as well. * Fix workflow so that cpp-tests isn't skipped * Revisit workflow fix to cover doc only workflows too * Fix multi-line condition Co-authored-by: Lari Hotari <[email protected]> (cherry picked from commit 0754ea1)
nicoloboschi
pushed a commit
to datastax/pulsar
that referenced
this pull request
Sep 20, 2022
…e#17614) * [fix][cpp] Fix libcurl build failure when building deb package See apache#17538 (comment) The root cause is when libcurl is built from source, it uses [`ld`](https://linux.die.net/man/1/ld) to check if the `libcurl.so` links to the correct dependencies in runtime. In Linux, a dynamic library links to the paths of `/etc/ld.so.conf` by default. However, different from other images like `centos:7` and `alpine`, this file includes `/usr/lib/x86_64-linux-gnu` in `debian:9`. ```bash $ cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf $ cat /etc/ld.so.conf.d/*.conf /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu ``` When libcurl is compiled, it links to the install path of libopenssl via the `--with-ssl` option: https://github.com/apache/pulsar/blob/1f50366768e76f1a5f7084f7972167f989ddd0af/pulsar-client-cpp/pkg/deb/Dockerfile#L85 i.e. `/usr/local/ssl/lib/libopenssl.so`. However, after the `libcurl.so` is built, it links to `/usr/lib/x86_64-linux-gnu/libssl.so.1.1`, see the following output: ```bash $ ldd /usr/local/lib/libcurl.so /usr/local/lib/libcurl.so: /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/local/lib/libcurl.so) ``` In `debian:9`, the default libopenssl version is 1.1.0: ```bash $ strings /usr/lib/x86_64-linux-gnu/libssl.so.1.1 | grep OpenSSL OpenSSL 1.1.0l 10 Sep 2019 ``` The ABI compatibility is not guaranteed between 1.1.0l and 1.1.1n, see https://abi-laboratory.pro/index.php?view=timeline&l=openssl. Set the `LD_LIBRARY_PATH` to `/usr/local/ssl/lib` in the Dockerfile to build deb package. Actually it's not required for other images like `centos:7`, but it's also good to add the `LD_LIBRARY_PATH` to them. So this PR set the environment variable to them as well. * Fix workflow so that cpp-tests isn't skipped * Revisit workflow fix to cover doc only workflows too * Fix multi-line condition Co-authored-by: Lari Hotari <[email protected]> (cherry picked from commit 0754ea1) (cherry picked from commit 7162c30)
tisonkun
added a commit
to tisonkun/pulsar
that referenced
this pull request
Oct 4, 2022
This OR logic has been introduced by apache#17614. I don't know why it's added in the first place - we shouldn't have a OR here. But anyway since pulsar-client-cpp moved out, it should be reasonable to fix the workflow.
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-2.10
doc-not-needed
Your PR changes do not impact docs
release/2.10.2
type/bug
The PR fixed a bug or issue reported a bug
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.
Motivation
See #17538 (comment)
The root cause is when libcurl is built from source, it uses
ld
to check if thelibcurl.so
links to the correct dependencies in runtime. In Linux, a dynamic library links to the paths of/etc/ld.so.conf
by default. However, different from other images likecentos:7
andalpine
, this file includes/usr/lib/x86_64-linux-gnu
indebian:9
.When libcurl is compiled, it links to the install path of libopenssl via the
--with-ssl
option:pulsar/pulsar-client-cpp/pkg/deb/Dockerfile
Line 85 in 1f50366
i.e.
/usr/local/ssl/lib/libopenssl.so
.However, after the
libcurl.so
is built, it links to/usr/lib/x86_64-linux-gnu/libssl.so.1.1
, see the following output:$ ldd /usr/local/lib/libcurl.so /usr/local/lib/libcurl.so: /usr/lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/local/lib/libcurl.so)
In
debian:9
, the default libopenssl version is 1.1.0:$ strings /usr/lib/x86_64-linux-gnu/libssl.so.1.1 | grep OpenSSL OpenSSL 1.1.0l 10 Sep 2019
The ABI compatibility is not guaranteed between 1.1.0l and 1.1.1n, see https://abi-laboratory.pro/index.php?view=timeline&l=openssl.
Modifications
Set the
LD_LIBRARY_PATH
to/usr/local/ssl/lib
in the Dockerfile to build deb package.In Linux, a dynamic library links to the
LD_LIBRARY_PATH
in prior to/etc/ld.so.conf
.We can see the order in the man page of
ld
.Actually it's not required for other images like
centos:7
, but it's also good to add theLD_LIBRARY_PATH
to them. So this PR set the environment variable to them as well.Documentation
doc-required
(Your PR needs to update docs and you will update later)
doc-not-needed
(Please explain why)
doc
(Your PR contains doc changes)
doc-complete
(Docs have been already added)