-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add curl.cmake dependency for cpr #7853
Conversation
✅ Deploy Preview for meta-velox canceled.
|
@duanmeng Can we add a |
48a5a4c
to
c9456da
Compare
@@ -20,6 +20,9 @@ set(VELOX_CPR_SOURCE_URL | |||
"https://github.com/libcpr/cpr/archive/refs/tags/${VELOX_CPR_VERSION}.tar.gz" | |||
) | |||
|
|||
set(curl_SOURCE BUNDLED) | |||
resolve_dependency(curl) |
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.
Could this disable the curl installation in cpr?
https://github.com/libcpr/cpr/blob/master/CMakeLists.txt#L174
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.
Yes, you can refer to the sentence "the first such call will control how that dependency will be made available" in this link.
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.
I think it's enough to use FetchContent_Declare
to define VELOX_CURL_SOURCE_URL
without calling FetchContent_MakeAvailable
, because cpr's CMakeLists.txt
defines many CURL compilation parameters. Our purpose is just to define the CURL source URL, and the compilation triggering is still done by cpr calling FetchContent_MakeAvailable
.
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.
I can still see the curl building log in cpr building, could help double check?
https://app.circleci.com/pipelines/github/facebookincubator/velox/39899/workflows/20a0d56a-51b9-4832-8d9f-96e5685a33f2/jobs/271655/parallel-runs/0/steps/0-106?invite=true#step-106-40221_31
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.
This is just a log in the cmake of cpr, and it will always be printed out. I just removed FetchContent_MakeAvailable
in curl.cmake
, so the compilation process is triggered by cpr with the correct compilation parameters. The role of curl.cmake
in Velox is simply to define the source URL of curl through FetchContent_Declare
.
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.
Still using the built-in curl, but now we can specify the source URL and version of curl.
@liujiayi771 LGTM. @assignUser Hi Jacob, what do you think, could you please help take a look? |
From the other pr:
|
I'll have to review in-depth later but like this it seems like nothing is using the build curl version. |
c9456da
to
3578b3d
Compare
@assignUser The operating system may have installed a version of curl that is incompatible with Velox. The purpose of this modification is to support configuring the source URL for curl. I still want to use the corresponding version of curl with cpr, and this modification can enable support for specifying a URL for curl to a local file, allowing for the compilation of curl in offline environments. Otherwise, in an environment without internet access, it would not be possible to download the specified curl source link in cpr CMakeLists.txt. |
According to #4325, we can use |
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.
I misunderstood your intention earlier but it is clear now. Great job using fc_declares 'cached' nature, very clever!
Looking at the ci logs cpr seems to use the version set here (8.4.0). @liujiayi771 have you confirmed that using a tar.gz works as intended as well?
A minor comment, lgtm.
@@ -20,6 +20,9 @@ set(VELOX_CPR_SOURCE_URL | |||
"https://github.com/libcpr/cpr/archive/refs/tags/${VELOX_CPR_VERSION}.tar.gz" | |||
) | |||
|
|||
set(curl_SOURCE BUNDLED) |
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.
👍 placing that in the cpr file! could you add a comment explaining what this does?
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.
OK.
@kgpai Hi Krishna, could you help review and merge this PR? Thanks. |
@assignUser Yes. If I set |
8d10d6a
to
66eb6a1
Compare
@@ -20,6 +20,11 @@ set(VELOX_CPR_SOURCE_URL | |||
"https://github.com/libcpr/cpr/archive/refs/tags/${VELOX_CPR_VERSION}.tar.gz" | |||
) | |||
|
|||
# Add the dependency for curl, so that we can define the source URL | |||
# for curl in curl.cmake. |
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.
# for curl in curl.cmake. | |
# for curl in curl.cmake. This will override the curl version declared by cpr. |
just a little tweak
66eb6a1
to
1d5737a
Compare
1d5737a
to
79cedd0
Compare
@mbasmanova @kgpai Could you help review? |
@kgpai Krishna, would you help review this PR? |
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.
Looks good.
One question for @assignUser this shouldnt happen with condafication where we would be easily be able to set curl version along with cpr version, without having to build them together like this , right ?
@kgpai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kgpai Yes, cpr can either use a system version of curl of download a custom one (which this PR let's us influence without having to patch cpr), with conda we would make it use the system version that we installed via conda. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Summary: After #7853, compiling cpr still takes up a significant amount of time because cpr try fetch and compile ZLIB, which breaks offline build. However, ZLIB has already been found by find_package(ZLIB, REQUIRED), let's avoid recompile ZLIB when compiling curl for cpr. https://github.com/libcpr/cpr/blob/51915127d9b4b9f75965b239a5cd7a765722d1df/CMakeLists.txt#L202-L209 Pull Request resolved: #8257 Reviewed By: xiaoxmeng Differential Revision: D52631339 Pulled By: kgpai fbshipit-source-id: 57a435a6f550f9fa08e685d2805b5aceea61e480
Summary: After facebookincubator#7853, compiling cpr still takes up a significant amount of time because cpr try fetch and compile ZLIB, which breaks offline build. However, ZLIB has already been found by find_package(ZLIB, REQUIRED), let's avoid recompile ZLIB when compiling curl for cpr. https://github.com/libcpr/cpr/blob/51915127d9b4b9f75965b239a5cd7a765722d1df/CMakeLists.txt#L202-L209 Pull Request resolved: facebookincubator#8257 Reviewed By: xiaoxmeng Differential Revision: D52631339 Pulled By: kgpai fbshipit-source-id: 57a435a6f550f9fa08e685d2805b5aceea61e480
Add a
curl.cmake
dependency inCMake/resolve_dependency_modules
, so thatwe would be able to specify VELOX_CURL_URL to a local path to enable offline
build.