pixie-io / pixie

Instant Kubernetes-Native Application Observability

Home Page:https://px.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to build Pixie project with bazel

AsherAroussi opened this issue · comments

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

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.

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 node_workstation.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:

  • px_dev_extras (0.1.0)
  • px_dev (0.3.0)
  • common (0.1.0)
    Installing Cookbook Gems:
    Compiling Cookbooks...

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

NoMethodError

undefined method `unified_mode' for #Class:0x000055dca00f3750
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 #Class:0x000055dca00f3750
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

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).

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:

  • px_dev_extras (0.1.0)
  • px_dev (0.3.0)
  • common (0.1.0)
    Installing cookbook gem dependencies:
    Compiling cookbooks...
    Loading Chef InSpec profile files:
    Loading Chef InSpec input files:
    Loading Chef InSpec waiver files:
    Converging 69 resources
    Recipe: px_dev_extras::linux_clang
  • remote_file[/tmp/clang.deb] action create

    • create new file /tmp/clang.deb
    • update content in file /tmp/clang.deb from none to a7c6aa
      (file sizes exceed 10000000 bytes, diff output suppressed)
    • change mode from '' to '0644'
  • dpkg_package[clang] action install (up to date)

  • file[/tmp/clang.deb] action delete

    • delete file /tmp/clang.deb
  • execute[lld alternatives selection] action run

    • execute update-alternatives --install "/usr/bin/ld.lld" "lld" "/opt/px_dev/tools/clang-15.0/bin/lld" 10
      Recipe: px_dev::linux
  • apt_update[update] action periodic

    • directory[/var/lib/apt/periodic] action create (up to date)
    • directory[/etc/apt/apt.conf.d] action create (up to date)
    • file[/etc/apt/apt.conf.d/15update-stamp] action create_if_missing (up to date)
    • execute[apt-get -q update] action run
      • execute ["apt-get", "-q", "update"]
    • update new lists of packages
  • 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] action upgrade

    • No candidate version available for crun, podman, gcc-12, g++-12
      ================================================================================
      Error executing action upgrade on resource '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]'
      ================================================================================

    Chef::Exceptions::Package

    No candidate version available for crun, podman, gcc-12, g++-12

    Resource Declaration:

    In /tmp/cookbooks/px_dev/recipes/linux.rb

    62: apt_package apt_pkg_list do
    63: action :upgrade
    64: end
    65:

    Compiled Resource:

    Declared in /tmp/cookbooks/px_dev/recipes/linux.rb:62:in `from_file'

    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") do
    package_name ["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"]
    action [:upgrade]
    default_guard_interpreter :default
    declared_type :apt_package
    cookbook_name "px_dev"
    recipe_name "linux"
    end

    System Info:

    chef_version=18.2.7
    platform=ubuntu
    platform_version=18.04
    ruby=ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
    program_name=/usr/bin/chef-solo
    executable=/opt/chef/bin/chef-solo

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

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.

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

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!