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

feat: create google-cloud-cpp-core feedstock #24315

Merged
merged 32 commits into from
Dec 5, 2023
Merged

feat: create google-cloud-cpp-core feedstock #24315

merged 32 commits into from
Dec 5, 2023

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Oct 19, 2023

google-cloud-cpp is too large to compile in a single feedstock. The CI builds timeout before all the code is compiled.

This PR proposes a new google-cloud-cpp-core feedstock for google-cloud-cpp that packages (1) the common libraries used by all google-cloud-cpp features, and (2) the most popular features of google-cloud-cpp.

These packages are small enough to compile in a single feedstock.

Future PRs will introduce other feedstocks that package more features of google-cloud-cpp.

In these new feedstocks the runtime packages are named libgoogle-cloud-{feat}, and the development packages are named libgoogle-cloud-{feat}-devel.

The libgoogle-cloud / libgoogle-cloud-devel package pair contains the common libraries used by all (or nearly all) subpackages.

There are over 100 libraries in google-cloud-cpp, most of them are small, and most of them see little use. It is not worthwhile to create packages for all these libraries. In a future PR we will introduce the libgoogle-cloud-all and libgoogle-cloud-all-devel packages as catch alls for the smaller and less used features.


When reviewing the checklist below a couple of things to notice:

  • The package ships static libraries on Windows. It is impossible to ship DLLs at the moment. The existing feedstock ships static libraries. There is ongoing work to enable DLLs.
  • The maintainers are already in the google-cloud-cpp feedstock. Happy to update the list as needed.

I deviated from the discussion in conda-forge/google-cloud-cpp-feedstock#141 and used libgoogle-cloud-common as the name for the common library. Using libgoogle-cloud looks like would break existing downstream packages and projects.

Part of the work for conda-forge/google-cloud-cpp-feedstock#141


Checklist

  • Title of this PR is meaningful: e.g. "Adding my_nifty_package", not "updated meta.yaml".
  • License file is packaged (see here for an example).
  • Source is from official source.
  • Package does not vendor other packages. (If a package uses the source of another package, they should be separate packages or the licenses of all packages need to be packaged).
  • If static libraries are linked in, the license of the static library is packaged.
  • Package does not ship static libraries. If static libraries are needed, follow CFEP-18.
  • Build number is 0.
  • A tarball (url) rather than a repo (e.g. git_url) is used in your recipe (see here for more details).
  • GitHub users listed in the maintainer section have posted a comment confirming they are willing to be listed there.
  • When in trouble, please check our knowledge base documentation before pinging a team.

`google-cloud-cpp` is too large to compile in a single feedstock. The CI
builds timeout before all the code is compiled.

This PR proposes a new `google-cloud-cpp-core` feedstock for
`google-cloud-cpp` that packages (1) the common libraries used by all
`google-cloud-cpp` features, and (2) the most popular features of
`google-cloud-cpp`.

These packages are small enough to compile in a single feedstock.

Future PRs will introduce other feedstocks that package more features of
`google-cloud-cpp`.

In these new feedstocks the runtime packages are named
`libgoogle-cloud-{feat}`, and the development packages are named
`libgoogle-cloud-{feat}-devel`.

The `libgoogle-cloud` / `libgoogle-cloud-devel` package pair contains
the common libraries used by all (or nearly all) subpackages.

There are over 100 libraries in `google-cloud-cpp`, most of them are
small, and most of them see little use. It is not worthwhile to create
packages for all these libraries. In a future PR we will introduce the
`libgoogle-cloud-all` and `libgoogle-cloud-all-devel` packages as catch
alls for the smaller and less used features.
@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/google-cloud-cpp-core) and found some lint.

Here's what I've got...

For recipes/google-cloud-cpp-core:

  • Selectors are suggested to take a <two spaces>#<one space>[<expression>] form. See lines [30, 79, 197, 278]

@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipes/google-cloud-cpp-core) and found it was in an excellent condition.

@coryan coryan marked this pull request as ready for review October 20, 2023 19:49
@coryan
Copy link
Contributor Author

coryan commented Oct 20, 2023

@xhochy @h-vetinari

