google / perf_data_converter

Tool to convert Linux perf files to the profile.proto format used by pprof
BSD 3-Clause "New" or "Revised" License
294 stars 55 forks source link

build error using bazel #149

Closed SakuraX99 closed 11 months ago

SakuraX99 commented 11 months ago

when I build perf-data-converter, I have this error, how I can solve it?

[root@opengauss-master perf_data_converter]# bazel build src:perf_to_profile Starting local Bazel server and connecting to it... DEBUG: Rule 'com_google_protobuf' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "7372397031f356341e932c4b0489489e4111152fc3a9e03660ede951e9b2d84d" DEBUG: Repository com_google_protobuf instantiated at: /root/perf/perf_data_converter/WORKSPACE:30:13: in Repository rule http_archive defined at: /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in DEBUG: Rule 'rules_python' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "12b37c991026c4ce136509fd3aeb4a194e98a29c0f328ecac53269a8c0af2906" DEBUG: Repository rules_python instantiated at: /root/perf/perf_data_converter/WORKSPACE:20:13: in Repository rule http_archive defined at: /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in INFO: Repository boringssl instantiated at: /root/perf/perf_data_converter/WORKSPACE:37:13: in Repository rule http_archive defined at: /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in INFO: Repository bazel_skylib instantiated at: /root/perf/perf_data_converter/WORKSPACE:5:13: in Repository rule http_archive defined at: /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in ERROR: /root/perf/perf_data_converter/src/BUILD:170:11: error loading package '@com_google_protobuf//': at /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/rules_python/python/defs.bzl:20:6: at /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/rules_python/python/py_runtime.bzl:19:6: at /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/rules_python/python/private/common/py_runtime_macro.bzl:16:6: at /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/rules_python/python/private/common/py_runtime_rule.bzl:21:6: at /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/external/rules_python/python/private/common/py_internal.bzl:23:6: Unable to find package for @rules_python_internal//:py_internal.bzl: The repository '@rules_python_internal' could not be resolved: Repository '@rules_python_internal' is not defined. and referenced by '//src:builder' ERROR: Analysis of target '//src:perf_to_profile' failed; build aborted: INFO: Elapsed time: 9.419s INFO: 0 processes. FAILED: Build did NOT complete successfully (39 packages loaded, 206 targets configured) currently loading: @com_google_protobuf// Fetching https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz

PeterFeicht commented 11 months ago

Same for me, tried on Ubuntu 20.04 with Bazel 6.3.2 from the apt repo. Tried the last few master commits, none would build for me.

@cptspacemanspiff posted a workaround for a similar error on issue #101 a while back, which is apparently on master now. Maybe the same needs to be done for the rules_python dependency?

SakuraX99 commented 11 months ago

Same for me, tried on Ubuntu 20.04 with Bazel 6.3.2 from the apt repo. Tried the last few master commits, none would build for me.

@cptspacemanspiff posted a workaround for a similar error on issue #101 a while back, which is apparently on master now. Maybe the same needs to be done for the rules_python dependency?

I have fixed it by modifying the WORKSPACE file as this:

rules_python is a dependency for protobuf.

http_archive( name = "rules_python", urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.0.2/rules_python-0.0.2.tar.gz"], strip_prefix = "rules_python-0.0.2", type = "tar.gz", )

load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() load("@rules_python//python:pip.bzl", "pip_repositories") pip_repositories()

but I meet new problems about compiling, it's hard for me to workout:

[root@opengauss-master perf_data_converter]# bazel build src:perf_to_profile --verbose_failures INFO: Analyzed target //src:perf_to_profile (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /root/perf/perf_data_converter/src/quipper/BUILD:107:11: Compiling src/quipper/dso.cc failed: (Exit 1): gcc failed: error executing command (from target //src/quipper:dso) (cd /root/.cache/bazel/_bazel_root/4a25792f71ccee4f60d59a36fdf7bb13/sandbox/linux-sandbox/466/execroot/main && \ exec env - \ LD_LIBRARY_PATH=/opt/huawei/install/om/lib:/opt/huawei/install/om/script/gspylib/clib: \ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/huawei/install/om/script/gspylib/pssh/bin:/opt/huawei/install/om/script:/root/gauss_om/omm/script:/root/perf/go/golang/bin:/root/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/src/quipper/_objs/dso/dso.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/src/quipper/_objs/dso/dso.pic.o' -fPIC '-DBAZEL_CURRENT_REPOSITORY=""' -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/boringssl -iquote bazel-out/k8-fastbuild/bin/external/boringssl -isystem src/quipper -isystem bazel-out/k8-fastbuild/bin/src/quipper -isystem external/boringssl/src/include -isystem bazel-out/k8-fastbuild/bin/external/boringssl/src/include -fno-canonical-system-headers -Wno-builtin-macro-redefined '-DDATE="redacted"' '-DTIMESTAMP="redacted"' '-DTIME="redacted"' -c src/quipper/dso.cc -o bazel-out/k8-fastbuild/bin/src/quipper/_objs/dso/dso.pic.o)

Configuration: 442d8db79c046018027f86fb6ba2e9e3560c56c0504c8b6423d08c7d06207c4d

Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging src/quipper/dso.cc:9:10: fatal error: gelf.h: No such file or directory

include

      ^~~~~~~~

compilation terminated. Target //src:perf_to_profile failed to build INFO: Elapsed time: 0.484s, Critical Path: 0.31s INFO: 66 processes: 65 internal, 1 linux-sandbox. FAILED: Build did NOT complete successfully

s-kanev commented 11 months ago

This should be fixed with #150 which was just merged to main. Feel free to re-open if it's not.