Error downloading toolchain using bazelmod
bkhouri opened this issue · 17 comments
Hello,
I have MODULE.bazel
file that has the following contents
bazel_dep(name = "rules_ruby", version = "0.10.0")
ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby")
ruby.toolchain(
name = "ruby",
version = "3.3.1",
# alternatively, load version from .ruby-version file
# version_file = "//:.ruby-version",
)
use_repo(
ruby,
"ruby",
"ruby_toolchains",
)
# Register ruby toolchain
register_toolchains("@ruby_toolchains//:all")
And I have a BUILD.bazel
that defines a rb_binary()
. When I try to build the target, I get the following failure
❯ bazel build -s //my/package/...
Starting local Bazel server and connecting to it...
INFO: Repository rules_ruby~~ruby~ruby instantiated at:
<builtin>: in <toplevel>
Repository rule rb_download defined at:
/Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:190:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'rules_ruby~~ruby~ruby':
Traceback (most recent call last):
File "/Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl", line 53, column 32, in _rb_download_impl
_install_via_ruby_build(repository_ctx, version)
File "/Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl", line 182, column 13, in _install_via_ruby_build
fail("%s\n%s" % (result.stdout, result.stderr))
Error in fail:
ruby-build: definition not found: 3.3.1
ERROR: <builtin>: fetching rb_download rule //:rules_ruby~~ruby~ruby: Traceback (most recent call last):
File "/Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl", line 53, column 32, in _rb_download_impl
_install_via_ruby_build(repository_ctx, version)
File "/Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl", line 182, column 13, in _install_via_ruby_build
fail("%s\n%s" % (result.stdout, result.stderr))
Error in fail:
ruby-build: definition not found: 3.3.1
ERROR: no such package '@@rules_ruby~~ruby~ruby//':
ruby-build: definition not found: 3.3.1
ERROR: /Users/bkhouri/Documents/git/************/BUILD.bazel:23:10: ************************r depends on @@rules_ruby~~ruby~ruby//:toolchain in repository @@rules_ruby~~ruby~ruby which failed to fetch. no such package '@@rules_ruby~~ruby~ruby//':
ruby-build: definition not found: 3.3.1
Target *********************r up-to-date (nothing to build)
ERROR: Analysis of target '***********************' failed; build aborted: Analysis failed
INFO: Elapsed time: 5.214s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
I looked at the rules source code, and it seems like it should work. Using version = "jruby-9.4.7.0",
in the ruby.toolchain
definitions does not generate an error.
ruby_rules offload the actual Ruby installation to ruby-build and the version is defined by 928d630#diff-b85af5bc21f1bb27347261cef12f7a2476276d401dd288f976744647e6e68571R30. The current version is 20240423
which doesn't know about Ruby 3.3.1. To fix, you need to pass a custom ruby-build version:
ruby.toolchain(
name = "ruby",
version = "3.3.1",
ruby_build_version = "20240517"
)
Based on the rules source code, the downloaded tar.gz file has a ruby-build
that knows about version 3.3.1
Steps to reproduce:
-
Point my browser to https://github.com/rbenv/ruby-build/archive/refs/tags/v20240423.tar.gz and save the file to a directory (using
curl
had a file size of 0, for some reason) -
Run the following
❯ tar -zxvf ruby-build-20240423.tar <...SNIP...> ❯ ./ruby-build-20240423/bin/ruby-build --verbose --list 3.0.7 3.1.5 3.2.4 3.3.1 jruby-9.4.6.0 mruby-3.3.0 picoruby-3.0.0 truffleruby-24.0.1 truffleruby+graalvm-24.0.1
Hmmm, can you try checking what ruby-build version you end up with? It should be available in
cd /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby\~\~ruby\~ruby/
ruby-build/bin/ruby-build --version
With the manually downloaded tar.gz
files, the ruby-build
version is
❯ curl "https://github.com/rbenv/ruby-build/archive/refs/tags/v20240423.tar.gz" --location -o ruby-build-20240423.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 89592 0 89592 0 0 458k 0 --:--:-- --:--:-- --:--:-- 458k
❯ tar -zxvf ruby-build-20240423.tar.gz
<...SNIP...
❯ ./ruby-build-20240423/bin/ruby-build --version
ruby-build 20240423
❯ ./ruby-build-20240423/bin/ruby-build --version --list
3.0.7
3.1.5
3.2.4
3.3.1
jruby-9.4.6.0
mruby-3.3.0
picoruby-3.0.0
truffleruby-24.0.1
truffleruby+graalvm-24.0.1
Unfortunately, the contents of the MODULE.bazel
specified in the Issue description does not have ruby-build
in the externals.
❯ find -L $(bazel info output_base) -iname "ruby-build"
Starting local Bazel server and connecting to it...
❯ echo $?
0
After manually modifying the locally downloaded download.bzl
from the bazel_dep
defined in MODULE.bazel
, I get the following
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:221:10: *** ruby-build --version stderr:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:222:10: *** ruby-build --version stdout: ruby-build 20240423
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:223:10: *** ruby-build return_code: 0
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:226:10: *** ruby-build --list stderr:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:227:10: *** ruby-build --list stdout:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:228:10: *** ruby-build return_code: 0
Hmm, so the version is correct but somehow it complain that definition for 3.3.1 is missing. Can you try changing the download.bzl
to print definitions by calling ruby-build/bin/ruby-build --definitions
?
Alternatively, just comment the following line so Bazel doesn't remove ruby-build and you can cd into the directory and debug.
rules_ruby/ruby/private/download.bzl
Line 227 in 928d630
Something weird is happening, probably with bazel
. When I modify the download.bzl
to call ruby-build --defintions
, I see the following
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:215:10: Ruby build URL: https://github.com/rbenv/ruby-build/archive/refs/tags/v20240423.tar.gz
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:223:10: *** ruby-build --version stderr:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:224:10: *** ruby-build --version stdout: ruby-build 20240423
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:225:10: *** ruby-build return_code: 0
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:228:10: *** ruby-build --list stderr:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:229:10: *** ruby-build --list stdout:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:230:10: *** ruby-build return_code: 0
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:232:10: *** ruby-build --definitions stderr:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:233:10: *** ruby-build --definitions stdout:
DEBUG: /Volumes/BazelOut/_bazel_bassam/49638b6383ca98bc7c45c8f9c0c8e8c7/external/rules_ruby~/ruby/private/download.bzl:234:10: *** ruby-build return_code: 0
However, when I run the equivalent command using the ruby-build
binary after commenting out repository_ctx.delete("ruby-build")
, the correct-output is observed.
❯ $(bazel info output_base)/external/rules_ruby~~ruby~ruby/ruby-build/bin/ruby-build --version
Starting local Bazel server and connecting to it...
ruby-build 20240423
❯ $(bazel info output_base)/external/rules_ruby~~ruby~ruby/ruby-build/bin/ruby-build --list
3.0.7
3.1.5
3.2.4
3.3.1
jruby-9.4.6.0
mruby-3.3.0
picoruby-3.0.0
truffleruby-24.0.1
truffleruby+graalvm-24.0.1
❯ $(bazel info output_base)/external/rules_ruby~~ruby~ruby/ruby-build/bin/ruby-build --definitions
1.8.5-p52
1.8.5-p113
1.8.5-p114
1.8.5-p115
1.8.5-p231
1.8.6
1.8.6-p36
1.8.6-p110
1.8.6-p111
1.8.6-p114
1.8.6-p230
1.8.6-p286
1.8.6-p287
1.8.6-p368
1.8.6-p369
1.8.6-p383
1.8.6-p388
1.8.6-p398
1.8.6-p399
1.8.6-p420
1.8.7-preview1
1.8.7-preview2
1.8.7-preview3
1.8.7-preview4
1.8.7
1.8.7-p17
1.8.7-p22
1.8.7-p71
1.8.7-p72
1.8.7-p160
1.8.7-p173
1.8.7-p174
1.8.7-p248
1.8.7-p249
1.8.7-p299
1.8.7-p301
1.8.7-p302
1.8.7-p330
1.8.7-p334
1.8.7-p352
1.8.7-p357
1.8.7-p358
1.8.7-p370
1.8.7-p371
1.8.7-p373
1.8.7-p374
1.8.7-p375
1.9.0-0
1.9.0-1
1.9.0-2
1.9.0-3
1.9.0-4
1.9.0-5
1.9.1-preview1
1.9.1-preview2
1.9.1-rc1
1.9.1-rc2
1.9.1-p0
1.9.1-p129
1.9.1-p243
1.9.1-p376
1.9.1-p378
1.9.1-p429
1.9.1-p430
1.9.1-p431
1.9.2-preview1
1.9.2-preview3
1.9.2-rc1
1.9.2-rc2
1.9.2-p0
1.9.2-p136
1.9.2-p180
1.9.2-p290
1.9.2-p318
1.9.2-p320
1.9.2-p326
1.9.2-p330
1.9.3-dev
1.9.3-preview1
1.9.3-rc1
1.9.3-p0
1.9.3-p105
1.9.3-p125
1.9.3-p194
1.9.3-p286
1.9.3-p327
1.9.3-p362
1.9.3-p374
1.9.3-p385
1.9.3-p392
1.9.3-p426
1.9.3-p429
1.9.3-p448
1.9.3-p484
1.9.3-p545
1.9.3-p547
1.9.3-p550
1.9.3-p551
2.0.0-dev
2.0.0-preview1
2.0.0-preview2
2.0.0-rc1
2.0.0-rc2
2.0.0-p0
2.0.0-p195
2.0.0-p247
2.0.0-p353
2.0.0-p451
2.0.0-p481
2.0.0-p576
2.0.0-p594
2.0.0-p598
2.0.0-p643
2.0.0-p645
2.0.0-p647
2.0.0-p648
2.1.0-dev
2.1.0-preview1
2.1.0-preview2
2.1.0-rc1
2.1.0
2.1.1
2.1.2
2.1.3
2.1.4
2.1.5
2.1.6
2.1.7
2.1.8
2.1.9
2.1.10
2.2.0-dev
2.2.0-preview1
2.2.0-preview2
2.2.0-rc1
2.2.0
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.2.7
2.2.8
2.2.9
2.2.10
2.3.0-dev
2.3.0-preview1
2.3.0-preview2
2.3.0
2.3.1
2.3.2
2.3.3
2.3.4
2.3.5
2.3.6
2.3.7
2.3.8
2.4.0-dev
2.4.0-preview1
2.4.0-preview2
2.4.0-preview3
2.4.0-rc1
2.4.0
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
2.4.6
2.4.7
2.4.8
2.4.9
2.4.10
2.5.0-dev
2.5.0-preview1
2.5.0-rc1
2.5.0
2.5.1
2.5.2
2.5.3
2.5.4
2.5.5
2.5.6
2.5.7
2.5.8
2.5.9
2.6.0-dev
2.6.0-preview1
2.6.0-preview2
2.6.0-preview3
2.6.0-rc1
2.6.0-rc2
2.6.0
2.6.1
2.6.2
2.6.3
2.6.4
2.6.5
2.6.6
2.6.7
2.6.8
2.6.9
2.6.10
2.7.0-dev
2.7.0-preview1
2.7.0-preview2
2.7.0-preview3
2.7.0-rc1
2.7.0-rc2
2.7.0
2.7.1
2.7.2
2.7.3
2.7.4
2.7.5
2.7.6
2.7.7
2.7.8
3.0.0-dev
3.0.0-preview1
3.0.0-preview2
3.0.0-rc1
3.0.0
3.0.1
3.0.2
3.0.3
3.0.4
3.0.5
3.0.6
3.0.7
3.1.0-dev
3.1.0-preview1
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5
3.2.0-dev
3.2.0-preview1
3.2.0-preview2
3.2.0-preview3
3.2.0-rc1
3.2.0
3.2.1
3.2.2
3.2.3
3.2.4
3.3.0-dev
3.3.0-preview1
3.3.0-preview2
3.3.0-preview3
3.3.0-rc1
3.3.0
3.3.1
3.4-dev
artichoke-dev
jruby-dev
jruby-1.7.2
jruby-1.7.5
jruby-1.7.6
jruby-1.7.7
jruby-1.7.8
jruby-1.7.9
jruby-1.7.10
jruby-1.7.11
jruby-1.7.12
jruby-1.7.13
jruby-1.7.14
jruby-1.7.15
jruby-1.7.16
jruby-1.7.16.1
jruby-1.7.16.2
jruby-1.7.17
jruby-1.7.18
jruby-1.7.19
jruby-1.7.20
jruby-1.7.20.1
jruby-1.7.21
jruby-1.7.22
jruby-1.7.23
jruby-1.7.24
jruby-1.7.25
jruby-1.7.26
jruby-1.7.27
jruby-9.0.0.0.pre1
jruby-9.0.0.0.pre2
jruby-9.0.0.0.rc1
jruby-9.0.0.0.rc2
jruby-9.0.0.0
jruby-9.0.1.0
jruby-9.0.3.0
jruby-9.0.4.0
jruby-9.0.5.0
jruby-9.1.0.0-dev
jruby-9.1.0.0
jruby-9.1.1.0
jruby-9.1.2.0
jruby-9.1.3.0
jruby-9.1.4.0
jruby-9.1.5.0
jruby-9.1.6.0
jruby-9.1.7.0
jruby-9.1.8.0
jruby-9.1.9.0
jruby-9.1.10.0
jruby-9.1.11.0
jruby-9.1.12.0
jruby-9.1.13.0
jruby-9.1.14.0
jruby-9.1.15.0
jruby-9.1.16.0
jruby-9.1.17.0
jruby-9.2.0.0-dev
jruby-9.2.0.0
jruby-9.2.1.0-dev
jruby-9.2.1.0
jruby-9.2.3.0
jruby-9.2.4.0
jruby-9.2.4.1
jruby-9.2.5.0
jruby-9.2.6.0
jruby-9.2.7.0
jruby-9.2.8.0
jruby-9.2.9.0
jruby-9.2.10.0
jruby-9.2.11.0
jruby-9.2.11.1
jruby-9.2.12.0
jruby-9.2.13.0
jruby-9.2.14.0
jruby-9.2.15.0
jruby-9.2.16.0
jruby-9.2.17.0
jruby-9.2.18.0
jruby-9.2.19.0
jruby-9.2.20.0
jruby-9.2.20.1
jruby-9.2.21.0
jruby-9.3.0.0
jruby-9.3.1.0
jruby-9.3.2.0
jruby-9.3.3.0
jruby-9.3.4.0
jruby-9.3.6.0
jruby-9.3.7.0
jruby-9.3.8.0
jruby-9.3.9.0
jruby-9.3.10.0
jruby-9.3.11.0
jruby-9.3.13.0
jruby-9.3.14.0
jruby-9.4.0.0
jruby-9.4.1.0
jruby-9.4.2.0
jruby-9.4.3.0
jruby-9.4.4.0
jruby-9.4.5.0
jruby-9.4.6.0
mruby-dev
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1.3.0
mruby-1.4.0
mruby-1.4.1
mruby-2.0.0
mruby-2.0.1
mruby-2.1.0
mruby-2.1.1
mruby-2.1.2
mruby-3.0.0
mruby-3.1.0
mruby-3.2.0
mruby-3.3.0
picoruby-3.0.0
rbx-2.2.2
rbx-2.2.3
rbx-2.2.4
rbx-2.2.5
rbx-2.2.6
rbx-2.2.7
rbx-2.2.8
rbx-2.2.9
rbx-2.2.10
rbx-2.3.0
rbx-2.4.0
rbx-2.4.1
rbx-2.5.0
rbx-2.5.1
rbx-2.5.2
rbx-2.5.3
rbx-2.5.4
rbx-2.5.5
rbx-2.5.6
rbx-2.5.7
rbx-2.5.8
rbx-2.6
rbx-2.7
rbx-2.8
rbx-2.9
rbx-2.10
rbx-2.11
rbx-2.71828182
rbx-3.0
rbx-3.1
rbx-3.2
rbx-3.3
rbx-3.4
rbx-3.5
rbx-3.6
rbx-3.7
rbx-3.8
rbx-3.9
rbx-3.10
rbx-3.11
rbx-3.12
rbx-3.13
rbx-3.14
rbx-3.15
rbx-3.16
rbx-3.17
rbx-3.18
rbx-3.19
rbx-3.20
rbx-3.21
rbx-3.22
rbx-3.23
rbx-3.24
rbx-3.25
rbx-3.26
rbx-3.27
rbx-3.28
rbx-3.29
rbx-3.30
rbx-3.31
rbx-3.32
rbx-3.33
rbx-3.34
rbx-3.35
rbx-3.36
rbx-3.37
rbx-3.38
rbx-3.39
rbx-3.40
rbx-3.41
rbx-3.42
rbx-3.43
rbx-3.44
rbx-3.45
rbx-3.46
rbx-3.47
rbx-3.48
rbx-3.49
rbx-3.50
rbx-3.51
rbx-3.52
rbx-3.53
rbx-3.54
rbx-3.55
rbx-3.56
rbx-3.57
rbx-3.58
rbx-3.59
rbx-3.60
rbx-3.61
rbx-3.62
rbx-3.63
rbx-3.64
rbx-3.65
rbx-3.66
rbx-3.67
rbx-3.68
rbx-3.69
rbx-3.70
rbx-3.71
rbx-3.72
rbx-3.73
rbx-3.74
rbx-3.75
rbx-3.76
rbx-3.77
rbx-3.78
rbx-3.79
rbx-3.80
rbx-3.81
rbx-3.82
rbx-3.83
rbx-3.84
rbx-3.85
rbx-3.86
rbx-3.87
rbx-3.88
rbx-3.89
rbx-3.90
rbx-3.91
rbx-3.92
rbx-3.93
rbx-3.94
rbx-3.95
rbx-3.96
rbx-3.97
rbx-3.98
rbx-3.99
rbx-3.100
rbx-3.101
rbx-3.102
rbx-3.103
rbx-3.104
rbx-3.105
rbx-3.106
rbx-3.107
rbx-4.0
rbx-4.1
rbx-4.2
rbx-4.3
rbx-4.4
rbx-4.5
rbx-4.6
rbx-4.7
rbx-4.8
rbx-4.9
rbx-4.10
rbx-4.11
rbx-4.12
rbx-4.13
rbx-4.14
rbx-4.15
rbx-4.16
rbx-4.18
rbx-4.19
rbx-4.20
rbx-5.0
ree-1.8.7-2011.03
ree-1.8.7-2011.12
ree-1.8.7-2012.01
ree-1.8.7-2012.02
ruby-dev
truffleruby-dev
truffleruby-1.0.0-rc10
truffleruby-1.0.0-rc11
truffleruby-1.0.0-rc12
truffleruby-1.0.0-rc13
truffleruby-1.0.0-rc14
truffleruby-1.0.0-rc15
truffleruby-1.0.0-rc16
truffleruby-1.0.0-rc2
truffleruby-1.0.0-rc3
truffleruby-1.0.0-rc5
truffleruby-1.0.0-rc6
truffleruby-1.0.0-rc7
truffleruby-1.0.0-rc8
truffleruby-1.0.0-rc9
truffleruby-19.0.0
truffleruby-19.1.0
truffleruby-19.2.0
truffleruby-19.2.0.1
truffleruby-19.3.0
truffleruby-19.3.0.2
truffleruby-19.3.1
truffleruby-20.0.0
truffleruby-20.1.0
truffleruby-20.2.0
truffleruby-20.3.0
truffleruby-21.0.0
truffleruby-21.1.0
truffleruby-21.2.0
truffleruby-21.2.0.1
truffleruby-21.3.0
truffleruby-22.0.0.2
truffleruby-22.1.0
truffleruby-22.2.0
truffleruby-22.3.0
truffleruby-22.3.1
truffleruby-23.0.0-preview1
truffleruby-23.0.0
truffleruby-23.1.0
truffleruby-23.1.1
truffleruby-23.1.2
truffleruby-24.0.0
truffleruby-24.0.1
truffleruby+graalvm-dev
truffleruby+graalvm-20.1.0
truffleruby+graalvm-20.2.0
truffleruby+graalvm-20.3.0
truffleruby+graalvm-21.0.0
truffleruby+graalvm-21.1.0
truffleruby+graalvm-21.2.0
truffleruby+graalvm-21.3.0
truffleruby+graalvm-22.0.0.2
truffleruby+graalvm-22.1.0
truffleruby+graalvm-22.2.0
truffleruby+graalvm-22.3.0
truffleruby+graalvm-22.3.1
truffleruby+graalvm-23.0.0-preview1
truffleruby+graalvm-23.0.0
truffleruby+graalvm-23.1.0
truffleruby+graalvm-23.1.1
truffleruby+graalvm-23.1.2
truffleruby+graalvm-24.0.0
truffleruby+graalvm-24.0.1
I'm Running Bazel installed via brew
.
❯ which bazel
/opt/homebrew/bin/bazel
❯ bazel --version
bazel 7.1.2-homebrew
❯ bazel version
Starting local Bazel server and connecting to it...
Build label: 7.1.2-homebrew
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Tue Jan 1 00:00:00 1980 (315532800)
Build timestamp: 315532800
Build timestamp as int: 315532800
This definitely looks strange - as I tried to add list/definitions myself - it prints things correctly:
r = repository_ctx.execute(["ruby-build/bin/ruby-build", "--version"])
print(r.stdout)
print(r.stderr)
r = repository_ctx.execute(["ruby-build/bin/ruby-build", "--list"])
print(r.stdout)
print(r.stderr)
r = repository_ctx.execute(["ruby-build/bin/ruby-build", "--definitions"])
print(r.stdout)
print(r.stderr)
DEBUG: /private/var/tmp/_bazel_p0deje/e1441f657a5fdfb738840cf8366cceeb/external/rules_ruby~/ruby/private/download.bzl:220:10: ruby-build 20240423
DEBUG: /private/var/tmp/_bazel_p0deje/e1441f657a5fdfb738840cf8366cceeb/external/rules_ruby~/ruby/private/download.bzl:221:10:
DEBUG: /private/var/tmp/_bazel_p0deje/e1441f657a5fdfb738840cf8366cceeb/external/rules_ruby~/ruby/private/download.bzl:223:10: 3.0.7
3.1.5
3.2.4
3.3.1
jruby-9.4.6.0
mruby-3.3.0
picoruby-3.0.0
truffleruby-24.0.1
truffleruby+graalvm-24.0.1
DEBUG: /private/var/tmp/_bazel_p0deje/e1441f657a5fdfb738840cf8366cceeb/external/rules_ruby~/ruby/private/download.bzl:224:10:
DEBUG: /private/var/tmp/_bazel_p0deje/e1441f657a5fdfb738840cf8366cceeb/external/rules_ruby~/ruby/private/download.bzl:226:10: 1.8.5-p52
1.8.5-p113
1.8.5-p114
1.8.5-p115
1.8.5-p231
1.8.6
1.8.6-p36
...
- Do you have any other dependencies in MODULE.bazel?
- What's your .bazelrc?
- Can you try switching your output_base from
/Volumes
to/private/tmp
? I wonder if you are using network-connected drive and it's causing some problems.
Here are other dependencies , but the error was happening before adding those reps.
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "rules_python", version = "0.32.2")
bazel_dep(name = "rules_perl", version = "0.2.0")
bazel_dep(name = "rules_ruby", version = "0.10.0")
The bazel WORKSPACE .bazelrc
is empty. my ~/.bazelrc
has the following
❯ cat ~/.bazelrc
startup --output_user_root=/Volumes/BazelOut/_bazel_bassam
startup --shutdown_on_low_sys_mem
startup --max_idle_secs 30
common --repository_cache=/Volumes/BazelRepoCache/
build --verbose_failures
The /Volumes/BazelOut/_bazel_bassam
is local volume (not network-connected) to more easily clean the output user root when my disk becomes full.
Removing startup --output_user_root=/Volumes/BazelOut/_bazel_bassam
from ~/.bazelrc
did not fix the issue.
Could you try wiping the caches and trying again?
bazel clean --expunge
rm -r /Volumes/BazelRepoCache/
Could you try wiping the caches and trying again?
bazel clean --expunge rm -r /Volumes/BazelRepoCache/
All Volumes uses for bazel are local volumes. I cleared /Volumes/BazelRepoCache
and /Volumes/BazelOut
and tried again, to no avail.
For what it's work, using version = "jruby-9.4.7.0"
in MODULE.bazel
gets past the error. So I'm unsure why the works, but version = "3.3.1"
fails.
That's because jruby is not installed via ruby-build, but rather downloaded directly. If it's sufficient for your case, I'd use it as it also installs faster w/o the need to compile.
I don't have any other ideas what could possibly be wrong with ruby-build invocations.
I think I've been running into a similar (or the same) issue with not being able to have ruby_build_version
overridden. I'd been trying to bump a repo up to 3.3.2, and was overriding ruby-build to 20240530.1
.
I can repro it if I just create this new empty project with a MODULE.bazel:
# ruby
bazel_dep(name = "rules_ruby", version = "0.10.0")
ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby")
ruby.toolchain(
name = "ruby",
version = "3.3.2",
ruby_build_version = "20240530.1",
# ruby_build_version = "some-nonexistent-version",
)
use_repo(ruby, "ruby", "ruby_toolchains")
register_toolchains("@ruby_toolchains//:all")
this will fail on:
ruby-build: definition not found: 3.3.2
And indeed I can confirm it is still pulling down the current default in the repo:
Fetching repository @@rules_ruby~~ruby~ruby; Downloading ruby-build 20240423 5s
I also looked for a while through ruby/private/download.bzl
as well but I'm far from a Bazel rules expert so I didn't see anything obvious. Thanks for all the work you've done on rules_ruby!
Thanks!