Coder Social home page Coder Social logo

how to debug about python-vlc HOT 6 CLOSED

oaubert avatar oaubert commented on July 28, 2024
how to debug

from python-vlc.

Comments (6)

oaubert avatar oaubert commented on July 28, 2024

Hi

You should first try the basic loading of the vlc lib from a python
interpreter:

import ctypes
from ctypes.util import find_library
p = find_library('vlc')
dll = ctypes.CDLL(p)
dll.libvlc_get_version()

and see if it works.

Olivier

On Mon, 2016-11-21 at 01:25 -0800, lion6230i wrote:

Hi ,
I porting vlc library to mips platform and use vlc.py to test.
But have some error.
python vlc.py
Usage: vlc.py [options] <movie_filename>
Once launched, type ? for help.
Build date: Fri Oct 7 12:04:48 2016 (0x0)
Error: no function 'libvlc_get_version'
Could any one suggest me how to debug?
I have confirm libvlc.so have libvlc_get_version function.

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

from python-vlc.

lion6230i avatar lion6230i commented on July 28, 2024

Hi Olivier,
Thanks for your reply.
I try the command step by step ,

python

Python 2.7.6 (default, Nov 16 2016, 11:18:53)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import ctypes
from ctypes.util import find_library
p = find_library('vlc')
dll = ctypes.CDLL(p)
dll.libvlc_get_version()
Traceback (most recent call last):
File "", line 1, in
File "/media/python_nfs/lib/python2.7/ctypes/init.py", line 378, in getattr
func = self.getitem(name)
File "/media/python_nfs/lib/python2.7/ctypes/init.py", line 383, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: Unable to resolve symbol

Is it mean python can't find my libvlc.so ?
I have set LD_LIBRARY_PATH before I run python.

from python-vlc.

oaubert avatar oaubert commented on July 28, 2024

python seems to find libvlc.so (else it would fail at the ctypes.CDLL
line). Maybe your symbol names are mangled in the lib ? You should
check with 
readelf -Ws /path/to/libvlc.so
or
objdump -TC /path/to/libvlc.so

If the symbol information is correct, then maybe it has to do with the
arch. You should then investigate ctypes on mips, by for instance
building a minimal lib with a unique symbol.

Olivier

On Mon, 2016-11-21 at 02:23 -0800, lion6230i wrote:

Hi Olivier,
Thanks for your reply.
I try the command step by step ,
python
Python 2.7.6 (default, Nov 16 2016, 11:18:53)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
import ctypes
from ctypes.util import find_library
p = find_library('vlc')
dll = ctypes.CDLL(p)
dll.libvlc_get_version()
Traceback (most recent call last):
File "", line 1, in 
File "/media/python_nfs/lib/python2.7/ctypes/init.py", line 378, in
getattr
func = self.getitem(name)
File "/media/python_nfs/lib/python2.7/ctypes/init.py", line 383, in
getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: Unable to resolve symbol
Is it mean python can't find my libvlc.so ?
I have set LD_LIBRARY_PATH before I run python.

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

from python-vlc.

lion6230i avatar lion6230i commented on July 28, 2024

Hi Olivier,

I dump symbol information in library , it's correct.

[root@localhost lib]# objdump -TC libvlc.so|grep vlc_get_version
00005954 g DF .text 00000018 Base libvlc_get_version

Then I try the command in below:

python

Python 2.7.6 (default, Nov 16 2016, 11:18:53)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from ctypes import *
cdll.LoadLibrary("libc.so.0")
<CDLL 'libc.so.0', handle 43d838 at 2b396410>
libc = CDLL("libc.so.0")
libc.printf
<_FuncPtr object at 0x2b38b260>
libc.printf("lion debug")
lion debug10

Does it mean ctypes work fine on mips?

from python-vlc.

oaubert avatar oaubert commented on July 28, 2024

So it seems ctypes is working on mips, and you have the correct symbol
in libvlc. Maybe the ctypes.util.find_library does not find the
appropriate library, could you check the output?

Olivier
On Mon, 2016-11-21 at 17:33 -0800, lion6230i wrote:

Hi Olivier,
I dump symbol information in library , it's correct.
[root@localhost lib]# objdump -TC libvlc.so|grep vlc_get_version
00005954 g DF .text 00000018 Base libvlc_get_version
Then I try the command in below:
python
Python 2.7.6 (default, Nov 16 2016, 11:18:53)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
from ctypes import *
cdll.LoadLibrary("libc.so.0")
<CDLL 'libc.so.0', handle 43d838 at 2b396410>
libc = CDLL("libc.so.0")
libc.printf
<_FuncPtr object at 0x2b38b260>
libc.printf("lion debug")
lion debug10
Does it mean ctypes work fine on mips?

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

from python-vlc.

lion6230i avatar lion6230i commented on July 28, 2024

Hi Olivier,

You are right. The problem case by find_library.
I modify vlc.py skip find_library step , load libvlc.so directly.
Then test it , it's works fine.

python vlc.py

lion debug 1
Usage: vlc.py [options] <movie_filename>
Once launched, type ? for help.

Build date: Fri Oct 7 12:04:48 2016 (0x0)
LibVLC version: 2.2.4 Weatherwax (0x2020400)
LibVLC compiler: gcc version 4.7.3 (Buildroot 2013.08-00907-ga7254e1)

I think , it's may cause by my platform do not have ldconfig.
Somebody said find_library will use ldconfig to look up where library can load.
Anyway thanks for your support.

from python-vlc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.