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

How to reference the platform repository. #59

Open
esharkwang opened this issue Dec 29, 2022 · 2 comments
Open

How to reference the platform repository. #59

esharkwang opened this issue Dec 29, 2022 · 2 comments

Comments

@esharkwang
Copy link

Hi All,

I am new to use bazel build system. I installed the latest bazelisk and bazel with 6.0.0. However when I tried to build fleetbench the following messages were pop out.
bazel run -c opt fleetbench/swissmap:cold_swissmap_benchmark
ERROR: /root/.cache/bazel/_bazel_root/0bce1989468318c371f4348e6ac4d902/external/bazel_tools/platforms/BUILD:89:6: in alias rule @bazel_tools//platforms:windows: Constraints from @bazel_tools//platforms have been removed. Please use constraints from @platforms repository embedded in Bazel, or preferably declare dependency on https://github.com/bazelbuild/platforms. See bazelbuild/bazel#8622 for details.
ERROR: /root/.cache/bazel/_bazel_root/0bce1989468318c371f4348e6ac4d902/external/bazel_tools/platforms/BUILD:89:6: Analysis of target '@bazel_tools//platforms:windows' failed
ERROR: /home/nvidia/walter/fleetbench/fleetbench/swissmap/BUILD:30:28: While resolving toolchains for target //fleetbench/swissmap:cold_swissmap_benchmark: invalid registered toolchain '@bazel_skylib//toolchains/unittest:cmd_toolchain':
ERROR: Analysis of target '//fleetbench/swissmap:cold_swissmap_benchmark' failed; build aborted:
INFO: Elapsed time: 1.363s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (33 packages loaded, 85 targets configured)
ERROR: Build failed. Not running target

I had checked the issue 8622. But I didn't get any clue how to declare dependency on the platform repository. Could someone give me a hint? Thanks in advance.

Walter

@aranguyen
Copy link
Contributor

In order to fix this error, I find it easiest doing the following:

  1. Vet where in your code base by doing a simple search if there are any remaining references using @bazel_tools//platforms:<some-value>. If there are update them using the new values
  2. If step 1 does not help get rid the above error, it means that there are probably direct deps in your code base that are still referencing the deprecated values. Do the following to find out what need to be updated
$ bazel build --nobuild <your-repo>
$ bazel info output_base
$ grep -r "@bazel_tools//platforms" <output from 2nd command>

Afer you get a list of deps that need to be updated. You probably want to:

  1. update the deps to use the new constraints value if they're not already updated
  2. use the updated version of your deps (probably declared in your WORKSPACE file)

Some example PRs: bazel-contrib/rules_jvm_external#730, https://github.com/bazelbuild/examples/pull/255/files

@esharkwang
Copy link
Author

Hi aranguyen,

Happy new year! Appreciate your help! I found that it was caused by some old library referenced the old version of skylib. So it would cause build failure. After specify the latest skylib lib, the first phase could pass. However I hit the a new problem. I am not sure whether it is related to the platform issue.

