From 48808cdf192669902983a4108a0858d2fa2e8cd3 Mon Sep 17 00:00:00 2001 From: zhangzikang1992 Date: Thu, 22 Aug 2024 14:21:00 +0800 Subject: [PATCH] Fix larchintrin.h not found error for loongarch64 --- ...in.h-not-found-error-for-loongarch64.patch | 60 +++++++++++++++++++ bcc.spec | 8 ++- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 0001-Fix-larchintrin.h-not-found-error-for-loongarch64.patch diff --git a/0001-Fix-larchintrin.h-not-found-error-for-loongarch64.patch b/0001-Fix-larchintrin.h-not-found-error-for-loongarch64.patch new file mode 100644 index 0000000..98945b8 --- /dev/null +++ b/0001-Fix-larchintrin.h-not-found-error-for-loongarch64.patch @@ -0,0 +1,60 @@ +From dd4b72a7a2e7701b5f8e72346cd1a8eb298b6776 Mon Sep 17 00:00:00 2001 +From: zhangzikang +Date: Thu, 1 Aug 2024 11:23:48 +0800 +Subject: [PATCH] Fix larchintrin.h not found error for loongarch64 + +--- + src/python/bcc/__init__.py | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py +index fb4ec74..2e690dd 100644 +--- a/src/python/bcc/__init__.py ++++ b/src/python/bcc/__init__.py +@@ -22,6 +22,7 @@ import re + import errno + import sys + import platform ++import subprocess + + from .libbcc import lib, bcc_symbol, bcc_symbol_option, bcc_stacktrace_build_id, _SYM_CB_TYPE + from .table import Table, PerfEventArray, RingBuf, BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK +@@ -429,6 +430,35 @@ class BPF(object): + + assert not (text and src_file) + ++ # Fix 'larchintrin.h' file not found error for loongarch64 ++ architecture = platform.machine() ++ if architecture == 'loongarch64': ++ ++ # get clang include path ++ try: ++ clang_include_path_output = subprocess.check_output(['clang', '-print-file-name=include'], stderr=subprocess.STDOUT) ++ clang_include_path_str = clang_include_path_output.decode('utf-8').strip('\n') ++ if not os.path.exists(clang_include_path_str): ++ clang_include_path_str = False ++ except Exception as e: ++ clang_include_path_str = False ++ ++ # get gcc include path ++ try: ++ gcc_include_path_output = subprocess.check_output(['gcc', '-print-file-name=include'], stderr=subprocess.STDOUT) ++ gcc_include_path_str = gcc_include_path_output.decode('utf-8').strip('\n') ++ if not os.path.exists(gcc_include_path_str): ++ gcc_include_path_str = False ++ except Exception as e: ++ gcc_include_path_str = False ++ ++ # add clang and gcc include path for cflags ++ if clang_include_path_str: ++ cflags.append("-I" + clang_include_path_str) ++ ++ if gcc_include_path_str: ++ cflags.append("-I" + gcc_include_path_str) ++ + self.kprobe_fds = {} + self.uprobe_fds = {} + self.tracepoint_fds = {} +-- +2.43.0 + diff --git a/bcc.spec b/bcc.spec index 470c2e5..7ea6db1 100644 --- a/bcc.spec +++ b/bcc.spec @@ -2,7 +2,7 @@ Name: bcc Version: 0.29.1 -Release: 2 +Release: 3 Summary: BPF Compiler Collection (BCC) License: ASL 2.0 URL: https://github.com/iovisor/bcc @@ -10,6 +10,7 @@ URL: https://github.com/iovisor/bcc Source0: %{url}/releases/download/v%{version}/%{name}-src-with-submodule.tar.gz Patch0001: backport-Fix-ttysnoop.py-with-newer-kernels-4888.patch +Patch0002: 0001-Fix-larchintrin.h-not-found-error-for-loongarch64.patch # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches @@ -164,6 +165,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/ %changelog +* Thu Aug 22 2024 zhangzikang - 0.29.1-3 +- Fix larchintrin.h not found error for loongarch64 + * Thu May 09 2024 jinzhiguang - 0.29.1-2 - backport patch from upstream backport-Fix-ttysnoop.py-with-newer-kernels-4888.patch @@ -201,7 +205,7 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/ * Wed Mar 10 2021 wuchangye - 0.15.0-2 - rebuild -* Mon Oct 22 2020 liqingqing_1229 - 0.15.0-1 +* Thu Oct 22 2020 liqingqing_1229 - 0.15.0-1 - update source0's url * Wed Jul 22 2020 Shinwell Hu - 0.15.0-0 -- Gitee