Can't run BCC on Debian


Nan Xiao <xiaonan830818@...>
 

Hi all,

I want to try BPF on my Debian box, so I upgrade kernel to 4.7.0 first:  

# uname -a
Linux debian 4.7.0 #1 SMP Thu Jul 28 02:09:30 EDT 2016 x86_64 GNU/Linux

Then I follow Ubuntu part to install BCC, and all seems OK. But executing hello_world.py reports following error:

# /usr/share/bcc/examples/hello_world.py
Traceback (most recent call last):
  File "/usr/share/bcc/examples/hello_world.py", line 9, 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
  File "/usr/lib/python2.7/dist-packages/bcc/libbcc.py", line 17, in <module>
    lib = ct.CDLL("libbcc.so.0", use_errno=True)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/x86_64-linux-gnu/libbcc.so.0: undefined symbol: _ZNSt14error_categoryC2Ev

Could anyone help to give some comments on this issue?
Thanks very much in advance!

Best Regards
Nan Xiao


Kyle Laracey <kyle@...>
 

Not sure if this mailing list is the appropriate place for this, as I am new to this community, but here are my thoughts:

How did you install BCC? I had a similar issue on Ubuntu  when I had installed a source version of bcc and also the package version and mixing the python scripts for one with the library for the other. 

I also just checked out the /usr/lib/x86_64-linux-gnu/libbcc.so on my system (installed via the package) and it does not have any symbols matching "error_category", but the one I built from source does have those symbols.

The way I solved the problem was to call the scripts with LD_PRELOAD and PYTHONPATH set appropriately. 
I did not install into /usr what I built from source , so I just point LD_PRELOAD and PYTHONPATH to the appropriate places in the build folder when I call the scripts and want to use the from-source version, e.g.

sudo LD_PRELOAD=/path/to/bcc/build/src/cc/libbcc.so PYTHONPATH=/path/to/bcc/src/python <your script> 

Hope this helps
Kyle

On Thu, Jul 28, 2016 at 3:52 AM, Nan Xiao via iovisor-dev <iovisor-dev@...> wrote:
Hi all,

I want to try BPF on my Debian box, so I upgrade kernel to 4.7.0 first:  

# uname -a
Linux debian 4.7.0 #1 SMP Thu Jul 28 02:09:30 EDT 2016 x86_64 GNU/Linux

Then I follow Ubuntu part to install BCC, and all seems OK. But executing hello_world.py reports following error:

# /usr/share/bcc/examples/hello_world.py
Traceback (most recent call last):
  File "/usr/share/bcc/examples/hello_world.py", line 9, 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
  File "/usr/lib/python2.7/dist-packages/bcc/libbcc.py", line 17, in <module>
    lib = ct.CDLL("libbcc.so.0", use_errno=True)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/x86_64-linux-gnu/libbcc.so.0: undefined symbol: _ZNSt14error_categoryC2Ev

Could anyone help to give some comments on this issue?
Thanks very much in advance!

Best Regards
Nan Xiao

_______________________________________________
iovisor-dev mailing list
iovisor-dev@...
https://lists.iovisor.org/mailman/listinfo/iovisor-dev



Brenden Blanco <bblanco@...>
 

On Thu, Jul 28, 2016 at 3:52 AM, Nan Xiao via iovisor-dev <iovisor-dev@...> wrote:
Hi all,

I want to try BPF on my Debian box, so I upgrade kernel to 4.7.0 first:  

# uname -a
Linux debian 4.7.0 #1 SMP Thu Jul 28 02:09:30 EDT 2016 x86_64 GNU/Linux

Then I follow Ubuntu part to install BCC, and all seems OK. But executing hello_world.py reports following error:

# /usr/share/bcc/examples/hello_world.py
Traceback (most recent call last):
  File "/usr/share/bcc/examples/hello_world.py", line 9, 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
  File "/usr/lib/python2.7/dist-packages/bcc/libbcc.py", line 17, in <module>
    lib = ct.CDLL("libbcc.so.0", use_errno=True)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/x86_64-linux-gnu/libbcc.so.0: undefined symbol: _ZNSt14error_categoryC2Ev

This might also be due to mixing of clang versions between Debian and Ubuntu. Did you compile from source or install the .deb?

Could anyone help to give some comments on this issue?
Thanks very much in advance!

Best Regards
Nan Xiao

_______________________________________________
iovisor-dev mailing list
iovisor-dev@...
https://lists.iovisor.org/mailman/listinfo/iovisor-dev



Nan Xiao <xiaonan830818@...>
 

Hi Brenden & Kyle,

Thanks very much for your kind reply!

I decide to download clang && LLVM source code (v3.8.1), and build it myself. The LLVM build process is smooth, while compiling clang, it is hang, and seems dead-lock (I am not sure):   

[ 91%] Built target clangFormat
[ 92%] Built target diagtool
Linking CXX executable ../../bin/clang

I am still debuging it now. Anyway, this may not be related to BCC, thanks very much again!



Best Regards
Nan Xiao

On Fri, Jul 29, 2016 at 3:09 AM, Brenden Blanco <bblanco@...> wrote:
On Thu, Jul 28, 2016 at 3:52 AM, Nan Xiao via iovisor-dev <iovisor-dev@...> wrote:
Hi all,

I want to try BPF on my Debian box, so I upgrade kernel to 4.7.0 first:  

# uname -a
Linux debian 4.7.0 #1 SMP Thu Jul 28 02:09:30 EDT 2016 x86_64 GNU/Linux

Then I follow Ubuntu part to install BCC, and all seems OK. But executing hello_world.py reports following error:

# /usr/share/bcc/examples/hello_world.py
Traceback (most recent call last):
  File "/usr/share/bcc/examples/hello_world.py", line 9, 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
  File "/usr/lib/python2.7/dist-packages/bcc/libbcc.py", line 17, in <module>
    lib = ct.CDLL("libbcc.so.0", use_errno=True)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/x86_64-linux-gnu/libbcc.so.0: undefined symbol: _ZNSt14error_categoryC2Ev

This might also be due to mixing of clang versions between Debian and Ubuntu. Did you compile from source or install the .deb?

Could anyone help to give some comments on this issue?
Thanks very much in advance!

Best Regards
Nan Xiao

_______________________________________________
iovisor-dev mailing list
iovisor-dev@...
https://lists.iovisor.org/mailman/listinfo/iovisor-dev