Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 667764 - dev-python/pycparser-2.18.1-r1 with Kodi: ERROR: start symbol translation_unit_or_empty undefined
Summary: dev-python/pycparser-2.18.1-r1 with Kodi: ERROR: start symbol translation_uni...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-05 00:27 UTC by Craig Andrews
Modified: 2022-06-12 05:25 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Kodi script.extendedinfo callstack (kodi.log.bug,34.88 KB, text/plain)
2020-07-14 15:49 UTC, Balint SZENTE
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Andrews gentoo-dev 2018-10-05 00:27:28 UTC
With media-tv/kodi-9999 (I strongly suspect this also happens with media-tv/kodi-17.6-r1 as well, but haven't tested it) and dev-python/pycparser-2.18.1-r1, when a Youtube video is shared to Kodi using Yatse, the video does not play, an error is shown on screen, and this error is logged in Kodi's log:
------
17:25:50.569 T:139685905950464   ERROR: ERROR: start symbol translation_unit_or_empty undefined
17:25:50.571 T:139685905950464   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'pycparser.ply.yacc.YaccError'>
                                            Error Contents: Unable to build parser
                                            Traceback (most recent call last):
                                              File "/home/mythtv/.kodi/addons/script.yatse.kodi/default.py", line 8, in <module>
                                                from lib import share, stream, utils
                                              File "/home/mythtv/.kodi/addons/script.yatse.kodi/lib/share.py", line 12, in <module>
                                                import youtube_dl
                                              File "/home/mythtv/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/__init__.py", line 15, in <module>
                                                from .options import (
                                              File "/home/mythtv/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/options.py", line 8, in <module>
                                                from .downloader.external import list_external_downloaders
                                              File "/home/mythtv/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/downloader/__init__.py", line 5, in <module>
                                                from .hls import HlsFD
                                              File "/home/mythtv/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/downloader/hls.py", line 6, in <module>
                                                from Crypto.Cipher import AES
                                              File "/usr/lib64/python2.7/site-packages/Crypto/Cipher/__init__.py", line 27, in <module>
                                                from Crypto.Cipher._mode_ecb import _create_ecb_cipher
                                              File "/usr/lib64/python2.7/site-packages/Crypto/Cipher/_mode_ecb.py", line 29, in <module>
                                                from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
                                              File "/usr/lib64/python2.7/site-packages/Crypto/Util/_raw_api.py", line 63, in <module>
                                                uint8_t_type = ffi.typeof(ffi.new("const uint8_t*"))
                                              File "/usr/lib64/python2.7/site-packages/cffi/api.py", line 257, in new
                                                cdecl = self._typeof(cdecl)
                                              File "/usr/lib64/python2.7/site-packages/cffi/api.py", line 177, in _typeof
                                                result = self._typeof_locked(cdecl)
                                              File "/usr/lib64/python2.7/site-packages/cffi/api.py", line 162, in _typeof_locked
                                                type = self._parser.parse_type(cdecl)
                                              File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 476, in parse_type
                                                return self.parse_type_and_quals(cdecl)[0]
                                              File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 479, in parse_type_and_quals
                                                ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2]
                                              File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 276, in _parse
                                                ast = _get_parser().parse(fullcsource)
                                              File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 45, in _get_parser
                                                _parser_cache = pycparser.CParser()
                                              File "/usr/lib64/python2.7/site-packages/pycparser/c_parser.py", line 117, in __init__
                                                outputdir=taboutputdir)
                                              File "/usr/lib64/python2.7/site-packages/pycparser/ply/yacc.py", line 3352, in yacc
                                                raise YaccError('Unable to build parser')
                                            YaccError: Unable to build parser
                                            -->End of Python script error report<--
17:25:50.571 T:139685905950464   DEBUG: onExecutionDone(20, /home/mythtv/.kodi/addons/script.yatse.kodi/default.py)
------

Downgrading to dev-python/pycparser-2.17 solves the problem and everything works great.

This issue appears to be the same problem reported upstream at https://github.com/eliben/pycparser/pull/198

It also seems to be the same root cause as bug 628386

Also, perhaps useful information: Kodi uses python 2.7.
Comment 1 Craig Andrews gentoo-dev 2018-11-27 01:20:24 UTC
This issue still exists with dev-python/pycparser-2.19 unfortunately
Comment 2 dawgg 2019-09-20 11:11:03 UTC
i confirm this error with pycparser-2.19.
it happens on kodi-18.4 from portage (~amd64):
https://forums.gentoo.org/viewtopic-t-1101978-highlight-.html
with an unsupported plugin:
https://github.com/CastagnaIT/plugin.video.netflix

It is reported to have sth. to do with optimization-flags:
https://github.com/eliben/pycparser/issues/291)
but compiling python-2.7 and all related pkgs with
 CFLAGS="-march=x86-64 -mtune=k8 -O0 -fomit-frame-pointer -pipe" CXXFLAGS="${CFLAGS}" LDFLAGS="" LDDFLAGS=""
changed absolutely nothing:
https://github.com/CastagnaIT/plugin.video.netflix/issues/219

i'll go back to pycparser-2.17 and see if that works.
Comment 3 Barnabás Virágh 2020-04-08 15:52:00 UTC
This issue still exists with dev-python/pycparser-2.19-r1
for and additional information, I have PYTHONOPTIMIZE=2 environment variable set. 

When I emerge it with PYTHONOPTIMIZE=0, it compiles.
Comment 4 Sudrien 2020-04-10 04:14:05 UTC
How do you install with PYTHONOPTIMIZE=0 ? I'm not seeing any examples in portage.

I ended up doing a `pip install pycparser --user` to get rid of my error for now.
Comment 5 Daniel Hiepler 2020-04-15 12:21:37 UTC
you can set per-package env variables.

Check https://wiki.gentoo.org/wiki//etc/portage/package.env for a detailed description.

But neither using PYTHONOPTIMIZE=0 nor PYTHONDONTWRITEBYTECODE=1 fixed this issue for me.

Deleting all *.pyo manually after the merge fixed it, though:

find /usr/lib/python2.7/site-packages/pycparser/ -name '*.pyo' -delete
Comment 6 Balint SZENTE 2020-07-14 15:49:24 UTC
Created attachment 649166 [details]
Kodi script.extendedinfo callstack

(In reply to Daniel Hiepler from comment #5)
>
> Deleting all *.pyo manually after the merge fixed it, though:
> 
> find /usr/lib/python2.7/site-packages/pycparser/ -name '*.pyo' -delete

I can confirm, only this solved the issue for me. See attached the error log for ExtendedInfo script.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-06-12 05:25:33 UTC
Cleanup of bugs open for old versions.