From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-x229.google.com (mail-yw0-x229.google.com [IPv6:2607:f8b0:4002:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5FE8121954066 for ; Mon, 24 Apr 2017 05:32:12 -0700 (PDT) Received: by mail-yw0-x229.google.com with SMTP id k11so31531192ywb.1 for ; Mon, 24 Apr 2017 05:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=h2BYbKDn/BH1WXj50f5apyDdsv7ocFuSx1Q02PrFdsQ=; b=UuAS62gzB0eUmqg+YP4eNeYPKyxWguWqCRZe9xz3+c1mUB/YChMv5SBA23o7qoM/XS b+365sYbql+u9gLh1Tzfm4m8c/VwfvwIhFdcl+QyDvSG35wjbUd+/VwLM4/kWTueeIEs aABK7Zn39OgJ/OZuIY4N/Big8qOMzr1xyRVAhh/SzCmT9SHHLRYRPz71NmxuOr5CW93G Im3RxS84EnO7KeqARP+Vt4koSVQKefCFgLmelpvk8tHEWJmRzvahsW71ogIQL7gWNMxh Bwaqe2fQbmUNQE3gdWdZK9XrYcdrCGN2mf2dDO6GgB4KpKFBNzWGtfYSXrAjuShK59fv eMWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=h2BYbKDn/BH1WXj50f5apyDdsv7ocFuSx1Q02PrFdsQ=; b=fS4HuR/YC8+gZQVE4x9J6eLeOw4POhCdKb5fGbcYSpsiNwVhNGNhtbmb2y28cKGfqj DjooP0WATacaKPSZdgTLKFU7Wh2YqQOK1LSPgmr+KBWSftjCSz5qojWzmVq3RAUvo7AY cw1J1z/efLwrMGj5MHWbMcCYZIJFyQlL1CxqxQU+RSeQD9NzQFBxHESH4DcyD2/HbgGX GcTLSB1oYPDLToNFVIEyjwuYakxLP+8RlNfwW/sY8I7jip7YDrYpXchDLygPc7hSSUid RK4C8PshLhoZhnaLC6/fTBabzZEzkqAO1RyDrH0llVJlVtO9WYELRStjUOM5J1wa6S14 z5DA== X-Gm-Message-State: AN3rC/7av8B7eyLF5Nzco0Stzm9cLbSJW39hYiCLm59M4/ipBLBl6MLg kjF6Rq0lCsv7S+YGYrBvtnuNBC9ZmA== X-Received: by 10.129.90.65 with SMTP id o62mr1052608ywb.61.1493037131263; Mon, 24 Apr 2017 05:32:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.122.68 with HTTP; Mon, 24 Apr 2017 05:31:50 -0700 (PDT) From: KT Date: Mon, 24 Apr 2017 07:31:50 -0500 Message-ID: To: edk2-devel@lists.01.org Cc: edk2-lists@mc2research.org X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: Python issue in UEFI shell X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 12:32:12 -0000 Content-Type: text/plain; charset=UTF-8 Hello, Can someone please shed some light on this issue? Thanks Thanks On Tue, Apr 18, 2017 at 2:56 PM, KT 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 > import requests > File "\Efi\StdLib\lib\python.27\site-packages/requests/__init__.py", > line 60, in > from .packages.urllib3.exceptions import DependencyWarning > File "\Efi\StdLib\lib\python.27\site-packages/requests/packages/__init__.py", > line 29, in > import urllib3 > File "\Efi\StdLib\lib\python.27\site-packages/urllib3/__init__.py", > line 8, in > from .connectionpool import ( > File "\Efi\StdLib\lib\python.27\site-packages/urllib3/connectionpool.py", > line 28, in > 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 > import dummy_threading as _threading > File "\Efi\StdLib\lib\python.27/dummy_threading.py", line 45, in > > 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'. >