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

Eating Our Own Ice Cream: Use Conan's CMake recipe #241

Closed
wants to merge 12 commits into from

Conversation

Croydon
Copy link
Contributor

@Croydon Croydon commented Jan 5, 2021

Changelog: Feature: Use a Conan build of CMake for our build images

https://en.wikipedia.org/wiki/Eating_your_own_dog_food#Alternative_terms

Let's try this first with CMake and get some experience. Later we can

  • move more dependencies like this.
  • Particular the compilers itself once GCC and LLVM recipes are ready for that. This would makes us vastly more independent of specific Ubuntu versions.
  • @madebr is working on a Python recipe, maybe this will work well too ✌️


Some explanations:

  • GCC 4.6 is too old to build CMake. Hence we download the official binaries von Kitware. This works because this image is 64 bit and there is no GCC 4.6 32 bit container. Kitware does not provide 32 bit binaries. (And these old containers should probably be removed anyways, Are Clang 3.8, GCC 4.6 and and GCC 4.8 images still used? #240)
  • Our CMake recipe is building CMake with CMake
  • Bootstraping of CMake works via make
  • For most other compiler versions, except the newest, we do have 32 bit containers. Here, we can not use the official binaries, but rather we compile the source code and bootstrap a CMake build via make.
  • Under regular circumstances, we already have Conan packages for CMake available which can be just downloaded. However, who knows what could happen, so these containers should be able to bootstrap. Only when the Conan remote offers no CMake packages to download, we build the Conan CMake recipe with the CMake binary we acquired previously
  • The final image only contains a CMake which was build via Conan (except the GCC 4.6 image)
  • In the future, we might want to add a bootstrap option directly to the CMake Conan recipe, but for now, this is fine
  • This also works good as a proof-of-concept and this workflow can be used eventually for the compilers, the Python runtime and probably other packages too. But let's see how this performs in practice with CMake as this is ready-to-go right now and much less complex than those other packages

@Croydon Croydon mentioned this pull request Jan 5, 2021
@Croydon Croydon marked this pull request as ready for review January 9, 2021 20:44
@Croydon
Copy link
Contributor Author

Croydon commented Jan 9, 2021

Ready!

clang_9/Dockerfile Outdated Show resolved Hide resolved
@Croydon
Copy link
Contributor Author

Croydon commented Jan 19, 2021

May I get some feedback here? @uilianries @danimtb @czoido 😃

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I like this idea

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I'm a bit concerned about these changes to these images.

I totally agree we should eat our own dog food and, if these docker images were distributed ONLY to outside parties, I'd totally support installing these tools using Conan. It totally makes sense: Conan generates docker images and uses Conan to install tools 💯

BUT, these images are used in conan-center-index too, these images are the ones we use to compile and generate packages, this CMake is the one we use to compile the packages (cmake/3.18.5 too). If we break cmake package and update the docker image, we can't recover, we won't be able to compile CMake in conan-center-index because the installed CMake is broken.

This is very unlikely, but there is a risk (and some headache) we can avoid. We can talk about this, but we need to be sure about what we are doing and why, it requires some consensus. Maybe we need to differentiate between the images we use in C3i (use an independent mechanism to install tools) and other ones we could start to distribute as "Conan images ready to build your binaries".

@uilianries
Copy link
Member

I like how @jgsogo predict possible failures involving CCI and CDT, indeed the risk is real.

What about installing a specific package revision? So we could prevent any possible broken package.

@uilianries
Copy link
Member

@Croydon Sorry for creating a conflict with your PR 😞

@Croydon
Copy link
Contributor Author

Croydon commented Jan 20, 2021

I think splitting containers would be the worst possible thing we could do, so personally, I'm against that.

You have a good point to worry about a dead lock situation.

Some ideas:

  1. we leave it as it is, if
    * a new recipe revision breaks, we can update the containers by specifying a specific revision
    * the entire Conan remote breaks, we could still check out the recipe from git and leave the rest unchanged
  2. we specify right now a specific recipe revision, however, that would mean constant updating work and might be super annoying and confusing. To minimize this, we might want to only update the revision when updating the CMake version itself
  3. we check out the recipe right now from git, but this might be an unnecessary complication for an unlikely dead lock situation, in which case we could still do this

I think that 2) might be actually the best idea 🤔

@Croydon
Copy link
Contributor Author

Croydon commented Jan 20, 2021

I pinned the CMake recipe revision

@Croydon
Copy link
Contributor Author

Croydon commented Jan 20, 2021

As another note, it is pretty unlikely that we deploy new Docker images with a broken CMake since the CI here is building Conan packages with CMake in the tests

@Croydon
Copy link
Contributor Author

Croydon commented Feb 8, 2022

Closing this as it would require a complete rewrite by now.

However, some of the concepts are merged by now, like using different container layers, so that temporary files don't get into the final container, using more parameters to configure things and starting to use Conan packages for creating the containers itself (#370) 👏

@Croydon Croydon closed this Feb 8, 2022
@uilianries
Copy link
Member

@Croydon Thank you for sharing this idea. Indeed we started to think about using Conan packages instead of APT packages on "modern" Docker images. Binutils is a good start because we didn't find the latest version available from an external PPA and building from source would consume even more time when creating a Docker image. As next step, probably we will internalize other tools which are available in Conan Center, or convert them to Conan packages, e.g. git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants