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

Unable to build Protobuf from source distribution #15615

Closed
jaskij opened this issue Jan 28, 2024 · 11 comments
Closed

Unable to build Protobuf from source distribution #15615

jaskij opened this issue Jan 28, 2024 · 11 comments
Assignees
Labels
25.x inactive Denotes the issue/PR has not seen activity in the last 90 days. packaging & distribution

Comments

@jaskij
Copy link

jaskij commented Jan 28, 2024

What version of protobuf and what language are you using?
Version: 25.2
Language: C++ (?)

What operating system (Linux, Windows, ...) and version?

Arch Linux, up to date

What runtime / compiler are you using (e.g., python version or gcc version)

$ bazel --version
bazel 7.0.1
$ gcc --version
gcc (GCC) 13.2.1 20230801
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

What did you do?
Steps to reproduce the behavior:

  1. Go to https://github.com/protocolbuffers/protobuf/releases/tag/v25.2
  2. Download protobuf-25.2.tar.gz
  3. Unpack it
  4. Run bazel build :protobuf

What did you expect to see

A successful build

What did you see instead?

$ bazel build :protobuf
ERROR: no such package '@@com_google_protobuf//': The repository '@@com_google_protobuf' could not be resolved: Repository '@@com_google_protobuf' is not defined
ERROR: /home/jaskij/.cache/bazel/_bazel_jaskij/bb908db786c07cae9b652052a31c83d3/external/bazel_tools/tools/proto/BUILD:25:6: no such package '@@com_google_protobuf//': The repository '@@com_google_protobuf' could not be resolved: Repository '@@com_google_protobuf' is not defined and referenced by '@@bazel_tools//tools/proto:cc_toolchain'
ERROR: Analysis of target '//:protobuf' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.172s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
@jaskij jaskij added the untriaged auto added to all issues by default when created. label Jan 28, 2024
@zhangskz zhangskz added packaging & distribution 25.x and removed untriaged auto added to all issues by default when created. labels Jan 30, 2024
@zhangskz
Copy link
Member

@acozzette Is this a side-effect of the monorepo merge?

@jaskij
Copy link
Author

jaskij commented Jan 30, 2024

Is this a side-effect of the monorepo merge?

To add more context: it works up until 3.20.3. It seems I didn't push my changes, but I was updating this dockerfile over the weekend, and 3.20.3 worked just fine. 25.2 gave me more trouble than I wanted to deal with at the time. I didn't check version inbetween.

@igastru
Copy link

igastru commented Jan 31, 2024

I get this error when I try to install
240131_14h44m35s_screenshot

@pdecks
Copy link

pdecks commented Feb 10, 2024

Versioning changed with 3.21 per https://protobuf.dev/news/2022-05-06/

The first instance of this new versioning scheme is the new version of the Python API, 4.21.0, which follows the preceding version, 3.20.1. Other language APIs will be released as 3.21.0.

In your Dockerfile, you're currently using the same version number for both C++ and Python:

    PROTOBUF_CPP_FILE=protobuf-cpp-${PROTOBUF_VERSION}.tar.gz \
    PROTOBUF_PY_FILE=protobuf-python-${PROTOBUF_VERSION}.tar.gz \

So you'll have to use ARG PROTOBUF_VERSION=25.2 and then prefix appropriately:

    PROTOBUF_CPP_FILE=protobuf-cpp-3.${PROTOBUF_VERSION}.tar.gz \
    PROTOBUF_PY_FILE=protobuf-python-4.${PROTOBUF_VERSION}.tar.gz \

@jaskij
Copy link
Author

jaskij commented Feb 10, 2024

@pdecks the error shows up in local builds on my host machine, where I'm not using Docker at all. Just plain download the file and try to build with Bazel.

I am aware of the versioning change. Packaging has also changed, if you look at version 25.2 there is now only one archive with ${PROTOBUF_VERSION}.tar.gz, skipping the major version name. There are no per-language archives. I probably shouldn't have linked that Dockerfile, it's a bit of a red herring here.

@pdecks
Copy link

pdecks commented Mar 5, 2024

Ah yeah, thanks for clarifying. I did indeed get distracted by the Dockerfile. Confirming I see the same behavior when trying to build 25.3 with bazel 7.0.2 via bazel build :protoc :protobuf.

@pdecks
Copy link

pdecks commented Mar 5, 2024

This is related bazelbuild/bazel#19973, and I just verified that I was able to successfully build protobuf 25.3 with bazel 6.5.0.

@jaskij
Copy link
Author

jaskij commented Mar 5, 2024

Thanks for finding that, seems like the issue lies a little deeper. When I get back to the topic, using an older version of Bazel could be a viable workaround.

That said, one of the comments ( bazelbuild/bazel#19973 (comment) ) in the Bazel issue seems to suggest a workaround for Protobuf?

@zhangskz zhangskz assigned zhangskz and unassigned acozzette Mar 5, 2024
@jaskij
Copy link
Author

jaskij commented Mar 27, 2024

@pdecks tested just now with 26.0 and Bazel 7.1.1, don't know what changed, but it seems to build now.

At least bazel build :protoc :protobuf doesn't throw an error. I still have no clue how to get libprotobuf.so, but that's a different issue.

Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Jun 26, 2024
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
25.x inactive Denotes the issue/PR has not seen activity in the last 90 days. packaging & distribution
Projects
None yet
Development

No branches or pull requests

5 participants