Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol: bpf_module_create_b #4114

Closed
lizhiyuell opened this issue Jul 18, 2022 · 4 comments
Closed

undefined symbol: bpf_module_create_b #4114

lizhiyuell opened this issue Jul 18, 2022 · 4 comments

Comments

@lizhiyuell
Copy link

Hi, I'm installing bcc v0.24.0 in Ubuntu 18.04.1. The compiling is fine, but when I run example code /usr/share/bcc/tools/offcputime, I get the following errors:

Traceback (most recent call last):
  File "/usr/share/bcc/tools/offcputime", line 14, in <module>
    from bcc import BPF
  File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 27, in <module>
    from .libbcc import lib, _CB_TYPE, bcc_symbol, bcc_symbol_option, _SYM_CB_TYPE
  File "/usr/lib/python2.7/dist-packages/bcc/libbcc.py", line 20, in <module>
    lib.bpf_module_create_b.restype = ct.c_void_p
  File "/usr/lib/python2.7/ctypes/__init__.py", line 379, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 384, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/x86_64-linux-gnu/libbcc.so.0: undefined symbol: bpf_module_create_b

I install llvm and clang with sudo apt-get install libllvm6.0 llvm-6.0-dev libclang-6.0-dev.
Referring to issue #2222, I remove the previously installed bpfcc-tools and recompile the code, but the problem still exists.

How cloud I fix this problem? Thanks.

@chenhengqi
Copy link
Collaborator

Try using python3.

@lizhiyuell
Copy link
Author

Try using python3.

Changing to python3 works perfectly. Thanks.

@Tronginx
Copy link

I figured out the following solution worked for me:

cp -r /root/ebpf/bcc/build/src/python/bcc-python3/bcc/* /usr/lib/python3/dist-packages/bcc/

replace the first parameter with your bcc python library location.

Souce: https://blog.csdn.net/libocdf/article/details/130466925

@chenhengqi
Copy link
Collaborator

Please refer to #4583.

@iovisor iovisor locked as resolved and limited conversation to collaborators Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants