Summary: | dev-lang/python:3.7: failed build on x86 (ModuleNotFoundError: No module named '_struct') | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Murmeltier <woct002> |
Component: | Current packages | Assignee: | Python Gentoo Team <python> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | mgorny, sam |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Full build log |
Description
Murmeltier
2020-08-19 16:25:25 UTC
Full build.log please. Created attachment 655616 [details]
Full build log
Full build log of python 3.7.8 emerge run
Did previous versions of Python build fine for you, or is this the first version you're building? Until python 3.4 everything was fine. Problems started with python 3.5, same error. Somebody from German Gentoo forum provided a patch for "Lib/gettext.py", where i should insert "import struct" in line 53 With this patch it compiled without error. (Forum link is "https://forums.gentoo.org/viewtopic-t-1108800.html", but it's all in German...) Same worked for python 3.6 From python 3.7 this did not work anymore. I also tried re-emerge of python packages without success. Funny, that it works on my amd64 box, but not on the x86 box (which i have as a backup machine) Do I understand correctly that in the linked Forum thread the problem seems specific to x86 as well? Could you try setting LC_ALL=C and let me know if that changes anything? Do you have the same locale on amd64 machine? Yes, forum thread is about x86 I will try the locale setting C later and will post the resul ok, i run <LC_ALL=C emerge -u python>, no change, error still there. Changing locale with eselect locale set 1 (C) -> same result I suppose you could also try -j1 for completeness but I doubt it's relevant. I *suspect* it may have to do with some .mo file on your system that our systems don't have. Can you reproduce the error by running setup.py directly from the work directory, the same way Makefile does? i.e.: cd /tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8 LD_LIBRARY_PATH=/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8 CC='i686-pc-linux-gnu-gcc -pthread' LDSHARED='i686-pc-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,--as-needed -L. ' CFLAGS='-Wno-unused-result -Wsign-compare -DNDEBUG -O2 -march=pentium4 -mmmx -msse -msse2 -pipe -fwrapv ' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py build ok, -j1 makes no difference What i did now: emerged again until it crashes, then i used the remaining temp portage directory to copy+execute your command. The error lines are displayed immediately: root@Idefix /tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8 # LD_LIBRARY_PATH=/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8 CC='i686-pc-linux-gnu-gcc -pthread' LDSHARED='i686-pc-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,--as-needed -L. ' CFLAGS='-Wno-unused-result -Wsign-compare -DNDEBUG -O2 -march=pentium4 -mmmx -msse -msse2 -pipe -fwrapv ' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py build Traceback (most recent call last): File "./setup.py", line 4, in <module> import sys, os, importlib.machinery, re, optparse File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/optparse.py", line 422, in <module> _builtin_cvt = { "int" : (_parse_int, _("integer")), File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 625, in gettext return dgettext(_current_domain, message) File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 588, in dgettext codeset=_localecodesets.get(domain)) File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 533, in translation t = _translations.setdefault(key, class_(fp)) File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 260, in __init__ self._parse(fp) File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 344, in _parse from struct import unpack File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/struct.py", line 13, in <module> from _struct import * ModuleNotFoundError: No module named '_struct' Ok, now I'm going to ask you to do some debugging. For your convenience, you may want to put the whole directory under VCS control (git init; git add -A; git commit -m 1) or make backups of files you modify. For a start, open Lib/gettext.py and before line 532 (that is: with open(mofile, 'rb') as fp: add: print(mofile) So that we can see which files it tries to open. For extra kudos, you could run qfile (from portage-utils) to check which packages the printed files belong to. ok, i'm not familiar with git, so i changed this:
gettext.py:
if t is None:
print(">>>>> debug")
print(mofile)
with open(mofile, 'rb') as fp:
t = _translations.setdefault(key, class_(fp))
executing the build command:
root@Idefix /tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8 # LD_LIBRARY_PATH=/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8 CC='i686-pc-linux-gnu-gcc -pthread' LDSHARED='i686-pc-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,--as-needed -L. ' CFLAGS='-Wno-unused-result -Wsign-compare -DNDEBUG -O2 -march=pentium4 -mmmx -msse -msse2 -pipe -fwrapv ' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py build
>>>>> debug
/usr/share/locale/de/LC_MESSAGES/messages.mo
Traceback (most recent call last):
File "./setup.py", line 4, in <module>
import sys, os, importlib.machinery, re, optparse
File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/optparse.py", line 422, in <module>
_builtin_cvt = { "int" : (_parse_int, _("integer")),
File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 627, in gettext
return dgettext(_current_domain, message)
File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 590, in dgettext
codeset=_localecodesets.get(domain))
File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 535, in translation
t = _translations.setdefault(key, class_(fp))
File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 260, in __init__
self._parse(fp)
File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/gettext.py", line 344, in _parse
from struct import unpack
File "/tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8/Lib/struct.py", line 13, in <module>
from _struct import *
ModuleNotFoundError: No module named '_struct'
and finally:
equery b /usr/share/locale/de/LC_MESSAGES/messages.mo
* Searching for /usr/share/locale/de/LC_MESSAGES/messages.mo ...
root@Idefix /tmp/portage/dev-lang/python-3.7.8-r2/work/Python-3.7.8 #
Did not find any package for this mo file.
File itself is from year 2009, huu...
So i renamed it from "messages.mo" to "messages.zzz"
Then i did a full fresh emerge -u python ...
What should i say: IT COMPILES :-D :-D :-D
Great job, great support
Many thanks!
Let's close it as system problem. If you notice the file again or figure out where it came from, please tell us. (In reply to woct002 from comment #12) messages.po is default output file of xgettext tool: https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html msgfmt tool compiles *.po files into binary *.mo files: https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html msgunfmt tool can mostly reverse above operation: https://www.gnu.org/software/gettext/manual/html_node/msgunfmt-Invocation.html If you want to find hints about origin of this messages.mo file, use msgunfmt to create messages.po from this messages.mo file and check content of messages.po. I had a quick look into the (binary) messages.mo before i deleted it, must be part of the "xaos" fractal generator. But i think it was changed somehow (or the file date was tampered), so it was not properly removed by unmerging the "xaos" package. No problem for 11 years until python 3.x came along, bad luck ;-) |