-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
cmake: add compiler + remove compiler.version to reduce number of builds #1783
Conversation
Failure in build 1 (
|
recipes/cmake/3.x.x/conanfile.py
Outdated
@@ -54,6 +54,10 @@ def package(self): | |||
cmake.install() | |||
tools.rmdir(os.path.join(self.package_folder, "doc")) | |||
|
|||
def package_id(self): | |||
# CMake is a executable-only package, so the compiler version does not matter |
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.
It matters since a system might be missing the runtimes. It won't fix the related issue. CCI will build one MSVC package using the 2015 runtimes, but the target system is a 2017 so it won't be able to execute
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.
Building with 2015 is fine, it’ll work with the 2015 - 2019 runtimes.
https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2019
Removing the compiler ver may not be a best practice, because if CCI is upgraded to build with 2017+ and the system only had the 2015 runtime, that wouldn’t work.
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.
That's a very good point, however these recipes can be used to generate a package for 2013 locally, and the same scenario would cause trouble.
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.
To what runtime do the official cmake windows builds link?
The only problem I see with removing version in package_id, is the loss of reproduceability as the ci can build cmake using whatever version of msvc it pleases.
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.
Would it make sense to only allow static runtime? Or should we just build all variants of cmake and don't bother with limiting anything?
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.
https://gitlab.kitware.com/cmake/cmake/-/tree/master/.gitlab/ci looks like vs2019
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 like the official build uses the static runtime. This is the latest release:
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'd prefer to build static runtime for CMake (and built tools in general), this will avoid a dependency on Visual Studio CRT redist, which is not necessarily available (especially, if I am using alternate compiler).
All green in build 2 (
|
cmake does not build without openssl-devel
recipes/cmake/3.x.x/conanfile.py
Outdated
@@ -14,6 +14,8 @@ class CMakeConan(ConanFile): | |||
generators = "cmake" | |||
settings = "os", "arch", "compiler", "build_type" | |||
|
|||
requires = "openssl/1.1.1g" |
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.
openssl isn't enabled by default on Windows, I think this requires needs to be os specific
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.
Thanks for the link.
I'll have to add the CMAKE_USE_OPENSSL
option.
Some configurations of 'cmake/3.16.2' failed in build 3 (
|
Some configurations of 'cmake/3.16.2' failed in build 4 (
|
Would it be possible to make this package entirely self-contained (only build dependencies, only os and host architecture settings)? Would it be possible to link all dependencies statically, incl. runtime libs? The same applies to many binary tool packages. The reason I ask this is that I may want to use binary tools without even having a suitable compiler profile set up on my host or when using an exotic toolchain that the package has not been compiled for. Otherwise I would have to force certain settings just for these packages which is rather inconvenient. That being said, the CMake package should only come in 3 variants: Macos, Windows, Linux and architecture x86_64. It might make sense to build it for Linux arm as well. |
All green in build 6 (
|
@rweickelt I agree, valid points |
I think I addressed @rweickelt 's concerns.
I think this covers all spectrum and still allows each user to build cmake with his compiler of choice. |
Isn't keeping build_type as a setting and making debug an invalid setting going to cause issues for people building with a debug build_type? |
Also, if we're removing the compiler version from the package_info, do we not also need to use the static runtime for the other platforms? They're going to run into the same issues if we, for example, try to run a gcc9 compiled binary on a gcc5 system. Edit: Seems like the same conversation going on in #213 |
@madebr, thanks, but what if my (consuming) recipe is built with the SDCC or IAR or an Intel toolchain and has So I am wondering: The recipe contains
Note that I assume that this package will always and only be used as a build-only dependency in other recipes. In that case, the toolchain used for creating this (CMake) package does absolutely not matter. It is sufficient that a working binary package for the host os and architecture is available on bintray. Thanks. |
This will introduce a limitation if you use cmake as a requirement (host os/arch).
This is a way to make this recipe build a specific os/arch/build_type but don't let the the compiler.version matter.
If this recipe is used as a build requirement, then there is no connection between the settings of the consuming recipe and that of cmake.
It does affect, but the current patches only allow
Indeed. @jgsogo @uilianries @SSE4 @Croydon My view is that the recipe should include e.g. the CI should only build one combination if the property |
I think we agree that the CMake package should only be a build requirement.
But if compiler information is still part of the package_id, how would my consuming recipe (which may use completely different compiler settings) be able to deduce the package_id of the CMake package? That confuses me. |
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.
Hi! Sorry for the delay. Too much work piled up.
We currently don't have a way to identify "installer packages", so they are exactly the same as any other package... and, given it is a Conan limitation, and we don't have (yet) time/build time constraints, I won't limit the number of binaries generated. We are thinking about a way to flag these and other types of packages, but it would be something for Conan 2.0, not before.
With the new cross-building approach, where the build context requires a full profile, I wouldn't avoid (by raising ConanInvalidConfiguration) any configuration that works to build the library. The problem here is that this build_requires
can belong to a big graph with other build_requirements
and some configuration (debug, MD,...) can be needed for them.... and Conan applies the same build-profile for all the packages in the build context. We cannot block that big graph just because one of the packages cannot compile in debug mode.
If it takes too much time to generate all the packages, this is something we can think about and see how can we improve it in Conan Center infrastructure and, if needed, we might add something to Conan itself.
recipes/cmake/3.x.x/conanfile.py
Outdated
|
||
del self.info.settings.compiler | ||
del self.info.settings.build_type |
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.
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. I understand that the desired scenario would be to remove these settings but to be able to tell C3i that we want to build the Release
build.... that way, when someone retrieves the package from CCI it will be the good one.
This is not possible right now, the only alternative is to build them all 😞
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'll apply both suggestions then.
Is there already an issue open on github about this?
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.
No, none of the two issues here, but both are really hard to tackle.
From the CCI perspective we don't want to run a different pipeline based on custom attributes and Conan right now doesn't have a feature to classify packages (and IMO we don't need it yet). The other issue: being able to assign different build profiles to different branches of the graph, requires a new graph model, something we are working for Conan 2.0, but it will require time to implement.
So, for the time being, we are building ~100 packages for each CMake version even though we will probably use only a dozen of them
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.
Can't you just add an entry in the top-level yml file for telling cci which permutations to build? If 'compiler' and 'build_type' are removed from the exported 'package_id', no consumer should ever need to rebuild this package, no matter what profile they use. Or am I missing something?
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.
We can think about different alternatives to tell CCI which configurations to build and probably it is about something in the config.yml
file as you have suggested. OTH, if we remove build_type
from the package ID we cannot guarantee (at this moment) that CCI will choose Release
build (this was the issue originating this PR, I think).
Even though these things might look almost trivial, they are not as straightforward as they look like, and there are other things in the backlog with higher priority. We would really want to address all these issues, but we need to go step by step.
Some configurations of 'cmake/3.17.2' failed in build 11 (
|
@uilianries @danimtb @jgsogo It looks like the CI/conan is ignoring some errors while extracting the sources. |
An unexpected error happened and has been reported. Help is on its way! 🏇 |
All green in build 13 (
|
Currently I don't have much time for Conan related issues, but I'm kinda surprised by this issue to begin with Shouldn't static linking handling this? Adding now all combinations for all installer packages feels fundamental wrong |
Cci build systems are missing functionality to not build combinations, even though the recipe allows it to.
It feels not. We should separate what we want the recipe to build and what we want to provide on bintray. |
Hi! Back here, first of all I want to apologize for introducing too much noise in my last comments (and more on this one). We've been talking about this issue because we had different opinions about these installers and we need to agree on how we want to handle them in Conan Center. We think that the best approach is as follows: Note.- Here I'm referring to packages that only contain executables, if they contain libraries that are consumed by other packages then they should be managed as regular packages. So, let's talk about pure installers, packages with executables only.
The main issue with this approach right now is that we cannot guarantee the order CCI uses to iterate the profiles, it means that we cannot be sure that the chosen configuration will be the one we expect. We are working on this, but it will take time (two weeks?). Meanwhile, we can stop this PR, or we can generate all these settings combinations and remove them afterward when the functionality required is implemented in CCI. I hope this makes sense to everybody. Thanks for pushing so hard! |
Finally, thanks! ❤️ |
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 we need this PR while we ensure that profiles in CCI are iterated in order.
Specify library name and version: cmake/all
For #1705 : by adding compiler to the package_id, the ci will/should build a package for
Visual Studio
wherecompiler.runtime
is not a debug runtimeconan-center hook activated.