bcc icon indicating copy to clipboard operation
bcc copied to clipboard

OSError: /lib/x86_64-linux-gnu/libbcc.so.0: undefined symbol: _ZSt28__throw_bad_array_new_lengthv

Open wenhx2022 opened this issue 2 years ago • 5 comments

I install BCC use source follow :INSTALL.md.

My system: uname -a Linux liujilei-virtual-machine 5.19.0-35-generic https://github.com/iovisor/bcc/pull/36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux so i install the depends: sudo apt install -y bison build-essential cmake flex git libedit-dev libllvm14 llvm-14-dev libclang-14-dev python3 zlib1g-dev libelf-dev libfl-dev python3-setuptools

build follow: git clone https://github.com/iovisor/bcc.git mkdir bcc/build; cd bcc/build cmake .. make sudo make install cmake -DPYTHON_CMD=python3 .. # build python3 binding pushd src/python/ make sudo make install popd

run example: cd bcc/example python3 hello_word.py and error: python3 hello_world.py Traceback (most recent call last): File "/usr/share/bcc/tools/./stackcount", line 19, in from bcc import BPF, USDT File "/usr/lib/python3/dist-packages/bcc/init.py", line 26, in from .libbcc import lib, bcc_symbol, bcc_symbol_option, bcc_stacktrace_build_id, _SYM_CB_TYPE File "/usr/lib/python3/dist-packages/bcc/libbcc.py", line 17, in lib = ct.CDLL("libbcc.so.0", use_errno=True) File "/usr/lib/python3.10/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: /lib/x86_64-linux-gnu/libbcc.so.0: undefined symbol: _ZSt28__throw_bad_array_new_lengthv Has anyone encountered this problem?

wenhx2022 avatar May 15 '23 17:05 wenhx2022

same problem Traceback (most recent call last): File "//./offcputime.py", line 14, in from bcc import BPF File "/usr/lib/python3/dist-packages/bcc/init.py", line 27, in from .libbcc import lib, bcc_symbol, bcc_symbol_option, bcc_stacktrace_build_id, _SYM_CB_TYPE File "/usr/lib/python3/dist-packages/bcc/libbcc.py", line 17, in lib = ct.CDLL("libbcc.so.0", use_errno=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/ctypes/init.py", line 376, in init self._handle = _dlopen(self._name, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: /lib/aarch64-linux-gnu/libbcc.so.0: undefined symbol: _ZSt28__throw_bad_array_new_lengthv

gaozig avatar Jun 10 '23 04:06 gaozig

In my case, the issue was caused by a difference in GCC versions between Python 3 and the one used for compilation.

hov1417 avatar Jul 09 '23 12:07 hov1417

In my case, the issue was caused by a difference in GCC versions between Python 3 and the one used for compilation.

@hov1417 So how do you solve it ?

stricklandye avatar Oct 26 '23 03:10 stricklandye

These were the outputs of gcc --version

gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 10.5.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and python3

Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

note that gcc is 10.5.0 in one case and 11.4.0 in the other. I changed my current using update-alternatives

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11

hov1417 avatar Oct 26 '23 08:10 hov1417

@hov1417 I see but it not works for me :(. Anyway thank you very much.

stricklandye avatar Oct 27 '23 01:10 stricklandye