public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: KT <tresko1@gmail.com>
To: edk2-devel@lists.01.org
Cc: edk2-lists@mc2research.org
Subject: Re: Python issue in UEFI shell
Date: Mon, 24 Apr 2017 07:31:50 -0500	[thread overview]
Message-ID: <CAD+hite04GxrzAqYbP2zfmDBsgDrV71Rkv9jW9Agg+7vsVHbrQ@mail.gmail.com> (raw)

Hello,
Can someone please shed some light on this issue?

Thanks

Thanks
On Tue, Apr 18, 2017 at 2:56 PM, KT <tresko1@gmail.com> wrote:

> 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\Pytho
> n\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\Applicat
> ions\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\Applicat
> ions\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\d
> ev\uefi\edk2_live
> code_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\A
> pplications\Python\PythonCore\OUTPUT\Python.lib
> @c:\users\user\documents\dev\uefi\edk2_l
> ivecode_3_6_2016\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPk
> g\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\P
> ython\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\u
> efi\edk2\edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applic
> ations\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\DEBU
> G_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\u
> efi\edk2
> \edk2\Build\AppPkg\DEBUG_VS2012x86\X64\AppPkg\Applications\P
> ython\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'.
>


             reply	other threads:[~2017-04-24 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 12:31 KT [this message]
2017-04-24 14:21 ` Python issue in UEFI shell Carsey, Jaben

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD+hite04GxrzAqYbP2zfmDBsgDrV71Rkv9jW9Agg+7vsVHbrQ@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox