fix build error
Signed-off-by: cherry530 <xuping33@huawei.com>
This commit is contained in:
parent
fe696cfb61
commit
82e67bd879
@ -0,0 +1,41 @@
|
|||||||
|
From e3894c8fac52ce6b7861bd491ef70406545d0f40 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jerome Marchand <jmarchan@redhat.com>
|
||||||
|
Date: Wed, 23 Mar 2022 09:47:25 +0100
|
||||||
|
Subject: [PATCH] Fix libbtf 0.6.0 build
|
||||||
|
|
||||||
|
Libbpf 0.6.0 introduced a new version of btf_dump__new(). The new
|
||||||
|
version is btf_dump__new_v0_6_0() while the old version was renamed
|
||||||
|
btf_dump__new_deprecated(). btf_dump__new() is now overloaded,
|
||||||
|
unfortunately the macro doesn't work on cpp.
|
||||||
|
|
||||||
|
Let's call btf_dump__new_deprecated() explicitely when libbpbf version
|
||||||
|
is above 0.6.0. That should work till support for the deprecated
|
||||||
|
function is removed in libbpf 1.0.0.
|
||||||
|
|
||||||
|
Fixes #2068
|
||||||
|
|
||||||
|
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
||||||
|
---
|
||||||
|
src/btf.cpp | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/btf.cpp b/src/btf.cpp
|
||||||
|
index 7d83cf687e..83bc6e901e 100644
|
||||||
|
--- a/src/btf.cpp
|
||||||
|
+++ b/src/btf.cpp
|
||||||
|
@@ -24,6 +24,15 @@
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#include <bpf/libbpf.h>
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Since libbtf 0.6, btf_dump__new() has been overloaded and now can design
|
||||||
|
+ * either btf_dump__new_v0_6_0() or btf_dump__new_deprecated(), which is the
|
||||||
|
+ * same as btf_dump__new() for libbtf < 0.6, and the one we still use.
|
||||||
|
+ */
|
||||||
|
+#if LIBBPF_MAJOR_VERSION == 0 && LIBBPF_MINOR_VERSION >= 6
|
||||||
|
+#define btf_dump__new(a1, a2, a3, a4) btf_dump__new_deprecated(a1, a2, a3, a4)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#include "bpftrace.h"
|
||||||
|
|
||||||
|
namespace bpftrace {
|
||||||
@ -1,11 +1,12 @@
|
|||||||
Name: bpftrace
|
Name: bpftrace
|
||||||
Version: 0.14.1
|
Version: 0.14.1
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: High-level tracing language for Linux eBPF
|
Summary: High-level tracing language for Linux eBPF
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
|
|
||||||
URL: https://github.com/iovisor/bpftrace
|
URL: https://github.com/iovisor/bpftrace
|
||||||
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||||
|
Patch0000: Choose-to-use-a-functional-interface-to-fix-build-error.patch
|
||||||
|
|
||||||
# Arches will be included as upstream support is added and dependencies are
|
# Arches will be included as upstream support is added and dependencies are
|
||||||
# satisfied in the respective arches
|
# satisfied in the respective arches
|
||||||
@ -65,6 +66,9 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Nov 11 2022 xu_ping <xuping33@h-partners.com> - 0.14.1-4
|
||||||
|
- Use a functional interface depending on the version to fix build error
|
||||||
|
|
||||||
* Thu Jun 9 2022 LemmyHuang <huangliming5@huawei.com> - 0.14.1-3
|
* Thu Jun 9 2022 LemmyHuang <huangliming5@huawei.com> - 0.14.1-3
|
||||||
- fix abort on startup caused by llvm compiler
|
- fix abort on startup caused by llvm compiler
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user