pixie-io / pixie

Instant Kubernetes-Native Application Observability
https://px.dev
Apache License 2.0
5.58k stars 427 forks source link

Error when compiling stirling with bazel : cannot find gcc or CC #279

Open woxiang-H opened 3 years ago

woxiang-H commented 3 years ago

Describe the bug A clear and concise description of what the bug is. Error when compiling stirling with bazel : cannot find gcc or CC (clang); either correct your path or set the CC environment variable. Even if I define the CC environment variable, it still doesn't work.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'

    cd pixie

    export CC=/usr/bin/gcc

    /root/pixie/src/stirling/scripts/stirling_wrapper.sh

  2. See error INFO: Repository local_config_cc instantiated at: /DEFAULT.WORKSPACE.SUFFIX:368:13: in /root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/cc_configure.bzl:184:16: in cc_configure Repository rule cc_autoconf defined at: /root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/cc_configure.bzl:145:30: in ERROR: An error occurred during the fetch of repository 'local_config_cc': Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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 "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 340, column 23, in configure_unix_toolchain cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools) File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 32, in _find_generic auto_configure_fail(msg) File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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: Error fetching repository: Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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 "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 340, column 23, in configure_unix_toolchain cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools) File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 32, in _find_generic auto_configure_fail(msg) File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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: /root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/BUILD:469:14: @bazel_tools//tools/cpp:compiler 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: While resolving configuration keys for //src/stirling/binaries:stirling_wrapper: Analysis failed ERROR: Analysis of target '//src/stirling/binaries:stirling_wrapper' failed; build aborted: Analysis failed INFO: Elapsed time: 0.275s INFO: 0 processes. FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. Please make sure the screenshot does not contain any sensitive information such as API keys or access tokens.

Logs Please attach the logs by running the following command:

./px collect-logs

App information (please complete the following information):

Additional context Add any other context about the problem here.

yzhao1012 commented 3 years ago

(Yaxiong from the Pixie team)

Thanks for reporting this!

src/stirling/scripts/stirling_wrapper.sh wraps bazel (build system used by Pixie codebase). It seems your bazel configuration has problem.

Could you run:

bazel build //src/stirling/binaries:stirling_wrapper --verbose_failures

And copy the screen output here?

woxiang-H commented 3 years ago

It looks like the same error

# bazel build //src/stirling/binaries:stirling_wrapper --verbose_failures
INFO: Repository local_config_cc instantiated at:
  /DEFAULT.WORKSPACE.SUFFIX:368:13: in <toplevel>
  /root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/cc_configure.bzl:184:16: in cc_configure
Repository rule cc_autoconf defined at:
  /root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/cc_configure.bzl:145:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'local_config_cc':
   Traceback (most recent call last):
    File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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 "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 340, column 23, in configure_unix_toolchain
        cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools)
    File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 32, in _find_generic
        auto_configure_fail(msg)
    File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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: Error fetching repository: Traceback (most recent call last):
    File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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 "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 340, column 23, in configure_unix_toolchain
        cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools)
    File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 32, in _find_generic
        auto_configure_fail(msg)
    File "/root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/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: /root/.cache/bazel/_bazel_root/726abf8396a6eda168d08024da698b6c/external/bazel_tools/tools/cpp/BUILD:469:14: @bazel_tools//tools/cpp:compiler 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: While resolving configuration keys for //src/stirling/binaries:stirling_wrapper: Analysis failed
ERROR: Analysis of target '//src/stirling/binaries:stirling_wrapper' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.253s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
sundarv85 commented 3 years ago

I'm facing the same issue. Any pointers as to how to solve this.. I tried with both bazel 4.2.0 as well as 4.0.0 - and also the latest and a older commit..