After I made a hilarious number of mistakes with the Windows builds, I think this is ready for review.

I could use some help with the osx build, the errors are in Abseil headers, from code generated by Protobuf. I would have expected this to just work, as both Abseil and Protobuf area already packaged. Any clues?

@coryan
Copy link
Contributor Author

coryan commented Oct 20, 2023

Ahh, looks like this builds with a different SDK:

This fails:
+SDKROOT=/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk

https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=808627&view=logs&j=e35d4f76-8ff2-5536-d795-df91e63eb9f7&t=fa7b4b17-b6ff-5c9c-8cfc-15f888c92310&l=253

vs.

This works:
+SDKROOT=/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=799820&view=logs&j=58ac6aab-c4bc-5de2-2894-98e408cc8ec9&t=933f325c-924e-533d-4d95-e93b5843ce8b&l=186

@xhochy
Copy link
Member

xhochy commented Oct 21, 2023

You should be able to select the macOS SDK with a conda_build_config.yaml as done in a feedstock. It should be placed alongside the meta.yaml.

@coryan
Copy link
Contributor Author

coryan commented Oct 22, 2023

Okay, all the tests are passing now. Please take another look.

@coryan
Copy link
Contributor Author

coryan commented Oct 25, 2023

Ping?

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

This is a very high-quality PR, thanks a lot @coryan! 🙏

Just a few questions and smaller comments.

W.r.t.

I deviated from the discussion in conda-forge/google-cloud-cpp-feedstock#141 and used libgoogle-cloud-common as the name for the common library. Using libgoogle-cloud looks like would break existing downstream packages and projects.