it would fail as no permission. I had add 777 privileges for fleetbench folder. However gcc reported no permission to cause build failure. I also cleaned the bazel cache with "bazel clean --expunge". Could you help to give me some hint?
Loading:
Loading: 0 packages loaded
Analyzing: 6 targets (0 packages loaded, 0 targets configured)
INFO: Analyzed 6 targets (0 packages loaded, 0 targets configured).
INFO: Found 6 targets...
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
ERROR: /home/nvidia/walter/fleetbench/fleetbench/BUILD:15:11: Compiling fleetbench/benchmark_main.cc failed: (Exit 1): linux-sandbox failed: error executing command
(cd /root/.cache/bazel/_bazel_root/0bce1989468318c371f4348e6ac4d902/sandbox/linux-sandbox/1764/execroot/com_google_fleetbench &&
exec env -
PATH=/root/.cache/bazelisk/downloads/bazelbuild/bazel-6.0.0-linux-arm64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
PWD=/proc/self/cwd
TMPDIR=/tmp
/root/.cache/bazel/bazel_root/install/e29ee670a416492cdd027a3b624c91c6/linux-sandbox -t 15 -w /root/.cache/bazel/bazel_root/0bce1989468318c371f4348e6ac4d902/sandbox/linux-sandbox/1764/execroot/com_google_fleetbench -w /tmp -w /dev/shm -S /root/.cache/bazel/bazel_root/0bce1989468318c371f4348e6ac4d902/sandbox/linux-sandbox/1764/stats.out -D -- /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/aarch64-fastbuild/bin/fleetbench/objs/benchmark_main/benchmark_main.pic.d '-frandom-seed=bazel-out/aarch64-fastbuild/bin/fleetbench/objs/benchmark_main/benchmark_main.pic.o' -fPIC -DBENCHMARK_STATIC_DEFINE '-DBAZEL_CURRENT_REPOSITORY=""' -iquote . -iquote bazel-out/aarch64-fastbuild/bin -iquote external/com_google_benchmark -iquote bazel-out/aarch64-fastbuild/bin/external/com_google_benchmark -Ibazel-out/aarch64-fastbuild/bin/external/com_google_benchmark/virtual_includes/benchmark '-std=c++17' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP="redacted"' '-D__TIME="redacted"' -c fleetbench/benchmark_main.cc -o bazel-out/aarch64-fastbuild/bin/fleetbench/_objs/benchmark_main/benchmark_main.pic.o)
1672730117.220622227: src/main/tools/linux-sandbox.cc:152: calling pipe(2)...
1672730117.220766588: src/main/tools/linux-sandbox.cc:171: calling clone(2)...
1672730117.222038155: src/main/tools/linux-sandbox.cc:180: linux-sandbox-pid1 has PID 2735588
1672730117.222152715: src/main/tools/linux-sandbox-pid1.cc:681: Pid1Main started
1672730117.224193046: src/main/tools/linux-sandbox.cc:197: done manipulating pipes
1672730117.224908730: src/main/tools/linux-sandbox-pid1.cc:285: working dir: /root/.cache/bazel/_bazel_root/0bce1989468318c371f4348e6ac4d902/sandbox/linux-sandbox/1764/execroot/com_google_fleetbench
1672730117.225025091: src/main/tools/linux-sandbox-pid1.cc:320: writable: /root/.cache/bazel/_bazel_root/0bce1989468318c371f4348e6ac4d902/sandbox/linux-sandbox/1764/execroot/com_google_fleetbench
1672730117.225043531: src/main/tools/linux-sandbox-pid1.cc:320: writable: /tmp
1672730117.225064051: src/main/tools/linux-sandbox-pid1.cc:320: writable: /dev/shm
1672730117.225187932: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /
1672730117.225236892: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /dev
1672730117.225260692: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /dev/pts
1672730117.225291972: src/main/tools/linux-sandbox-pid1.cc:400: remount rw: /dev/shm
1672730117.225299652: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /dev/hugepages
1672730117.225319293: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /dev/mqueue
1672730117.225340453: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /run
1672730117.225361253: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /run/lock
1672730117.225387413: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /run/credentials/systemd-sysusers.service
1672730117.225855175: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /run/rpc_pipefs
1672730117.225907056: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /run/snapd/ns
1672730117.225937936: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /run/user/1000
1672730117.225963056: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /run/netns/cni-421c2dc4-7bd3-fa79-3871-8062e452a85d
1672730117.226041856: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys
1672730117.226066937: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/kernel/security
1672730117.226547859: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/fs/cgroup
1672730117.226599740: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/fs/pstore
1672730117.226624540: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/firmware/efi/efivars
1672730117.226651060: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/fs/bpf
1672730117.226684260: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/kernel/debug
1672730117.226704500: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/kernel/tracing
1672730117.226723940: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/fs/fuse/connections
1672730117.226747860: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /sys/kernel/config
1672730117.226766740: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /proc
1672730117.226786061: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /proc/sys/fs/binfmt_misc
1672730117.226810661: src/main/tools/linux-sandbox-pid1.cc:422: remount(nullptr, /proc/sys/fs/binfmt_misc, nullptr, 2101281, nullptr) failure (Operation not permitted) ignored
1672730117.226827141: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /proc/sys/fs/binfmt_misc
1672730117.226844981: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/aws-cli/159
1672730117.226911301: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/conjure-up/965
1672730117.226929501: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/core/14400
1672730117.226950541: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/core20/1740
1672730117.226966462: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/docker/1783
1672730117.226980142: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/docker/2281
1672730117.227007062: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/doctl/405
1672730117.227014782: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/etcd/232
1672730117.227023142: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/juju/20893
1672730117.227031382: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/juju/21123
1672730117.227036742: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/kata-containers/2048
1672730117.227044662: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/keepalived/2349
1672730117.227051862: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/lxd/22927
1672730117.227058742: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/lxd/23545
1672730117.227124622: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/microk8s/4178
1672730117.227133462: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/mosquitto/700
1672730117.227138902: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/mosquitto/781
1672730117.227145062: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/snapd/17885
1672730117.227152543: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /boot
1672730117.227179623: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /boot/efi
1672730117.227198503: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/core18/2658
1672730117.227208703: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/microk8s/4372
1672730117.227220743: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/var/lib/kubelet/pods/64a9bab2-0deb-4395-ab7a-c74c6fd9e643/volumes/kubernetes.ioprojected/kube-api-access-swq45
1672730117.227251743: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/346ebfd859bf4dc48760d2e4afba9cea61b4465b4c9513f8f05466c10e9e2a33/shm
1672730117.227290503: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/run/containerd/io.containerd.runtime.v2.task/k8s.io/346ebfd859bf4dc48760d2e4afba9cea61b4465b4c9513f8f05466c10e9e2a33/rootfs
1672730117.227340544: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/run/containerd/io.containerd.runtime.v2.task/k8s.io/4ad867f20ab89d62a2663e59ca714a74ac1afc876ab7c7007314b9021031cc4d/rootfs
1672730117.227367624: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/var/lib/kubelet/pods/1dfbaec1-c56b-4425-9477-62127768d3bc/volumes/kubernetes.io
projected/kube-api-access-ft4p4
1672730117.227408584: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/cdbbe943dc132ee247379d31f983363abb8d2e59853a5a6c74b8cff0fda6703f/shm
1672730117.227438264: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/run/containerd/io.containerd.runtime.v2.task/k8s.io/cdbbe943dc132ee247379d31f983363abb8d2e59853a5a6c74b8cff0fda6703f/rootfs
1672730117.228433550: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /var/snap/microk8s/common/run/containerd/io.containerd.runtime.v2.task/k8s.io/3ccc552449b69dcc7ed755ba476d66d8b0dd9b0642fc11126eba87ded1e42bf1/rootfs
1672730117.228462230: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/nextcloud/32879
1672730117.228472750: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/core18/2671
1672730117.228482190: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/core20/1782
1672730117.228489670: src/main/tools/linux-sandbox-pid1.cc:400: remount ro: /snap/nextcloud/33060
1672730117.228499470: src/main/tools/linux-sandbox-pid1.cc:400: remount rw: /root/.cache/bazel/_bazel_root/0bce1989468318c371f4348e6ac4d902/sandbox/linux-sandbox/1764/execroot/com_google_fleetbench
1672730117.228513030: src/main/tools/linux-sandbox-pid1.cc:400: remount rw: /root/.cache/bazel/_bazel_root/0bce1989468318c371f4348e6ac4d902/sandbox/linux-sandbox/1764/execroot/com_google_fleetbench
1672730117.228523350: src/main/tools/linux-sandbox-pid1.cc:400: remount rw: /tmp
1672730117.228553830: src/main/tools/linux-sandbox-pid1.cc:400: remount rw: /dev/shm
1672730117.228788311: src/main/tools/linux-sandbox-pid1.cc:491: calling fork...
1672730117.229233474: src/main/tools/linux-sandbox-pid1.cc:521: child started with PID 2
gcc: error: fleetbench/benchmark_main.cc: Permission denied
gcc: fatal error: no input files
compilation terminated.
1672730117.233419257: src/main/tools/linux-sandbox-pid1.cc:538: wait returned pid=2, status=0x100
1672730117.233484057: src/main/tools/linux-sandbox-pid1.cc:556: child exited normally with code 1
1672730117.236927436: src/main/tools/linux-sandbox.cc:233: child exited normally with code 1
INFO: Elapsed time: 1.134s, Critical Path: 0.71s
INFO: 161 processes: 161 internal.
FAILED: Build did NOT complete successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants