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

py3-grpcio-tools/1.68.0 package update #34288

Closed
wants to merge 2 commits into from

Conversation

octo-sts[bot]
Copy link
Contributor

@octo-sts octo-sts bot commented Nov 16, 2024

@octo-sts octo-sts bot added request-version-update request for a newer version of a package automated pr labels Nov 16, 2024
Copy link
Contributor Author

octo-sts bot commented Nov 16, 2024

Gen AI suggestions to solve the build error:

Based on the error messages, this appears to be a compilation issue related to Abseil's hash table implementation when building grpcio-tools 1.68.0. Here are some suggestions to resolve the issue:

  1. Add C++ compiler flags to fix the constant expression error:
environment:
  contents:
    packages:
      - build-base
      - busybox
      - ca-certificates-bundle
      - cython
      - git
      - openssf-compiler-options
      - py3-setuptools
      - py3-wheel
      - python3
      - python3-dev
      - wolfi-base
  environment:
    CXXFLAGS: "-fno-strict-aliasing"
  1. Pin to a specific version of Abseil that's known to work with this version of gRPC:
environment:
  contents:
    packages:
      - abseil-cpp=20230125.3 # Add specific version
      # ... rest of packages
  1. Try adding C++17 compiler flag since the error involves constexpr:
environment:
  environment:
    CXXFLAGS: "-std=c++17"
  1. Add gcc/g++ explicitly to build dependencies:
environment:
  contents:
    packages:
      - gcc
      - g++
      # ... rest of packages

I recommend trying these solutions in this order:

  1. First try adding the CXXFLAGS with -fno-strict-aliasing
  2. If that doesn't work, try adding C++17 flag
  3. If still failing, try pinning abseil-cpp version
  4. Finally try adding explicit gcc/g++ dependencies

The error seems to be related to how constexpr is being handled in the Abseil hash table implementation, which these changes should help address by either relaxing some compiler restrictions or ensuring compatible versions are used.

When debugging locally with --interactive, you can try rebuilding with these flags manually to verify they fix the issue before updating the melange yaml.

@rawlingsj rawlingsj closed this Nov 18, 2024
@rawlingsj rawlingsj reopened this Nov 18, 2024
@rawlingsj rawlingsj added the approved-to-run A repo member has approved this external contribution label Nov 18, 2024
@rawlingsj rawlingsj closed this Nov 18, 2024
@rawlingsj rawlingsj reopened this Nov 18, 2024
@rawlingsj rawlingsj force-pushed the wolfictl-212e1aae-906c-490d-86e0-0c9fadc9ba76 branch from 604fffc to 9a278f1 Compare November 18, 2024 18:16
Copy link
Contributor Author

octo-sts bot commented Nov 18, 2024

Gen AI suggestions to solve the build error:

• Detected Error:

error: '(absl::lts_20240722::container_internal::TypeErasedApplyToSlotFn<StringHash, std::__cxx11::basic_string<char> > == 0)' is not a constant expression

• Error Category: Build Configuration/Compiler Error

• Failure Point: C++ compilation failing due to Abseil hash policy traits implementation

• Root Cause Analysis: The error occurs because of incompatibility between the C++ compiler's constant expression evaluation and Abseil's hash policy implementation in version 1.68.0 of gRPC

• Suggested Fix:
Add the following environment variable to the build pipeline:

environment:
  contents:
    packages:
      # ... existing packages ...
  environment:
    CXXFLAGS: "-DABSL_INTERNAL_LEGACY_HASH_NAMESPACE=std"

• Explanation:
This fix forces Abseil to use the standard library's hash implementation instead of its internal one, avoiding the constant expression evaluation issue. This is a known workaround for this specific compilation error with newer versions of gRPC and Abseil.

• Additional Notes:

  • This is a temporary workaround until upstream fixes the constant expression issue
  • Does not impact runtime performance or functionality
  • Alternative approach would be to pin to an earlier version of gRPC, but that's not recommended for security reasons
  • This change only affects build-time behavior

• References:

Copy link
Contributor Author

octo-sts bot commented Nov 18, 2024

Gen AI suggestions to solve the build error:

Based on the error output, here's my analysis and suggested fix:

• Detected Error: '(absl::lts_20240722::container_internal::TypeErasedApplyToSlotFn<StringHash, std::__cxx11::basic_string<char> > == 0)' is not a constant expression

• Error Category: Build/Configuration

• Failure Point: C++ compilation error in Abseil hash table implementation

• Root Cause Analysis: The error occurs due to a C++ compiler compatibility issue with the Abseil library's hash table implementation in gRPC 1.68.0. The compiler is having trouble with constant expressions in template code.

• Suggested Fix:
Add the following to the environment section of the melange YAML:

environment:
  contents:
    packages:
      # ... existing packages ...
      - gcc-stdcxx
      - gcc12
      - gcc12-c++
  environment:
    CXXFLAGS: "-std=c++17"

• Explanation: The error stems from C++ constant expression evaluation rules that were refined in C++17. Adding explicit C++17 support and ensuring the proper C++ standard library is available should resolve the template evaluation issues.

• Additional Notes:

  1. gRPC 1.68.0 uses modern C++ features extensively
  2. The Abseil library (used by gRPC) requires proper C++17 support
  3. The error occurs in template metaprogramming code which is sensitive to compiler settings
  4. Similar issues have been seen when building recent gRPC versions without explicit C++17 support

• References:

This fix ensures proper C++17 support during compilation which is required for the template metaprogramming constructs used in the Abseil library within gRPC.

Copy link
Contributor Author

octo-sts bot commented Nov 18, 2024

Gen AI suggestions to solve the build error:

• Detected Error:
error: '(absl::lts_20240722::container_internal::TypeErasedApplyToSlotFn<StringHash, std::__cxx11::basic_string<char> > == 0)' is not a constant expression

• Error Category: Build Configuration

• Failure Point: Compilation of protobuf descriptor code using Abseil hash containers

• Root Cause Analysis:
The error occurs due to incompatibility between the C++ compiler requirements and Abseil's hash policy traits implementation. This is likely related to the version of abseil-cpp being used with gRPC 1.68.0 and the compiler's constexpr evaluation rules.

• Suggested Fix:

  1. Add the following dependency to the environment section:
environment:
  contents:
    packages:
      - abseil-cpp-dev>=20240116.1
  1. Add compiler flags to handle constexpr evaluation:
environment:
  contents:
    packages:
      # ... existing packages ...
    environment:
      CXXFLAGS: "-std=c++17 -fexceptions"

• Explanation:
The error stems from constexpr evaluation rules in the C++ standard. The fix ensures:

  1. A compatible version of abseil-cpp is used
  2. The correct C++ standard is enforced
  3. Proper exception handling is enabled

• Additional Notes:

  • This is a known issue when building recent versions of gRPC with certain compiler versions
  • The fix aligns with gRPC's minimum C++ standard requirements
  • Using C++17 provides better constexpr support needed by Abseil's hash containers

• References:

@powersj
Copy link
Contributor

powersj commented Nov 26, 2024

Closing as branch is now empty after rebase

@powersj powersj closed this Nov 26, 2024
@octo-sts octo-sts bot deleted the wolfictl-212e1aae-906c-490d-86e0-0c9fadc9ba76 branch November 27, 2024 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved-to-run A repo member has approved this external contribution automated pr request-version-update request for a newer version of a package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants