google-deepmind / code_contests

Apache License 2.0
2.04k stars 200 forks source link

Auto-Configuration Error when run Bazel #18

Closed zczlsde closed 1 year ago

zczlsde commented 2 years ago

When I run the bazel run -c opt :print_names_and_sources /tmp/dm-code_contests/code_contests_valid.riegeli, an error occurred.

ERROR: An error occurred during the fetch of repository 'local_config_cc': Traceback (most recent call last): File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/cc_configure.bzl", line 127, column 33, in cc_autoconf_impl configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 345, column 17, in configure_unix_toolchain cc = find_cc(repository_ctx, overriden_tools) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 23, in find_cc cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 306, column 32, in _find_generic auto_configure_fail(msg) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 112, column 9, in auto_configure_fail fail("\n%sAuto-Configuration Error:%s %s\n" % (red, no_color, msg)) Error in fail: Auto-Configuration Error: Cannot find gcc or CC (clang); either correct your path or set the CC environment variable ERROR: /DEFAULT.WORKSPACE.SUFFIX:519:13: fetching cc_autoconf rule //external:local_config_cc: Traceback (most recent call last): File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/cc_configure.bzl", line 127, column 33, in cc_autoconf_impl configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 345, column 17, in configure_unix_toolchain cc = find_cc(repository_ctx, overriden_tools) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 23, in find_cc cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 306, column 32, in _find_generic auto_configure_fail(msg) File "/home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 112, column 9, in auto_configure_fail fail("\n%sAuto-Configuration Error:%s %s\n" % (red, no_color, msg)) Error in fail: Auto-Configuration Error: Cannot find gcc or CC (clang); either correct your path or set the CC environment variable INFO: Repository com_google_riegeli instantiated at: /home/sameul/code_contests/WORKSPACE:40:13: in Repository rule http_archive defined at: /home/sameul/.cache/bazel/_bazel_sameul/25938179392971c8c07cd72c7f57c456/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in ERROR: /home/sameul/code_contests/BUILD:52:10: //:print_names_and_sources depends on @local_config_cc//:cc-compiler-k8 in repository @local_config_cc which failed to fetch. no such package '@local_config_cc//': Auto-Configuration Error: Cannot find gcc or CC (clang); either correct your path or set the CC environment variable ERROR: Analysis of target '//:print_names_and_sources' failed; build aborted: Analysis failed INFO: Elapsed time: 34.222s INFO: 0 processes. FAILED: Build did NOT complete successfully (34 packages loaded, 125 targets c\ FAILED: Build did NOT complete successfully (34 packages loaded, 125 targets c\ onfigured)

Could anyone help me to resolve this?

jtkeeling commented 2 years ago

It looks like you don't have a C++ compiler available. I would try installing clang, and then making sure it's in your PATH with which clang.

zczlsde commented 2 years ago

Thanks a lot! It solves my problem. By the way, how to use this dataset for training. I could only view the question name through the command bazel run -c opt :print_names_and_sources /tmp/dm-code_contests/code_contests_valid.riegeli but how to view the contents and feed the dataset to my model. Are there any guides for this?

jtkeeling commented 2 years ago

If you look at the source code for print_names_and_sources.py, you should be able to see how the name is printed from the contest problem protobuf.

You can see the rest of the protobuf format in contest_problem.proto.

If you're not familiar with how to work with protobufs, I would start here: https://developers.google.com/protocol-buffers/docs/pythontutorial