Can you elaborate what would break? Given the pinning & run-export on google-cloud-cpp, these new packages would not be pulled in without a migration, and such a migration would enable us to validate whether given feedstocks need more than the common libs (there aren't that many consumers anyway).

I don't feel too strongly, but out of the 3 libgoogle-cloud{,-common,-all}, I feel that 2 should suffice.

Though I guess we could have an additional level between the core package and the -all package in the form of "all the outputs of this feedstock together", if that's a grouping that'd be useful (if only to not have to sync the exact list of outputs of this feedstock into google-cloud-cpp).

recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/build.sh Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
@coryan
Copy link
Contributor Author

coryan commented Oct 30, 2023

Ping?

@coryan
Copy link
Contributor Author

coryan commented Nov 2, 2023

@h-vetinari @xhochy any thoughts?

@coryan
Copy link
Contributor Author

coryan commented Nov 8, 2023

Ping?

@h-vetinari
Copy link
Member

Will try to take a look early next week. Sorry for the wait, busy times, not a lot of FOSS time (and lots of notifications...)

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

Basically this looks very good, though a couple of minor points remain.

The one thing that worries me is that test_subpackage("common") apparently succeeded where that should be impossible after the removal of that suffix, which means we'll have to be very careful that the macro-approach works correctly.

recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/bld.bat Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/install-libgoogle-cloud.bat Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/install-libgoogle-cloud.sh Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
@coryan
Copy link
Contributor Author

coryan commented Nov 27, 2023

Thanks for the review. Please take another look.

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

Aside from some small remaining nits, this LGTM, thanks a lot @coryan! 🥳

Given that this PR is a bit unusual in that:

  • we're splitting up an existing recipe that times out due to CI constraints (see discussion)
  • due to the similarity of the subcomponents, a lot of functionality is broken out into macros

... I'd like to ask for some more eyes on this if possible.

PTAL @conda-forge/help-c-cpp

CC @conda-forge/core

recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
recipes/google-cloud-cpp-core/meta.yaml Outdated Show resolved Hide resolved
@h-vetinari
Copy link
Member

CC @beckermr @wolfv @jakirkham @isuruf about the macro usage

@h-vetinari
Copy link
Member

Last call for comments, will merge on Tuesday otherwise.

@h-vetinari h-vetinari merged commit 6a54192 into conda-forge:main Dec 5, 2023
4 checks passed
Comment on lines +3 to +4
MACOSX_DEPLOYMENT_TARGET:
- 10.13 # [osx and x86_64]
Copy link
Member

Choose a reason for hiding this comment

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

Seeing issues with feedstock creation for this recipe. Think it has to do with the fact that we are modifying MACOSX_DEPLOYMENT_TARGET, but not restricting that modification to osx and x86_64, which has an adverse affect on other architectures (like osx and arm64). So think we want to add a selector to MACOSX_DEPLOYMENT_TARGET (as shown below)

Suggested change
MACOSX_DEPLOYMENT_TARGET:
- 10.13 # [osx and x86_64]
MACOSX_DEPLOYMENT_TARGET: # [osx and x86_64]
- 10.13 # [osx and x86_64]

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, done in d4fe07d

Copy link
Member

Choose a reason for hiding this comment

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

Not sure what's happening here. The create_feedstocks job still failed, but an empty https://github.com/conda-forge/google-cloud-cpp-core-feedstock got created already.

@jakirkham
Copy link
Member

Hmm...looking at a recent feedstock conversion job it still fails. This is happening as part of conda-build attempting to parse the recipe (with some guidance from conda-smithy). It looks like it is having some trouble understand the outputs of the recipe

  File "/home/runner/Miniforge3/lib/python3.10/site-packages/conda_build/metadata.py", line 2146, in extract_single_output_text
    output = output_matches[output_index] if output_matches else ""
IndexError: list index out of range

@h-vetinari
Copy link
Member

It looks like it is having some trouble understand the outputs of the recipe

This might be related to the use of jinja macros...? Though the CI here was fine, so it's running in some other configuration...

@jakirkham
Copy link
Member

jakirkham commented Dec 5, 2023

Not sure. Maybe the thing to do would be to debug this locally?

For whoever might try this, would suggest installing conda-smithy and trying the following

# Clone and `cd` into `staged-recipes` (if not already done)
git clone https://github.com/conda-forge/staged-recipes
cd staged-recipes/recipes

# Use `conda-smithy` to create repo locally
conda smithy init google-cloud-cpp-core
cd google-cloud-cpp-core-feedstock
conda smithy rerender -c auto

That should reproduce the same error

@coryan coryan deleted the feat-shard-google-cloud-cpp-pr1 branch December 5, 2023 12:46
@coryan
Copy link
Contributor Author

coryan commented Dec 5, 2023

It looks like it is having some trouble understand the outputs of the recipe

This might be related to the use of jinja macros...? Though the CI here was fine, so it's running in some other configuration...

It is not the Jinja macros, at least not yet. The function is called with output_name == "google-cloud-cpp-core". It searches for an entry in outputs with name == "google-cloud-cpp-core". There is no such entry because I did not realize one was needed. Should I declare one?

Alternatively, we can rename the feedstock:

git diff
diff --git a/recipes/google-cloud-cpp-core/meta.yaml b/recipes/google-cloud-cpp-core/meta.yaml
index f5e0c9a45d..aa74b0cf72 100644
--- a/recipes/google-cloud-cpp-core/meta.yaml
+++ b/recipes/google-cloud-cpp-core/meta.yaml
@@ -139,7 +139,7 @@ test:
 {%- endmacro %}
 
 package:
-  name: google-cloud-cpp-core
+  name: libgoogle-cloud
   version: {{ version }}
 
 source:

That worked locally, using the conda smithy rerender -c auto repro. Thoughts?

@jakirkham
Copy link
Member

If you are ok changing the top-level package name, that sounds like a good plan

Think feedstock-name ends up being used for the actual feedstock created. Though not aware of many recipes using this feature. So don't know how well that code path is tested

If this sounds reasonable @coryan , could you please open a PR to make the change?

@h-vetinari
Copy link
Member

I think what's happening is that we're running into conda/conda-build#5097

@h-vetinari
Copy link
Member

That worked locally, using the conda smithy rerender -c auto repro. Thoughts?

No, that's not a good idea. In multi-output recipes the recipe-name (under package:) should never match one of the outputs (or you get very counter-intuitive behaviour).

@jakirkham
Copy link
Member

Hmm...thought the top-level package name was conflicting and we were renaming it not to conflict. Maybe I misunderstood the proposed change

@coryan
Copy link
Contributor Author

coryan commented Dec 8, 2023

That worked locally, using the conda smithy rerender -c auto repro. Thoughts?

No, that's not a good idea. In multi-output recipes the recipe-name (under package:) should never match one of the outputs (or you get very counter-intuitive behaviour).

TIL.

I think what's happening is that we're running into conda/conda-build#5097

The putative fixes for this bug do not seem to work:

~/miniconda3/bin/conda list conda-build

# packages in environment at /usr/local/google/home/coryan/miniconda3:
#
# Name                    Version                   Build  Channel
conda-build               3.28.1          py311h38be061_0    conda-forge

and yet:

conda smithy rerender -c auto

INFO:conda_smithy.configure_feedstock:Downloading conda-forge-pinning-2023.12.08.01.46.42
INFO:conda_smithy.configure_feedstock:Extracting conda-forge-pinning to /usr/local/google/home/coryan/.cache/conda-smithy
INFO:conda_smithy.configure_feedstock:__pycache__ rendering is skipped
INFO:conda_smithy.configure_feedstock:README rendering is skipped
WARNING: Setting build platform. This is only useful when pretending to be on another platform, such as for rendering necessary dependencies on a non-native platform. I trust that you know what you're doing.
WARNING: Setting build arch. This is only useful when pretending to be on another arch, such as for rendering necessary dependencies on a non-native arch. I trust that you know what you're doing.
WARNING: No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.22
Adding in variants from internal_defaults
Adding in variants from /usr/local/google/home/coryan/.cache/conda-smithy/conda_build_config.yaml
Adding in variants from argument_variants
Adding in variants from /usr/local/google/home/coryan/staged-recipes/recipes/google-cloud-cpp-core-feedstock/recipe/conda_build_config.yaml
Traceback (most recent call last):
  File "/usr/local/google/home/coryan/miniconda3/bin/conda-smithy", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/cli.py", line 725, in main
    args.subcommand_func(args)
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/cli.py", line 585, in __call__
    self._call(args, tmpdir)
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/cli.py", line 590, in _call
    configure_feedstock.main(
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/configure_feedstock.py", line 2552, in main
    render_azure(env, config, forge_dir, return_metadata=True)
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/configure_feedstock.py", line 1520, in render_azure
    return _render_ci_provider(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/configure_feedstock.py", line 807, in _render_ci_provider
    dump_subspace_config_files(
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/configure_feedstock.py", line 479, in dump_subspace_config_files
    configs, top_level_loop_vars = _collapse_subpackage_variants(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_smithy/configure_feedstock.py", line 335, in _collapse_subpackage_variants
    top_level_loop_vars = list_of_metas[0].get_used_loop_vars(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_build/metadata.py", line 2620, in get_used_loop_vars
    for var in self.get_used_vars(
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_build/metadata.py", line 2723, in get_used_vars
    meta_yaml_reqs = self._get_used_vars_meta_yaml(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_build/metadata.py", line 2798, in _get_used_vars_meta_yaml
    reqs_text, recipe_text = self._get_used_vars_meta_yaml_helper(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_build/metadata.py", line 2781, in _get_used_vars_meta_yaml_helper
    ) + self.extract_single_output_text(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/coryan/miniconda3/lib/python3.11/site-packages/conda_build/metadata.py", line 2146, in extract_single_output_text
    output = output_matches[output_index] if output_matches else ""
             ~~~~~~~~~~~~~~^^^^^^^^^^^^^^
IndexError: list index out of range

Comment on lines +141 to +143
package:
name: google-cloud-cpp-core
version: {{ version }}
Copy link
Member

Choose a reason for hiding this comment

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

Don't think issue ( conda/conda-build#5097 ) applies as package/version is defined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. I am a little out of my depth here.

Should I rollback the PR and start over?
Should I manually expand the Jinja macros?
Should I assume conda-build needs a fix and try to figure it out?

Copy link
Member

Choose a reason for hiding this comment

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

Don't think issue ( conda/conda-build#5097 ) applies as package/version is defined

But they're not defined for every output, which is what I understood that issue to be about

Copy link
Member

Choose a reason for hiding this comment

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

The issue says top level

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I manually expanded the Jinja macros, that seems to work: #24818

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

Successfully merging this pull request may close these issues.

4 participants