Skip to content

collect2: fatal error: cannot find 'ld' #11790

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

Closed
vorburger opened this issue Dec 29, 2024 · 5 comments
Closed

collect2: fatal error: cannot find 'ld' #11790

vorburger opened this issue Dec 29, 2024 · 5 comments

Comments

@vorburger
Copy link
Contributor

Context: https://github.com/enola-dev/enola/ is a project which used to work (build) just fine, at rev enola-dev/enola@1a4252a. After a bazelisk clean, it's suddenly broken; this is not { Fast, Correct } - Choose two ... 😄

What version of gRPC-Java are you using?

1.66.0

What is your environment?

Linux Fedora Workstation 41 with up-to-date packages.

Java 21, but that's not relevant.

What did you expect to see?

Continously working green build.

What did you see instead?

Loading: 0 packages loaded
ERROR: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/com_google_protobuf/BUILD.bazel:457:10: Linking external/com_google_protobuf/protoc [for tool] failed: (Exit 1): gcc failed: error executing CppLink command (from target @@com_google_protobuf//:protoc) /usr/bin/gcc @bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/protoc-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
collect2: fatal error: cannot find 'ld'
compilation terminated.
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/vorburger/.cache/bazel/_bazel_vorburger/a3cf8df34f0c7a76e9926daaad9ffbf4/external/com_google_protobuf/java/util/BUILD.bazel:8:13 Building external/com_google_protobuf/java/util/libutil.jar (7 source files) failed: (Exit 1): gcc failed: error executing CppLink command (from target @@com_google_protobuf//:protoc) /usr/bin/gcc @bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/protoc-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
INFO: Elapsed time: 0.656s, Critical Path: 0.09s
INFO: 13 processes: 13 internal.
ERROR: Build did NOT complete successfully

Steps to reproduce the bug

$ git clone https://github.com/enola-dev/enola/
$ cd enola
$ git checkout 1a4252a2ff3b8869fc49bc385b1c81d53d179948
$ bazelisk clean
$ bazelisk build //java/dev/enola/common/protobuf:test_proto
@vorburger
Copy link
Contributor Author

protocolbuffers/protobuf#19558 would be really great to just avoid this entire class of protoc re-re-re-re-building problems entirely... /CC @alexeagle

@vorburger
Copy link
Contributor Author

What version of gRPC-Java are you using? 1.66.0

FYI in enola-dev/enola#985 I've attempted to bump 1.66.0 to 1.69.0, and am still seeing (and blocked by) this problem.

@vorburger
Copy link
Contributor Author

collect2: fatal error: cannot find 'ld'

I believe I do actually have an ld (linker) installed on the Host system, the issue here must be that Bazel is not "seeing" it:

$ ld --version
GNU ld version 2.43.1-5.fc41
Copyright (C) 2024 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

@vorburger
Copy link
Contributor Author

After a bazelisk clean, it's suddenly broken

bazelisk clean --expunge fixed it!!! Phew. Wow. Magic! 🪄

Linux Fedora Workstation 41 with up-to-date packages.

Just a few days ago I upgraded Fedora 40 to 41, might that explain this?

(That's just a hunch, I don't know if a clean before OS upgrade would also have triggered this.)

Is it expected that an upgrade of some OS packages breaks a previously working build?

@ejona86
Copy link
Member

ejona86 commented Jan 7, 2025

After a bazelisk clean, it's suddenly broken

bazelisk clean --expunge fixed it!!!

Ewww. Yeah, I had no idea what'd cause that. Luckily C++ has mostly "just worked" with Bazel, other than C++ itself being a PITA needing various flags that aren't defined in individual projects (e.g, -std=c++14).

Yes, pre-built protoc would be nice for Java folks to use.

Sounds like this is unrelated to gRPC and we (grpc-java) don't have the experience to point to what might have been going on, so I'm closing. If anything else comes up comment and we can reopen.

@ejona86 ejona86 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants