pixie-io / pixie

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

Fail to build Pixie project with bazel #1673

Closed AsherAroussi closed 1 year ago

AsherAroussi commented 1 year ago

Describe the bug I download the pixie project and tried to compile it (I want to run the standalone PEM and test it). I run the command : bazel build under pixie directory and encountered the following error:

Error in fail: Error while fetching artifact with coursier: Resolution error: Error downloading org.apache.thrift:libthrift:0.10.0 download error: Caught javax.net.ssl.SSLHandshakeException (PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target) while downloading https://repo1.maven.org/maven2/org/apache/thrift/libthrift/0.10.0/libthrift-0.10.0.pom

So I downloaded all artifacts defined in the file bazel/thrift.bzl to my local repository and change the repositories (under maven_install in this file) to my local repository path [ "https://repo1.maven.org/maven2" ==> "/work/.m2/repository" ].

Now, when I try to build I get the following error:

ERROR: Error computing the main repository mapping: no such package '@thrift_deps//': Error while fetching artifact with coursier: Exception in thread "main" java.net.MalformedURLException: No protocol found in URL /work/.m2/repository/org/apache/thrift/libthrift/0.10.0/libthrift-0.10.0.pom

I tried to download the libthrift-0.10.0.pom and libthrift-0.10.0.pom.sha1 from maven repository to /work/.m2/repository/org/apache/thrift/libthrift/0.10.0/ but it didn't help.

I'm newbie in bazel so appreciate any help. Thanks.

To Reproduce

  1. Download pixie from git.
  2. cd pixie
  3. run bazel build

Expected behavior compilation succeeds. thrift.zip

ddelnano commented 1 year ago

Hi @AsherAroussi, Pixie's build should work without making changes to the source. Are you unable to use the reop1.maven.org to install maven packages?

Did you perform any set up prior to running bazel build or modifying the maven repository location? If not, you will either need to run the chef code (via cd tools/chef; sudo chef-solo -c solo.rb -j node_workstation.json) to provision a Linux host or run bazel from our development docker image.

AsherAroussi commented 1 year ago

Thank you, @ddelnano for your response. I haven't done any changes in maven repository location (or any changes) prior to the build command. I run the command _sudo chef-solo -c solo.rb -j nodeworkstation.json and it fails with the following error:

asher@7.182.8.120@/work/tools/pixie/tools/chef ((HEAD detached at release/cloud/v0.1.7))# sudo chef-solo -c solo.rb -j node_workstation.json Starting Chef Client, version 12.14.60 resolving cookbooks for run list: ["px_dev_extras::linux_clang", "px_dev", "px_dev_extras"] Synchronizing Cookbooks:

================================================================================ Recipe Compile Error in /tmp/cookbooks/common/resources/remote_bin.rb

NoMethodError

undefined method `unified_mode' for # Did you mean? undef_method

Cookbook Trace:

/tmp/cookbooks/common/resources/remote_bin.rb:17:in `class_from_file'

Relevant File Content:

/tmp/cookbooks/common/resources/remote_bin.rb:

10: # distributed under the License is distributed on an "AS IS" BASIS, 11: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12: # See the License for the specific language governing permissions and 13: # limitations under the License. 14: # 15: # SPDX-License-Identifier: Apache-2.0 16: 17>> unified_mode true 18: provides :remote_bin 19: 20: property :name, String, name_property: true 21: property :bin_name, String, default: '' 22: 23: default_action :create 24: 25: action :create do 26: tool_dir = "/opt/px_dev/tools/#{new_resource.name}"

Platform:

x86_64-linux-gnu

Running handlers: [2023-08-16T16:16:55+08:00] ERROR: Running exception handlers Running handlers complete [2023-08-16T16:16:55+08:00] ERROR: Exception handlers complete Chef Client failed. 0 resources updated in 03 seconds [2023-08-16T16:16:55+08:00] FATAL: Stacktrace dumped to /tmp/chef-stacktrace.out [2023-08-16T16:16:55+08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2023-08-16T16:16:55+08:00] ERROR: undefined method `unified_mode' for # Did you mean? undef_method /usr/lib/ruby/vendor_ruby/chef/application/exit_code.rb:90: warning: constant ::Fixnum is deprecated [2023-08-16T16:16:55+08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) /usr/lib/ruby/vendor_ruby/chef/application/exit_code.rb:90: warning: constant ::Fixnum is deprecated

remote_bin.zip

ddelnano commented 1 year ago

Starting Chef Client, version 12.14.60

@AsherAroussi chef version 12.x is extremely old. The error you are experiencing is due to older chef versions not supporting unified_mode.

Screenshot 2023-08-16 at 2 24 55 PM

Our development environment currently targets Ubuntu jammy (22.04) and uses chef 18.x. The other alternative development option is to run all of the development utilities from our docker image (as described here).

AsherAroussi commented 1 year ago

Thank you, @ddelnano for your help. I upgrade the chef: chef-solo -v Chef Infra Client: 18.2.7

I run the command : sudo chef-solo -c tools/chef/solo.rb -j tools/chef/node_workstation.json and get the following:

asher@7.182.8.120@/work/tools/pixie ((HEAD detached at release/cloud/v0.1.7))# sudo chef-solo -c tools/chef/solo.rb -j tools/chef/node_workstation.json Chef Infra Client, version 18.2.7 Patents: https://www.chef.io/patents Infra Phase starting Resolving cookbooks for run list: ["px_dev_extras::linux_clang", "px_dev", "px_dev_extras"] Synchronizing cookbooks:

Running handlers: [2023-08-17T16:16:14+08:00] ERROR: Running exception handlers Running handlers complete [2023-08-17T16:16:14+08:00] ERROR: Exception handlers complete Infra Phase failed. 5 resources updated in 01 minutes 56 seconds [2023-08-17T16:16:14+08:00] FATAL: Stacktrace dumped to /tmp/chef-stacktrace.out [2023-08-17T16:16:14+08:00] FATAL: --------------------------------------------------------------------------------------- [2023-08-17T16:16:14+08:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT [2023-08-17T16:16:14+08:00] FATAL: --------------------------------------------------------------------------------------- [2023-08-17T16:16:14+08:00] FATAL: Chef::Exceptions::Package: apt_package[autoconf, bash-completion, bc, build-essential, crun, curl, docker.io, git, libncurses5, lcov, podman, sudo, systemd, unzip, virtualenvwrapper, zlib1g-dev, zip, bison, flex, libedit-dev, libelf-dev, gcc-12, g++-12, libltdl-dev, libunwind-dev, qemu, qemu-system-arm, qemu-system-x86, qemu-user-static, qemu-utils] (px_dev::linux line 62) had an error: Chef::Exceptions::Package: No candidate version available for crun, podman, gcc-12, g++-12

chef-stacktrace.zip

ddelnano commented 1 year ago

No problem. I see you are using Ubuntu 18.04. As I mentioned before, our development docker image setup builds on top of Ubuntu jammy (22.04). You will need to run chef on that version of Ubuntu.

AsherAroussi commented 1 year ago

Thank you. I appreciate your help, @ddelnano . I'll upgrade

ddelnano commented 1 year ago

Not a problem :). I'm going to close this for now since so far things point to needing a compatible build environment. However, I'm happy to continue the discussion here as you get closer to having a working build. So please don't hesitate to continue with any new issues that arise!