maliput / maliput

A C++ runtime API describing a Road Network model for use in agent and traffic simulations. It guarantees a continuous description of the road geometry and supports dynamic environments with varying rules states.
https://maliput.readthedocs.org
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

Bazel build is failing due to rules_cc dep #609

Closed francocipollone closed 1 week ago

francocipollone commented 1 year ago

Environment

Description

To build correctly

Fails to build

Steps to reproduce

  1. Create codespace using proposed environment
  2. Run bazel build ...

Output

@francocipollone ➜ /workspaces/maliput (main) $ bazel build ...
ERROR: Error computing the main repository mapping: in module dependency chain <root> -> bazel_tools@_ -> rules_cc@0.0.9: module not found in registries: rules_cc@0.0.9
Loading: 
    Fetching https://raw.githubusercontent.com/stonier/bazel-central-registry/maliput_releases/modules/rules_license/0.0.3/MODULE.bazel
    Fetching https://raw.githubusercontent.com/stonier/bazel-central-registry/maliput_releases/modules/rules_python/0.4.0/MODULE.bazel
    Fetching https://raw.githubusercontent.com/stonier/bazel-central-registry/maliput_releases/modules/rules_proto/metadata.json
    Fetching https://raw.githubusercontent.com/stonier/bazel-central-registry/maliput_releases/modules/platforms/metadata.json
    Fetching https://raw.githubusercontent.com/stonier/bazel-central-registry/maliput_releases/modules/protobuf/3.19.6/MODULE.bazel
    Fetching https://raw.githubusercontent.com/stonier/bazel-central-registry/maliput_releases/modules/zlib/1.2.13/MODULE.bazel
    Fetching https://raw.githubusercontent.com/stonier/bazel-central-registry/maliput_releases/modules/platforms/0.0.7/MODULE.bazel
francocipollone commented 1 year ago

CC: @stonier

stonier commented 1 year ago

Ah, bazel_tools now depends on rules_cc v0.0.9.

bazel_tools is a dependency of bzlmod itself but awkwardly, it's hidden (not exposed on the bazel central registry).

rules_cc v0.0.9 exists on the bazel central registry but not on ours. I'll update my registry.

stonier commented 1 year ago

I've sync'd the fork. Try again?

francocipollone commented 1 year ago

I've sync'd the fork. Try again? Yes, now the error changed. I think we moved forward one step:

Now complaining about rules_java@5.5.1

image

https://github.com/maliput/maliput_malidrive/actions/runs/6627254608/job/18015503585?pr=248

stonier commented 1 year ago

Problem 1:

That's weird, rules_java 5.5.1 exists in the fork: https://github.com/stonier/bazel-central-registry/tree/main/modules/rules_java/5.5.1.

I see the problem there is for maliput_malidrive. Did maliput build?

Problem 2:

I'm wondering what's surfacing these problems. The only thing I can think of is that the bazel version is moving, when it shouldn't be. That's running off bazel 6.4.0. The container should be pinned to 6.1.1 (see here).

stonier commented 1 year ago

Problem 1:

:heavy_check_mark: Should be fixed now. I previously synced the main branch at https://github.com/stonier/bazel-central-registry, not the maliput_releases branch.

Problem 2:

:question: A new local or codespace devcontainer is downloading 6.4 on the fly when I do a bazel --version for the first time in the devcontainer. It's like it doesn't the container doesn't setup a default (i.e. it didn't make use the 6.1.1 arg set in the Dockerfile).

stonier commented 1 year ago

Problem 2:

Aha, there's an unintuitive usability surprise. There's an issue in the Dockerfile that results in USE_BAZEL_VERSION not being set and so, bazelisk downloads the latest.

Need to change:

################################################################################
# Configurable Arguments
################################################################################

ARG BASE_IMAGE=focal
ARG BAZEL_VERSION=6.1.1
ARG NAME=bazel-zen

################################################################################
# Base Image
################################################################################

FROM mcr.microsoft.com/devcontainers/base:${BASE_IMAGE}

to:

################################################################################
# Base Image
################################################################################

ARG BASE_IMAGE=focal
FROM mcr.microsoft.com/devcontainers/base:${BASE_IMAGE}

################################################################################
# Configuration
################################################################################

ARG BAZEL_VERSION=6.1.1
ARG NAME=bazel-zen

and then rerun the container jobs in each repo to push it to gcr.

Can you follow up on the PR's and the actions? Thanks.


See https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact

stonier commented 1 year ago

You may as well bump the default to 6.4.0 while you're at it.

francocipollone commented 1 year ago

Thanks for all the analysis and the detailed description! I will submit the fixes