-
Notifications
You must be signed in to change notification settings - Fork 438
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
Enable generating deb, rpm, NuGet, tgz, zip package through cmake build #1662
Conversation
Will we consider add the same generation for bazel? |
We use cpack config generator to generate these packages, I don't know if bazel provide any such support. |
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.
Should we also set CPACK_PACKAGE_HOMEPAGE_URL
to https://opentelemetry.io/docs/instrumentation/cpp/
or https://opentelemetry.io
?
And is it better to move the shared options to a standalone file? I think CPACK_RPM_PACKAGE_DESCRIPTION
, CPACK_PACKAGE_VENDOR
, CPACK_PACKAGE_VERSION_MAJOR
, CPACK_PACKAGE_VERSION_MINOR
and etc. could be set by all generators.
Ok in principle, but in my understanding packaging can become really complicated really fast, so this needs analysis. For example:
Packaging will be needed at some point, especially to help adoption from distributions, so it is a valid and valuable thing to do. Before we get to packaging, I think the following is needed as a pre-requisite:
|
Thanks @marcalff , these are valid concerns raised. Trying to answer some of them
I think we shouldn't ship dependencies inside the package. As of now, we are adding these dependencies to the package, so the package installation should fail if they are missing.
We don't release these components separately or have different version numbers for these components. In that case, it makes sense to release them as a single package. Also to some extent, it is customizable using cmake build. So the below command will generate API only package. $ cmake .. -DWITH_API_ONLY=ON && make && cpack -G DEB And to have a package for Zipkin exporter $ cmake .. DWITH_ZIPKIN=ON && make && cpack -G DEB
We can let the user decide which to pick based on the cmake options used.
Agree. This is highly driven by our cmake install rules defined in CMakeLists.txt. We do try to define the exclude rules for header files at some of the places, but this needs to be investigated more thoroughly. |
I tried to build rpm package on CentOS8/RedHat8 using my custom code listed in #1752 . I have noticed following issues when I did this. Please address them in this pull request or other one(s) as necessary:
|
Good point. Have set |
cmake/package.cmake
Outdated
@@ -0,0 +1,45 @@ | |||
|
|||
if (UNIX AND NOT APPLE) |
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.
Why only set cpack variables on Unix like systems?We can still use CPack archive generator on most system and use NuGet generator on Windows.
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.
Agree, at least we can get a tarball on MacOS.
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.
Good point. Have added TARBALL cmake option to create tarball on Linux and Mac. I am still testing the changes for NuGet generation, so if it takes more time will add it in separate PR.
@sirzooro Help me understand it here. Even if we move the protobuf/grpc headers from public otel-cpp headers to cc file ( which is definitely a right step, and I will raise a PR for this), the linking will still fail if protobuf or grpc is not installed. Regarding adding |
opentelemetry-cpp library needs protobuf and protobuf-devel to be built, this is fine. My point is that when when I have rpm ready, it should be enough to install opentelemetry-cpp and protobuf only in order to build client apps which use it. Now I have to also install protobuf-devel too. PR which you are going to create will fix this. You can verify this fix in your CI tests by building opentelemetry-cpp rpm first, then start new docker instance, install it inside it (all dependencies like protobuf will be installed automatically too) and try to build some test app. Last step should succeed without having to explicitly install protobuf-devel inside that docker. |
I have tested changes on CentOS8 and RedHat8 and was able to build rpm without any issues. |
Got it, thanks for explanation, it makes sense now. Have incorporated the suggested changes. @owent - I have also incorporated the changes suggested by you. Can you please review it again when you have time. Thanks. |
There is still a typo problem above |
Thanks @owent . This got missed, have fixed it now. |
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
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.
In my (limited) understanding of packaging, this PR produces a package which contents depends on the CMake options used at build time (with/without STL, various exporters, etc).
While this is a good step towards packaging, my concern is that this will need to be revised later, so we should be careful about user expectations, in particular if someone starts to take this into a distribution.
Ok to merge to main, with a big note to clarify that packaging is still experimental, and subject to changes.
In the long term, I think we will need:
- a package for opentelemetry-cpp-api, to be used (alone) by libraries instrumenting their code
- a package for opentelemetry-cpp-sdk, to be used when linking an application with the sdk
- several packages, opentelemetry-cpp-exporter-name, to use exporters as needed.
Thanks for the comments @marcalff. I agree, It would be good to add a note that the packaging is experimental for now, and users may have to customize it further before using it as distribution. In general, package generation using CMake is used across C++/C projects like opencv, maridb, zerodb, poco and is well received within community. This allows us to generate |
Added a note -
|
Add support for generating platform specific binary packages:
Linux : deb , rpm, tgx
Windows : NuGet, zip
While we still don't deliver any such binary package, just facilitate the package generation if someone wants to use it.