public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Python issue
@ 2017-04-18 19:56 KT
  0 siblings, 0 replies; only message in thread
From: KT @ 2017-04-18 19:56 UTC (permalink / raw)
  To: edk2-devel; +Cc: edk2-lists

Hi experts,

I am experimenting python scripts in UEFI shell and as part of the first
step I tried compiling python as per the instructions in
edk2\AppPkg\Applications\Python\PythonReadMe.txt.  However when I run my
script, I noticed that it required third-party modules (requests, urllib3
etc). So I manually copied these under the
\EFI\StdLib\lib\python.27\site-packages
folder (not sure if that is the correct way). That said currently my script
is failing as follows:

    Traceback (most recent call last):
      File "rest_json.py", line 11, in <module>
        import requests
      File "\Efi\StdLib\lib\python.27\site-packages/requests/__init__.py",
line 60, in <module>
        from .packages.urllib3.exceptions import DependencyWarning
      File "\Efi\StdLib\lib\python.27\site-packages/requests/packages/__init__.py",
line 29, in <module>
        import urllib3
      File "\Efi\StdLib\lib\python.27\site-packages/urllib3/__init__.py",
line 8, in <module>
        from .connectionpool import (
      File "\Efi\StdLib\lib\python.27\site-packages/urllib3/connectionpool.py",
line 28, in <module>
        from .packages.six.moves import queue
      File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/six.py",
line 203, in load_module
        mod = mod._resolve()
      File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/six.py",
line 115, in _resolve
        return _import_module(self.mod)
      File "\Efi\StdLib\lib\python.27\site-packages/urllib3/packages/six.py",
line 82, in _import_module
        __import__(name)
      File "\Efi\StdLib\lib\python.27/Queue.py", line 7, in <module>
        import dummy_threading as _threading
      File "\Efi\StdLib\lib\python.27/dummy_threading.py", line 45, in
<module>
        import threading
    ImportError: No module named threading



I understand that the script is now looking for the threading module and
after investigating further I realized I may have to turn on the threading
module as part of compiling python. So I modified the
\edk2\AppPkg\Applications\Python\X64\pyconfig.h file to change '#undef
WITH_THREAD' to '#define WITH_THREAD', but this is giving the following
compiling error. Any pointers please?

        "C:\Program Files (x86)\Microsoft Visual Studio
11.0\Vc\bin\x86_amd64\cl.exe" /Foc:\users\user\documents\dev\uefi\edk2\edk
2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\Python\
PythonCore\OUTPUT\.\AutoGen.obj /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
/O1ib2s /GL /
Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Oi- /wd4018 /wd4054 /wd4055
/wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310
/wd4389 /
wd4701 /wd4702 /wd4706
/Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applications\Python\X64
/Ic:\users\user\documents\de
v\uefi\edk2\edk2\AppPkg\Applications\Python\Efi
/Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applications
\Python\Python-2.7.2\Include /DHAVE_MEMMOVE /DUSE_PYEXPAT_CAPI /DXML_STATIC
/X /Zc:wchar_t /D UEFI_C_SOURCE /Ic:\users\user\documents\dev\uefi\edk2_
livecode_3_6_2016\edk2\AppPkg\Applications\Python\Python-2.7.2\Modules\zlib
/Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\A
pplications\Python\Python-2.7.2\Modules\expat
/Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\
Applications\Python\PyMod-2.7.2
\Modules\expat  /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\
Applications\Python\Python-2.7.2\Modules\cjkcodecs  /Ic:\users
\user\documents\dev\uefi\edk2\edk2\AppPkg\Applications\
Python\Python-2.7.2\Modules\_io  /Ic:\users\user\documents\dev\uefi\edk2
_livecode_3_6_2016\edk2\AppPkg\Applications\Python\Python-2.7.2\Modules
/Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Appli
cations\Python\PyMod-2.7.2\Modules  /Ic:\users\user\documents\dev\
uefi\edk2\edk2\AppPkg\Applications\Python\Python-2.7.2\Objects
/Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\
Applications\Python\PyMod-2.7.2\Objects  /Ic:\users\user\documents\dev\uefi
\edk2\edk2\AppPkg\Applications\Python\Python-2.7.2\Python
/Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\A
pplications\Python\PyMod-2.7.2\Python  /Ic:\users\user\documents\dev\
uefi\edk2\edk2\AppPkg\Applications\Python\Python-2.7.2\Parser
  /Ic:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\Applications\Python\Efi
/Ic:\users\user\documents\dev\uefi\edk2_livecode
_3_6_2016\edk2\AppPkg\Applications\Python  /Ic:\users\user\documents\dev\
uefi\edk2\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Ap
plications\Python\PythonCore\DEBUG
/Ic:\users\user\documents\dev\uefi\edk2\edk2\StdLib
/Ic:\users\user\documents\dev\uefi\edk
2_livecode_3_6_2016\edk2\StdLib\Include  /Ic:\users\user\documents\dev\
uefi\edk2\edk2\StdLib\Include\X64  /Ic:\users\user\docum
ents\dev\uefi\edk2\edk2\MdePkg
/Ic:\users\user\documents\dev\uefi\edk2\edk2\MdePkg\Include
/Ic:\users\user\
documents\dev\uefi\edk2\edk2\MdePkg\Include\X64 c:\users\user\documents\dev\
uefi\edk2\edk2\Build\AppPkg\DEBUG_VS
2012x86\X64\AppPkg\Applications\Python\PythonCore\DEBUG\AutoGen.c
cl : Command line warning D9025 : overriding '/Oi' with '/Oi-'
AutoGen.c
        "C:\Program Files (x86)\Microsoft Visual Studio
11.0\Vc\bin\x86_amd64\lib.exe" /NOLOGO /LTCG /OUT:c:\users\user\documents\
dev\uefi\edk2_live
code_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\
AppPkg\Applications\Python\PythonCore\OUTPUT\Python.lib
@c:\users\user\documents\dev\uefi\edk2_l
ivecode_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\
AppPkg\Applications\Python\PythonCore\OUTPUT\object_files.lst
        "C:\Program Files (x86)\Microsoft Visual Studio
11.0\Vc\bin\x86_amd64\link.exe" /OUT:c:\users\user\documents\dev\uefi\edk2
\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\Python\PythonCore\DEBUG\Python.dll
/NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /
MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL
/ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO
/BASE
:0 /DRIVER /DEBUG  @c:\users\user\documents\dev\uefi\edk2\edk2\Build\AppPkg\
DEBUG_VS2012x86\X64\AppPkg\Applications\Python\PythonC
ore\OUTPUT\static_library_files.lst
Python.lib(ceval.obj) : error LNK2001: unresolved external symbol
PyThread_acquire_lock
Python.lib(ceval.obj) : error LNK2001: unresolved external symbol
PyThread_allocate_lock
Python.lib(ceval.obj) : error LNK2001: unresolved external symbol
PyThread_get_thread_ident
Python.lib(ceval.obj) : error LNK2001: unresolved external symbol
PyThread_release_lock
Python.lib(signalmodule.obj) : error LNK2001: unresolved external symbol
PyThread_ReInitTLS
Python.lib(pystate.obj) : error LNK2001: unresolved external symbol
PyThread_delete_key
Python.lib(pystate.obj) : error LNK2001: unresolved external symbol
PyThread_create_key
Python.lib(pystate.obj) : error LNK2001: unresolved external symbol
PyThread_set_key_value
Python.lib(pystate.obj) : error LNK2001: unresolved external symbol
PyThread_delete_key_value
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
11.0\Vc\bin\x86_amd64\link.exe"' : return code '0x460'
PStop.
ython.lib(pystate.obj) : error LNK2001: unresolved external symbol
PyThread_get_key_value
Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol
PyThread_free_lock
Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol
PyThread_get_stacksize
Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol
PyThread_exit_thread
Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol
PyThread_init_thread
Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol
PyThread_set_stacksize
Python.lib(threadmodule.obj) : error LNK2001: unresolved external symbol
PyThread_start_new_thread
c:\users\user\documents\dev\uefi\edk2\edk2\Build\AppPkg\
DEBUG_VS2012x86\X64\AppPkg\Applications\Python\PythonCore\DEBUG\Python.dll
 : fatal error LNK1120: 16 unresolved externals

build...
 : error 7000: Failed to execute command
        C:\Program Files (x86)\Microsoft Visual Studio
11.0\Vc\bin\nmake.exe /nologo tbuild [c:\users\user\documents\dev\uefi\edk2
\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\Python\
PythonCore]

build...
 : error F002: Failed to build module
        c:\users\user\documents\dev\uefi\edk2\edk2\AppPkg\
Applications\Python\PythonCore.inf [X64, VS2012x86, DEBUG]



Note that I also has to modify \edk2\AppPkg\Applications\Python\Efi\config.c
to uncomment "{"thread", initthread}," and edit
\edk2\AppPkg\Applications\Python\PythonCore.inf
to add 'Python-$(PYTHON_VERSION)/Modules/threadmodule.c'.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-18 19:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18 19:56 Python issue KT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox