bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.71k stars 3.98k forks source link

`bazel build` for `bazel` fails with "Too many levels of symbolic links" #20689

Open bergentruckung opened 6 months ago

bergentruckung commented 6 months ago

Description of the bug:

Hello,

I'm trying to build build bazel from source using bazel 6.3.2 from Nix. I'm following the documentation mentioned here. It starts up, but fails soon after with the message as pasted below.

ERROR: /var/tmp/bazel/bazel/src/main/cpp/BUILD:90:10: While resolving toolchains for target //src/main/cpp:client: invalid registered toolchain '@local_jdk//:runtime_toolchain_definition': no such package '@local_jdk//': error globbing [lib/**] - [lib/missioncontrol/**, lib/visualvm/**] op=FILES: /home/
.cache/bazel/_bazel_foobar/803803e01cdb6d93dfa85245a633671a/external/local_jdk/lib/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd
64/amd64/tzdb.dat (Too many levels of symbolic links)                                                                                                                                                                                                                                                                 
ERROR: Analysis of target '//src:bazel-dev' failed; build aborted:                                                                                                                                                                                                                                                    
INFO: Elapsed time: 0.471s                                                                                                                                                                                                                                                                                            
INFO: 0 processes.                                                                                                                                                                                                                                                                                                    
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)                                                                                                                                                                                                                                 
    currently loading: src/main/protobuf                                                                                                                                                                                                                                                                              
    Fetching repository @rules_cc; starting     

I also noticed that I hit the same bug when I build Tensorflow from source -- this means that there's something with bazel or its ecosystem and that's what all of my builds are failing.

Any ideas on what I'm missing over here?

Thanks in advance.

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Follow the instructions from https://bazel.build/install/compile-source.
  2. Install bazel from Nix
  3. Run bazel build //src:bazel-dev

Which operating system are you running Bazel on?

RHEL 8.9

What is the output of bazel info release?

release 6.3.2- (@non-git)

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

Installed it from Nix.

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

Running bazel build //src:bazel-dev gives the following:


ERROR: /var/tmp/bazel/bazel/src/main/cpp/BUILD:90:10: While resolving toolchains for target //src/main/cpp:client: invalid registered toolchain '@local_jdk//:runtime_toolchain_definition': no such package '@local_jdk//': error globbing [lib/**] - [lib/missioncontrol/**, lib/visualvm/**] op=FILES: /home/
.cache/bazel/_bazel_foobar/803803e01cdb6d93dfa85245a633671a/external/local_jdk/lib/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd64/amd
64/amd64/tzdb.dat (Too many levels of symbolic links)                                                                                                                                                                                                                                                                 
ERROR: Analysis of target '//src:bazel-dev' failed; build aborted:                                                                                                                                                                                                                                                    
INFO: Elapsed time: 0.471s                                                                                                                                                                                                                                                                                            
INFO: 0 processes.                                                                                                                                                                                                                                                                                                    
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)                                                                                                                                                                                                                                 
    currently loading: src/main/protobuf                                                                                                                                                                                                                                                                              
    Fetching repository @rules_cc; starting                                                                                                                                                                                                                                                                           ```
meteorcloudy commented 6 months ago

Judging from external/local_jdk/lib/amd64/amd64/, this seems to be a problem of local_jdk configuration? /cc @hvadehra

Can you reproduce with Bazel 7.0.0?

hvadehra commented 5 months ago

this seems to be a problem of local_jdk configuration

Seems that way to me. Ordinarily, the tzdb.dat file should be in <java-home>/lib/tzdb.dat

@bergentruckung Could you please share the directory listing for your <java_home>/lib directory? Based on the log above that should be the output of ls -al /home/.cache/bazel/_bazel_foobar/803803e01cdb6d93dfa85245a633671a/external/local_jdk/lib/

yaoddao commented 4 weeks ago

Judging from external/local_jdk/lib/amd64/amd64/, this seems to be a problem of local_jdk configuration? /cc @hvadehra

Can you reproduce with Bazel 7.0.0?

I also found this problem in Bazel 7.0.0. Of course,

  new_local_repository(
    name = "ext",
    path = '/appls/ext/opt',
    build_file = "@//:ext.BUILD"
  )

In the /appls/ext/opt, there are indeed many symbolic links.