bazel build requires python2
vkobel opened this issue · comments
When compiling with bazel build runsc
, it assumes that the default python version is 2. When using version 3 one can expect error messages such as bytes-like object is required, not 'str'
or CRITICAL:root:VDSO contains relocations: b'\nThere are no relocations in this file.\n'
.
Changing default python version to python2 fixes this issue.
Oops. We'll make that script work in Python 2 or 3.
This is one build error that you get when building against python3:
INFO: Analysed target //runsc:runsc (0 packages loaded).
INFO: Found 1 target...
ERROR: /home/q3k/Software/gvisor/vdso/BUILD:8:1: Executing genrule //vdso:vdso failed (Exit 1)
Traceback (most recent call last):
File "/home/q3k/.cache/bazel/_bazel_q3k/2a6b2df8cb638e5ef4933f67041a7700/bazel-sandbox/2604803244674486523/execroot/__main__/bazel-out/host/bin/vdso/check_vdso.runfiles/__main__/vdso/check_vdso.py", line 204, in <module>
main()
File "/home/q3k/.cache/bazel/_bazel_q3k/2a6b2df8cb638e5ef4933f67041a7700/bazel-sandbox/2604803244674486523/execroot/__main__/bazel-out/host/bin/vdso/check_vdso.runfiles/__main__/vdso/check_vdso.py", line 196, in main
CheckSegments(args.vdso)
File "/home/q3k/.cache/bazel/_bazel_q3k/2a6b2df8cb638e5ef4933f67041a7700/bazel-sandbox/2604803244674486523/execroot/__main__/bazel-out/host/bin/vdso/check_vdso.runfiles/__main__/vdso/check_vdso.py", line 69, in CheckSegments
lines = output.split("\n")
TypeError: a bytes-like object is required, not 'str'
Target //runsc:runsc failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.855s, Critical Path: 0.93s
FAILED: Build did NOT complete successfully
Workaround is, of course, to make python
in your $PATH
point to a Python 2.7 interpreter.
https://gvisor-review.googlesource.com/#/c/gvisor/+/1420
Here's a fix to make check_vdso.py
run on both py2 and py3.