Bazel build error: gcc failed: error executing command

Hi, my libtorch version is libtorch-cxx11-abi-shared-with-deps-1.10.2+cu113.zip.
I have build an example successfully with CMake before.
Now I want to build with bazel. I have followed cc_library() import precompiled shared libraries to a temp directory caused error while loading shared libraries · Issue #10803 · bazelbuild/bazel · GitHub

the project tree:

example
├── BUILD
└── torch-example.cc
libtorch
├── BUILD
├── include
├── lib
WORKSPACE

the libtorch BUILD file:

package(
    default_visibility = ["//visibility:public"],
)
licenses(["notice"])  # BSD
exports_files(["LICENSE"])

TORCH_HEADERS = glob([
    "include/**/*.h",
    "include/*.h",
])

TORCH_LIBRARIES = [
    "lib/libtorch.so",
    "lib/libc10_cuda.so",
    "lib/libc10.so",
    "lib/libcudart-a7b20f20.so.11.0",
    "lib/libnvToolsExt-24de1d56.so.1",
]

cc_library(
    name = "libtorch",
    srcs = TORCH_LIBRARIES,
    hdrs = TORCH_HEADERS,
    includes = ["include", "include/torch/csrc/api/include"],
    linkopts = ["-lpthread"],
)

the example BUILD file:

cc_binary(
    name = "torch-example",
    srcs = ["torch-example.cc"],
    deps = [
        "//libtorch:libtorch",
    ],
)

However, when I ran
bazel build --verbose_explanations --color=yes --curses=yes --verbose_failures -s //example:torch-example

it turned out

ERROR: /data2/ssz/bazel_torch/example/BUILD:3:10: Compiling example/torch-example.cc failed: (Exit 1): gcc failed: error executing command 
  (cd /home/bhu/.cache/bazel/_bazel_bhu/7377f4c691144c42eb6d6f4f8f6daf79/sandbox/linux-sandbox/8/execroot/__main__ && \
  exec env - \
    LD_LIBRARY_PATH=/home/bhu/catkin_ws/devel/lib \
    PATH=/home/bhu/.local/bin:/home/bhu/bin:/home/bhu/google-cloud-sdk/bin:/home/bhu/anaconda3/bin:/home/bhu/anaconda3/condabin:/home/bhu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/bhu/bin:/home/bhu/bin \
    PWD=/proc/self/cwd \
  /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/k8-fastbuild/bin/example/_objs/torch-example/torch-example.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/example/_objs/torch-example/torch-example.pic.o' -fPIC -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/k8-fastbuild/bin/external/bazel_tools -isystem libtorch/include -isystem bazel-out/k8-fastbuild/bin/libtorch/include -isystem libtorch/include/torch/csrc/api/include -isystem bazel-out/k8-fastbuild/bin/libtorch/include/torch/csrc/api/include -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c example/torch-example.cc -o bazel-out/k8-fastbuild/bin/example/_objs/torch-example/torch-example.pic.o)
Execution platform: @local_config_platform//:host

It really make me confused. Could anyone tell me what may I do?
Thanks.