Skip to content

Commit

Permalink
sysdig: build on Linux (#87581)
Browse files Browse the repository at this point in the history
We need the patch adopted by Arch Linux and reported upstream at
draios/sysdig#1778 to build this on Linux.

Also, skip the libscap examples, and don't force a C++ standard. This
leads to build failures.
  • Loading branch information
carlocab authored Oct 21, 2021
1 parent 85b44dc commit 03b9d5a
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions Formula/sysdig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@ class Sysdig < Formula
sha256 "efe287e651a3deea5e87418d39e0fe1e9dc55c6886af4e952468cd64182ee7ef"
end

# Fix build with GRPC 1.41. Reported upstream at:
# https://github.com/draios/sysdig/issues/1778
patch do
url "https://raw.githubusercontent.com/archlinux/svntogit-community/d0e6e96ed2f95336d1f75266fcf896034268abe4/trunk/0.27.1-grpc-absl-sync.patch"
sha256 "9390c4c2d8aef6110aae63835aab07585bbe9856c820020750e0ba678e4da653"
end

def install
args = std_cmake_args + %W[
-DSYSDIG_VERSION=#{version}
-DUSE_BUNDLED_DEPS=OFF
-DCREATE_TEST_TARGETS=OFF
-DBUILD_LIBSCAP_EXAMPLES=OFF
-DDIR_ETC=#{etc}
]

Expand All @@ -58,23 +66,9 @@ def install
args << "-DUSE_BUNDLED_#{dep}=OFF"
end

if OS.linux?
# Workaround for:
# error adding symbols: DSO missing from command line
abseil_libdir = Formula["abseil"].opt_lib
ENV.append "LDFLAGS", "-L#{abseil_libdir} -Wl,-rpath,#{abseil_libdir}"

# We need to compile with C++17 to use abseil.
args += %w[
-DBUILD_DRIVER=OFF
-DCMAKE_CXX_STANDARD=17
]
end
# We need C++17 to use Abseil.
args << "-DBUILD_DRIVER=OFF" if OS.linux?

# From upstream build instructions:
# "Note: Sysdig's build can get confused with GNU make's parallel job option (-j)."
# https://github.com/draios/sysdig/wiki/How-to-Install-Sysdig-from-the-Source-Code#linux-and-osx
ENV.deparallelize if OS.linux?
system "cmake", "-S", ".", "-B", "build", *args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
Expand Down

0 comments on commit 03b9d5a

Please sign in to comment.