i am new to bazel and i am looking for how to compile cuda using bazel. if people can provide me a link to a simple example, that will be great. thanks in advance for the help.
i did a search online and got some example code from
https://github.com/Hibbert-pku/bazel_nvcc but it does not contain much explanation, i try to understand what those bazel code means online. following the README, i ran
bazel build cuda:all # this works
bazel test tests:all # does not work -- i show the log at the end of this message
i wonder if "bazel test tests:all" is really needed to demonstrate compiling cuda.
i cd into the bazel-bin directory, to run the executable "main" and got error message below. how can i fix this error?
hweekuans-MacBook-Pro:cuda hweekuan$ pwd; ./main
/Users/hweekuan/Downloads/bazel_nvcc-master/bazel-bin/cuda
dyld: lazy symbol binding failed: Symbol not found: __Z4testv
Referenced from: /private/var/tmp/_bazel_hweekuan/0b84f6c3e6339ca2539ddc180fa50b4d/execroot/bazel_nvcc-master/bazel-out/local-fastbuild/bin/cuda/./main
Expected in: flat namespace
dyld: Symbol not found: __Z4testv
Referenced from: /private/var/tmp/_bazel_hweekuan/0b84f6c3e6339ca2539ddc180fa50b4d/execroot/bazel_nvcc-master/bazel-out/local-fastbuild/bin/cuda/./main
Expected in: flat namespace
Abort trap: 6
------------------------------
error for running bazel test tests:all
hweekuans-MacBook-Pro:bazel_nvcc-master hweekuan$ bazel test tests:all
ERROR: /Users/hweekuan/Downloads/bazel_nvcc-master/tests/BUILD:5:1: no such package '@gtest//': Error downloading [
https://googletest.googlecode.com/files/gtest-1.7.0.zip] to /private/var/tmp/_bazel_hweekuan/0b84f6c3e6339ca2539ddc180fa50b4d/external/gtest/gtest-1.7.0.zip: GET returned 404 Not Found and referenced by '//tests:all_tests'.
ERROR: Analysis of target '//tests:all_tests' failed; build aborted.
INFO: Elapsed time: 0.339s
ERROR: Couldn't start the build. Unable to run tests.